TeamCity Environment Variables

How do you access TeamCity environment variables through the post-build event window in visual studio?

What kind of evaluation can be done to make sure that the assembly takes place on the build server, and not locally, where environment variables do not exist?

thanks

+3
source share
1 answer

TeamCity variables are available because any environment variable is located in MSBuild, as a property that can be accessed using the $ () syntax.

TeamCity , . , teamcity.version TEAMCITY_VERSION MSBuild $(TEAMCITY_VERSION). ( ).

, , , :

<Target Condition=" '$(TEAMCITY_VERSION)' != '' " >
    <Message Text="Running on build server!..." />
</Target>

, TeamCity NUnit MSBuild, :

<!-- Override the MSBuild Community Tasks NUnit task if building in TeamCity -->
<UsingTask Condition=" '$(teamcity_dotnet_nunitlauncher_msbuild_task)' != '' "
    TaskName="NUnit" AssemblyFile="$(teamcity_dotnet_nunitlauncher_msbuild_task)" />
+6

Source: https://habr.com/ru/post/1721808/


All Articles