Click here to Skip to main content
12,556,660 members (70,515 online)
Click here to Skip to main content
Add your own
alternative version


8 bookmarked

Visual Studio event macro to repair messed up DreamWeaver comments

, 6 Dec 2004 CPOL
Rate this:
Please Sign up or sign in to vote.
A macro for Visual Studio 7 to repair DreamWeaver comments when a file is saved.


If you work with files in both Visual Studio and DreamWeaver, then you may have run into a VS anomaly that will quickly drive you to the nut house. DreamWeaver templates work by using special HTML comments carefully placed in the source file. These comments are used to perform updates to the file when a template is re-applied. Move or modify these comments just a little and DreamWeaver can no longer update the source file. In the worse case, it can't even display the file properly within its editor!

The problem happens when you edit a file containing these special comments using Visual Studio 2002 and 2003. The great minds at Microsoft decided these comments were not correct, so the auto-formatter moves them around willy-nilly. My research has found that Microsoft knows about the problem and it will be fixed in Visual Studio 2005, so they say. However, I can't wait. This is driving me nuts right now, having to cut and paste all the comments back into their proper places before I edit the file in DreamWeaver.


What I did was write a macro that will search for these comments and move them back to where they belong when a source file is saved. I used the DocumentSaved event of the VS environment to do this. I would have preferred a DocumentSaving event so I could modify the document before being saved. This would have prevented my macro from causing a save-modify-save every time, but such is life. We can't have everything we want.

To install the macro, download the zip and copy the macro's contents into a macro file. The code is commented, so you'll have to glean the details directly from it if you are interested.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Charles Windhausen
Web Developer
United States United States
Charles works at PC Tools in Boulder, CO as a "do everything" developer. He's worked with Windows development for over 10 years and web development for over 5.

You may also be interested in...


Comments and Discussions

QuestionSame problems? Pin
javodv18-Jul-05 9:35
memberjavodv18-Jul-05 9:35 
AnswerRe: Same problems? Pin
lookaround18-Jul-05 20:26
memberlookaround18-Jul-05 20:26 
GeneralProblem installing... Pin
lookaround5-Jul-05 8:03
memberlookaround5-Jul-05 8:03 
AnswerUpdated the Download Pin
Charles Windhausen16-Sep-05 8:12
memberCharles Windhausen16-Sep-05 8:12 
GeneralWorks perfectly!!!! Pin
lookaround17-Sep-05 0:43
memberlookaround17-Sep-05 0:43 
GeneralRe: Works perfectly!!!! Pin
carzel4-Nov-05 8:36
membercarzel4-Nov-05 8:36 
GeneralThank you so much!!! Pin
lookaround5-Jul-05 7:11
memberlookaround5-Jul-05 7:11 
GeneralThanks Pin
kdubious24-Feb-05 11:47
memberkdubious24-Feb-05 11:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.161026.1 | Last Updated 6 Dec 2004
Article Copyright 2004 by Charles Windhausen
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid