How to share VS Macro Projects

One way to share VS Macro projects is to add the projects to source control and have all users mapped the versioned macro projects to a local folder to be used by VS. Here is a rough outline (an except from one of my forum post) on how you can accomplish this goal.

You can do this using a combination of mapping the Macro project local folder to source control and using the Source Control Explorer (or command line tf.exe) for version control operations.

When you create the macro project, specify a local folder like C:\Source\MacroProjects\MacroProjects1. Then use File > Source Control > Workspaces to map the macro projects folder C:\Source\MacroProjects to somewhere on the server like $/TeamProject/MacroProjects. You can then use the Source Control Explorer (or the command line tf.exe) to add and subsequently check-in the entire MacroProjects folder to source control.

Note: Since the IDE may/can hold onto the handle of a loaded macro project file (.vsmacros), you may want to unload the macro project before doing version control operations (like check-ins) or you may get an error about “another process accessing the file”.

From this point, the macro projects are on the server and can be shared by other users. Using the Source Control Explorer (or the command line tf.exe), other users just need to add a mapping to their workspace and then do a Get to download the macro projects to their local folder.

That’s it!