How to run Team City AssemblyInfo patcher after specific build step

981 views Asked by At

The usual process when building a project is that the AssemblyInfo patcher is run once all files have been dragged down from source control.

We have a problem with this when using CodeSmith. The problem is that we have two build steps.

Step 1 - Run CodeSmith Template Build

This generates a Visual Studio Solution

Step 2 - Build Visual Studio Project

This generates our build.

We want to run the AssemblyInfo patcher after Step 1 completes as there won't be an AssemblyInfo.cs file until the CodeSmith templates generate it.

Is there any way to do this?

We are using TeamCity 7.0.3 and Visual Studio 2010 (SP1) on Windows 7.

Thanks.

3

There are 3 answers

0
Blake Niemyjski On

Yes, you can accomplish this from one of the three methods below:

  1. Right clicking on your csp file inside of Visual Studio project (in vs). Then make sure Generate on Build is checked. Finally, you just need to install and activate Generator on your build server under the user that teamcity uses.

  2. Follow these steps to manually enable generate on build. Finally, you just need to install and activate Generator on your build server under the user that teamcity uses.

  3. Use MsBuildCommunityTasks, which was written by a fellow CodeSmith Employee. It will generate an AssemblyInfo file and much more.

Thanks -Blake Niemyjski

0
kkowal On

I had the same problem, I've found the solution here (using build dependencies) https://stackoverflow.com/a/30423872/4888142

0
Boris Modylevsky On

I would split your build configuration into two build configuration with artifacts and snapshot dependencies between them.

Build configuration 1:

  1. Run CodeSmith Template Build

  2. Publishes the solution file as artifacts

Build configuration 2:

  1. Resolves artifacts of Build Configuration
  2. Applies AssemblyInfo patcher