Override Team City Environment variable setting
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.
精彩评论