开发者

Override Team City Environment variable setting

开发者 https://www.devze.com 2023-02-14 17:39 出处:网络
We have a Team City Unit test build which we call using $(teamcity_do开发者_StackOverflowtnet_nunitlauncher) through different MSBuild scripts. The build has an environment variable set up. Is there a

We have a Team City Unit test build which we call using $(teamcity_do开发者_StackOverflowtnet_nunitlauncher) through different MSBuild scripts. The build has an environment variable set up. Is there a way we can override the variable through the scripts?


Environment variables are "published" as MSBuild properties, so for example:

$(COMPUTERNAME)

...will give the value of that env var. You can override any property inside an MSBuild script...

<PropertyGroup>
    <COMPUTERNAME>NewName</COMPUTERNAME>
</PropertyGroup>

...or pass it in on the command line to MSBuild...

> msbuild My.proj /t:Target /p:COMPUTERNAME=NewName

These two ways to alter the "property" presented by an environment variable are not equal though, when passing a property via the command line, the value will not be overridden if it is declared in an MSBuild file.

0

精彩评论

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