I have a large project made of many C++ and C# projects, and a MSBuild (3.5) script to build the whole thing. This script is based on the VCBuild (C++ projects) and MSBuild (C# projects) tasks. It is regularly executed by a Continuous Integration server.
I want to be able to select a specific Windows SDK (v6.0A, v7.0, v7.1...) to be used for compilation. As I have many branches in my repository that would ultimately need a different SDK version, I need a way to select the right one before each compilation.
On my computer, I have been able to setup a batch script that calls the right SetEnv.cmd
before launching the MSBuild script. But this solution is not usable on the CI server as the MSBuild script is executed directly.
Do you know of a way to achieve the equivalent of SetEnv.cmd
under MSBuild?
You could create a custom MSBuild task that uses Environment.SetEnvironmentVariable to set the appropriate environment variable values depending on the specified platform SDK version. Check the vcvars32.bat (or vcvars64.bat depending on your target configuration) to see what environment variables need to be set.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With