Samaursa
Samaursa

Reputation: 17197

Macro for Visual Studio version

I am using the command line to automate a few things in my project. I am using a lot of macros, for example $(PlatformName) - gives me Win32 or Win64, which help me write commands for all configuration types. I am wondering if there is a similar macro that I can use for the current version of Visual Studio, for example one that will return VS2008 or VS2010.

Upvotes: 1

Views: 1826

Answers (2)

user2764144
user2764144

Reputation: 31

Not sure about VS2008 explicitly but VS2010 and VS2012 offer $(VisualStudioVersion) with values of 10.0 and 11.0 respectively.

Upvotes: 0

user257111
user257111

Reputation:

It doesn't look like it. Here is a list of available macros. That's no guarantee there aren't other ways to detect the VC version in use, however; one option might be to work it out from the VCinstalldir by exploring subdirectories. Like any buildsystem activity this rapidly becomes a lot of special cases etc...

Upvotes: 3

Related Questions