开发者

How can I override a (.vsprops) property (UserMacro) with an environment variable?

So, I want to do this (Visual Studio 2005 and/or 2010, with Microsoft and Intel compilers)

1 - New dev checks out code

开发者_如何学Python2 - dev builds on desktop in unknown location with "default" values

No need for environment settings, no need for configuration, the as-submitted code "just works".

3 - build machine overrides "default" values with build-specific parameters

I thought I had this working with .vsprops. Define things like

<UserMacro Name="SHARED_LIBS_HOME" Value="....\shared" />

On the build server, where it's not in ....\shared, I use an environment variable SHARED_LIBS_HOME set to (say) "G:\Shared" and it will use G:\Shared instead of "....\shared" when running.

But this doesn't work: it looks like (with Visual Studio 2005 at least) if you have a property defined as an environment variable AND as a UserMacro in an included .vsprops, the UserMacro takes priority.

I can see a multitude of websites where one can set a .vsprops to override a .vcproj setting, or set a .vsprops to export values to the environment, but I want to set a .vsprops to set a property only if the environment is not already set.

In MSBUILD this is easy: Microsoft even has it listed as a "best practice" at http://msdn.microsoft.com/en-us/library/ee240983.aspx

Any suggestions?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜