Microsoft Build Macros

I hit this same problem every time I start a Visual Studio project.  Well, not every time, but it is a common occurrence. When there are multiple projects involved, it is sometimes necessary to point to different directories.  It is possible to hard code the locations but this is not good sometimes based on needing to move the solution to a shared location.

Quite some time ago, Microsoft invented their own way of dealing with this.  Instead of fixing the locations, it can be specified based on a “macro”.  These macros are defined at:

Macros for Build Commands and Properties

These macros are replaced with the real values during the build. It can be very helpful with regards to a retail versus a debug build. The most common ones I use are $(solutiondir) and $(projectdir). Any good tip is that the names already include the backslash so you will not need to specify that after the macro. Anything entered in as a path in Visual Studio should be relative to a macro unless the path is the same for everyone that might use the build.

The list is fairly extensive so you will probably find what you want. Even if you don’t, there is a way to create your own (which I am not going to cover).

About

Live near Brisbane, Australia. Software developer currently focused on iOS and Android. Avid Google Local Guide

Tagged with: , ,
Posted in Microsoft, Visual Studio
Archives
Categories
Follow Red Circle Blog on WordPress.com
%d bloggers like this: