Click here to Skip to main content
Click here to Skip to main content

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.

Introduction

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.

Solution

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.

License

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

Share

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.

Comments and Discussions

 
QuestionSame problems? Pinmemberjavodv18-Jul-05 10:35 
AnswerRe: Same problems? Pinmemberlookaround18-Jul-05 21:26 
GeneralProblem installing... Pinmemberlookaround5-Jul-05 9:03 
AnswerUpdated the Download PinmemberCharles Windhausen16-Sep-05 9:12 
GeneralWorks perfectly!!!! Pinmemberlookaround17-Sep-05 1:43 
GeneralRe: Works perfectly!!!! Pinmembercarzel4-Nov-05 9:36 
GeneralThank you so much!!! Pinmemberlookaround5-Jul-05 8:11 
GeneralThanks Pinmemberkdubious24-Feb-05 12:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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.141223.1 | Last Updated 6 Dec 2004
Article Copyright 2004 by Charles Windhausen
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid