I am Olga Arkhipova and I am a VC IDE developer. I joined VC team about two years ago and inherited vc project and build system. I’ve been using VC since VC2, so for me it is quite interesting to see and work on the code I’ve been using (or sometimes not using, because it did not do what I needed) for so long J
As VS9 has now shipped together with new compilers and libraries, several people inside Microsoft asked me how vc build finds its build tools (cl, link, different libraries and includes) and if it is possible to use a different VC toolset rather than those installed with VS (for instance, use vs9 from vs8 and vice versa, or a particular SDK toolset), so I decided it might be useful to blog about this question for other people. Yes, it is possible and the information on how to do this does exist on MSDN, but it appears to be hard to find and it is split into pieces.
To define a toolset for the command line build you need to:
· Set INCLUDE, LIB, LIBPATH and PATH environment variables to point to the corresponding directories of the toolset you want to use (LIBPATH is for managed References dirs). Something like
set MyToolSetRoot =c:\ MyToolSet
· Run ‘devenv /useenv’ or ‘vcbuild /useenv’ to force using defined locations instead of standard VS ones.
Note that those directories you set will be used for all platforms, so if you need to build for more than one platform, you’ll have to define INCLUDE, LIB, LIBPATH and PATH for each of them and build them separately, say, by running ‘vcbuild /platform:<str> …’
To see what VS9 (and I believe VS8) sets for different platforms, you can take a look at
c:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vsvars32.bat
And if you installed 64-bit platform support:
c:\Program Files\Microsoft Visual Studio 9.0\VC\bin\x86_ia64\vcvarsx86_ia64.bat (cross platform tools)
c:\Program Files\Microsoft Visual Studio 9.0\VC\bin\x86_amd64\vcvarsx86_amd64.bat (cross platform tools)
c:\Program Files\Microsoft Visual Studio 9.0\VC\bin\ia64\vcvarsia64.bat ( native 64-bit tools, installs only on 64bit OS)
c:\Program Files\Microsoft Visual Studio 9.0\VC\bin\amd64\vcvarsamd64.bat ( native 64-bit tools, installs only on 64bit OS)
You can also change the vc build toolset for the VS IDE.
Start VS, go to Tools – Options - Projects and Solutions - VC++ Directories and modify directories for ‘Executable files’, ‘Include files’, ‘Library files’ and ‘Reference files’ to point to your toolset directories. You can use environment variables as macros there. For instance, if you have ‘MyToolSetRoot’ environment variable defined on your machine, for ‘Include files’ you can set:
Do this for all platforms you build for. Close the dialog. These will modify the options per user/per machine. If you want to switch between different VC directories on your machine or share them to another machine, in VS9 and VS8(sp1) you can use Tools - Import/Export settings (VS8 does not support this). The VC++ directories are not imported/exported by default (as they might contain only this machine specific directories), so you need to check All Settings – Options – Projects – VC++ Directories explicitly.
PingBack from http://geeklectures.info/2007/12/30/using-different-toolsets-for-vc-build/
Another way to switch the tools in the IDE is to run vcvars32.bat for the toolset you want and then launch devenv /useenv. This is handy for using the Platform SDK compiler toolchain and doesn't require permanent settings changes.
I have been using these techiques for quite a while (after much struggling to find a way).
GREAT to see an "offical" blog post that this is in fact the way to do it.
Isn't it much easier to use the property manager to apply changes to a project that are different from the standard?
In this case you have the settings inside the project and you don't need to worry how to launch the VS-IDE for a specific project?
Looks like Import not worked properly for VC++ Directories (VS8(sp1) Express).
1. I add test path to VC++ Directories\Executable files
2. Export options. File test.vssettings contains test path in node <PropertyValue name="ExecutableDirectories">
3. After Import, test directory not added in VC++ Directories.
Sorry I did not reply earlier, this year we had quite long holidays :)
Unfortunatelly you are right, it does not work in 2005 SP1. We made a hot fix and I thought it was before SP1, but I was wrong, it is not included there. Here is the link for the KB article for this problem:
To get the fix you need to call
(800) MICROSOFT (642-7676)
Microsoft Customer Support Services
and ask them for HotFix 934276. This is free of charge.
Sorry for confusion.
To Martin Richter:
Yes, if you are OK to modify your projects/property sheets you can define INCLUDE, LIB, LIBPATH and PATH env vars in a property sheet using Property Manager.
Thanks for adding this.
Can you provide more details as to how to set the PATH variable in propery sheets?
What I would like to do is insert a solution-specific tools directory into the path in a solution-wide vsprops file. What's happening is that it is replacing the PATH setting rather than augmenting it. Now sproxy.exe is found but cl.exe isn't! That's not really any better than before.
The Windows SDK Configuration Tool sets which version of Windows SDK headers, libraries and tools you