Path to installed NUnit console runner.

I'm trying to use the nunit console that is installed on our agents in an effort to use a code coverage tool. However, I am having trouble find the path to it. In the first step of the build, we run a powershell script that installs it to the agent with the path of: 

D:\BuildAgent\work\6b44e1df5c594b91\packages\NUnit.ConsoleRunner\tools\nunit3-console.exe.

I was / would have assumed that I could do something like D:\..\..\..\packages\NUnit.ConsoleRunner\tools etc, but I'm increasingly confused esp after reading this thread. Is there an easy way that I can get to the relative path of the console runner? Would I need to consider something like: %teamcity.build.checkoutDir%\packages\NUnit.ConsoleRunner\etc. etc.?

1
1 comment

Hi,

 

first of all, usually the best way to access preinstalled tools is to make sure that there is a parameter that allows you to access it directly. Many of them are autodetected by the agent's process and will have parameters already set up, you can check this by accessing the agent's page in the web UI and going over its parameters tab. If it's not autodetected, you can generate it on the agents or the build configurations on your own, using parameter references as well or not.

 

In particular for NUnit, TeamCity generates the %teamcity.tool.NUnit.Console.3.9.0% parameter (of course change 3.9.0 for your version) if you are installing it via TeamCity Tools. It won't be the path to the executable, but it will contain the path to the folder where it's available.

 

0

Please sign in to leave a comment.