Mix existing and AssemblyInfo patcher generated version info in TeamCity builds

This is a cross-post from Stack Overflow.

I've enabled a "Build Feature" called "AssemblyInfo patcher" to tweak  the version of DLLs generated by my TeamCity builds. I've remixed info  from this other question and came up with this

Assembly version format

Now the final thing I would like to achieve is have the Major (

) and Minor (
) come from the original files, instead of hard coding them into TeamCity.

How can I do that?

I've guessed / tried:

But this gives an error. I've tried:


But this generates the

as major/minor instead of build and revision number, so e.g.

I've read the AssemblyInfo patcher documentation but it doesn't explain much at all.

I've skimmed the available variables (with the icon to the right of the input field) but found no relevant variables.

How can I set up the "AssemblyInfo patcher" so that:
  • Major and Minor are kept as they are in the source files;
  • Revision is the VCS revision number;
  • Build is the TeamCity build number.

If it's possible at all?

Comment actions Permalink

Hi Jeroen,

Please find my answer on stackoverflow.

Comment actions Permalink

Thx for the suggestion. I was aware of that  Build Feature, but consider it to be a hack / workaround in this case,  since the "AssemblyInfo patcher" seems like the appropriate thing to use.

I was hoping / looking for a way to get the Patcher feature to work in the way I want it to. If I can't I may resort to  your suggestion, or pehaps just live with the hard coded major/minor.

Comment actions Permalink

Actually File Content Replacer is a new feature that includes and extends the capabilities provided by AssemblyInfo Patcher. We do not remove AssemblyInfo Patcher because of backward compatibility.
So it's recommended to use File Content Replacer.


Please sign in to leave a comment.