It's possible with msbuild if you are willing to do a bit of editing to the preprocessor definitions for various projects of interest.
For example -
Code for proof of concept to show what macros have been defined -
#include <stdio.h>
#include <tchar.h>
int main()
{
#ifdef FOO1
puts("FOO1 defined");
#endif
#ifdef FOO2
puts("FOO2 defined");
#endif
#ifdef FOO3
puts("FOO3 defined");
#endif
puts("All done.");
return 0;
}
msbuild command - Dont define any macros.
msbuild command - Define FOO1
msbuild command - Define FOO1 & FOO2