Danushka "silvermace" Abeysuriya

Handy VC2008 Macro

So, if you’ve ever tried to drag a folder from the filesystem into VS Solution Explorerer, sure it’ll recursively add all the files, but it wont mirror the folders in the solution, so you end up with every file placed at the root level of whatever “filter-folder” you dragged it into. This is very annoying when you have a project with say ~1,500 files.

I thought about how I could get around this and have the Solution Explorer folders mirror the filesystem, first obvious option was write a shell script or macro to do it. So I fired up VS macro explorer and lo-and-behold theres a Sample macro which ships with VS called “AddDirAsSlnFolder”.

Looking very promising I checked out the source code, and sure enough it does exactly what I needed. The only thing I had to do to get it working exactly right was add “.svn” to the exclusions list (this is down the bottom of the source file and should be clearly visible next to all the other exclusions in the list)

Enjoy.

Leave a Reply

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>