4

I have a project setup in Subversion which has a few Subversion Externals defined. These Subversion Externals reference other projects.

Example Subversion layout:

  1. repo/Project1/trunk
  2. repo/Project2/trunk

Example Checkout layout:

  1. $WorkingDir\Project1\trunk
  2. $WorkingDir\Project1\trunk\Lib\Project2

TeamCity allows you to attach a AssemblyInfo Patcher build feature to your build configuration, but does not seem to allow excluding Externals. Since the Externals are separate projects I want to retain their assembly version or AssemblyInfo patch them with a different pattern.

At the moment, because my build configuration checks out Project1 with full Subversion Externals support and then applies the AssemblyInfo Patcher my Project1 assemblies and my Project2 assemblies all have the same assembly version - even though I want them to be different.

Is there a way to have Project1 assemblies versioned differently to the Project2 assemblies?

Llyle
  • 5,980
  • 6
  • 39
  • 56

3 Answers3

6

There currently is no way to provide directories to exclude.

According to the TeamCity docs, the AssemblyInfo Patcher only updates the AssemblyVersion and AssemblyFileVersion values in all found AssemblyInfo source files (e.g. AssemblyInfo.cs, AssemblyInfo.vb) before anything is built, it does not alter the version of existing compiled binaries.

The externals you mention, are they just binaries, or are you including everything of Project2 (e.g binaries, project files, source code etc)? You should just be including the binaries.

If the AssemblyInfo Patcher does not meet your requirements you will have to revert to doing it manually (such as using a seperate MSBuild script) and excluding the external directory when searching for the AssemblyInfo files to update.

Siy Williams
  • 2,396
  • 1
  • 17
  • 26
  • Since Project2 is added as an Externals property on Project1's trunk, the source code is included. Seems like the author(s) of the AssemblyInfo Patcher overlooked an important consideration: Versioning of the SVN External assemblies. In my opinion a must have for TeamCity.vnext! – Llyle Mar 07 '12 at 23:22
  • @vanslly Why do you need the source code? Surely Project1 is only referencing Project2's compiled binaries? – Siy Williams Mar 07 '12 at 23:36
  • @sijw No, Project1 is not referencing Project2's compiled binaries, that is not how SVN Externals work. I need the source code because Project1 has a project reference to Project2, so when Project1 compiles then Project2 is also compiled and with the target platform as dictated in the msbuild file. – Llyle Mar 08 '12 at 00:19
  • @vanslly That's one way of doing it I guess. Anyways, you will have to patch the AssemblyInfo manually like I suggested if you're doing it like that. – Siy Williams Mar 08 '12 at 01:26
2

Since TeamCity 9.1, there's a new File Content Replacer feature. This allows you to specify a pattern to match files upon which you wish to perform text replacement.

JetBrains recommends using this instead of the AssemblyInfo Patcher "For replacing a wider range of values in a larger number of files"

David Gardiner
  • 16,892
  • 20
  • 80
  • 117
0

I found a super simple solution is to just rename your AssemblyInfo.cs file to something like

AssemblyInfoDontChange.cs

Ajay2707
  • 5,690
  • 6
  • 40
  • 58