3

My build script depends on the MSBuild Community Task targets. I'd like to make this an agent requirement. How can this be done in TeamCity 8.x?

Jeremy Smith
  • 1,019
  • 7
  • 15

1 Answers1

1

What you can do is add an Agent Requirement (Step 8 of your build Configuration)

enter image description here

Now immediately after doing this your build agent will be incompatible - that is because there is no such environment variable as MSBuildCommunityTasksPath - I've made this up because Community Tasks does not install any.

The next thing you need to do is log into the build agent PCs that do have Community Tasks installed and add this environment variable:

enter image description here

the path should be either

C:\Program Files (x86)\MSBuild\MSBuildCommunityTasks or

C:\Program Files\MSBuild\MSBuildCommunityTasks

nb techincally it doesnt matter what you enter as this variable is just a flag indicating community tasks is installed

after you do this you need to restart your build agent

Now this paramter will be available in TeamCity and your build agent should be compatible. You can go to the Agents tab to check this. Agents -> <your agent> -> Agent parameters -> Environment Variables

enter image description here

wal
  • 16,300
  • 7
  • 69
  • 104
  • Are there any alternatives to using environment variables? E.g. like a required file path `%PROGRAMFILES(X86)%\MSBuild\MSBuildCommunityTasks` parameter? I just hate having external configuration dependencies. – Jeremy Smith Oct 13 '13 at 11:29
  • Yea I had a good look for that; I couldnt find any, this is the best I could come up with – wal Oct 13 '13 at 12:14
  • Wouldnt it be better to reference the nuget package rather and known version than what might be installed on a target machine? – James Woolfenden Oct 15 '13 at 11:30
  • @JamesWoolfenden please elaborate. i install build tasks as a standalone – wal Oct 16 '13 at 00:41