Search code examples
.netteamcityteamcity-7.1

Teamcity. Run powershell script after the build to install windows service


I have two build configurations:

  • Build solution and run tests
  • Deploy ASP.NET site using msbuild

That article http://www.troyhunt.com/2010/11/you-deploying-it-wrong-teamcity.html was used as manual.

Currently I want to add the third build configuration to install a windows service. There is a powershell script that should be run from bin folder (release, debug etc).

So the question is how access the build folder (something like C:\TeamCity\buildAgent\work\94fc00f485df5f29\Solution\Service\bin\%environment%) to run that script? As I understand the guid from url is not static and I couldn't hardcode it in teamcity.


Solution

  • When you set the path to your build script, just set it so its like:

    Solution\Service\bin\%environment%
    

    Which will do it relatively to the build directory for your build agent.

    Otherwise I think its:

    %teamcity.build.checkoutDir%\Solution\Service\bin\%environment%
    

    Which TeamCity will fill in %teamcity.build.checkoutDir% with like C:\TeamCity\buildAgent\work\94fc00f485df5f29