Does TeamCity expose Environment variables (that can be used in a msbuild file)?

Hello there,

when Teamcity starts a build, does it expose normal envionment variables that I could use in the msbuild file I am building? E.g. something like this:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <DevEnv>C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe</DevEnv>
    <SolutionFileName>$(system.teamcity.build.checkoutDir)\T5.sln</SolutionFileName>
  </PropertyGroup>

  <Target Name="Release">
    <Exec Command='$(DevEnv) /Rebuild release $(SolutionFileName)' />
  </Target>

  <Target Name="Debug">
    <Exec Command='$(DevEnv) /Rebuild debug $(SolutionFileName)' />
  </Target>
</Project>




... That doesn't work though as $(system.teamcity.build.checkoutDir) returns nothing, but is there a proper way to access these variables?

-J
2 comments
Comment actions Permalink

... err a little more digging would have helped... it works with this msbuild file:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <DevEnv>"C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe"</DevEnv>
    <SolutionFileName>$(teamcity_build_checkoutDir)\T5.sln</SolutionFileName>
  </PropertyGroup>

  <Target Name="Release">
    <Exec Command='$(DevEnv) /Rebuild release $(SolutionFileName)' />
  </Target>

  <Target Name="Debug">
    <Exec Command='$(DevEnv) /Rebuild debug $(SolutionFileName)' />
  </Target>
</Project>



-J
0
Comment actions Permalink

system. and env. prefixes are used in TeamCity only, when you want to reference property or environment variable in the web UI. In the build script they should be omitted. And there is MSBuild specific conversion of property names - dots should be replaced with underscore.

0

Please sign in to leave a comment.