7

I once had TeamCity + WiX + MSBuild Community Tasks working. Now that I've upgraded to WiX 3.5, I can't remember how I had configured it. :) As I was poking through TeamCity, I came across the "AssemblyInfo Patcher". I thought, "Great! This will make my life much easier!". I used %build.vcs.number.1% for the format and built my installer.

While the patcher did pull in the vcs number, it used it for the major number in the version. So instead of 1.0.0.xxxx, it made the version xxxx.0.0.0.

I looked through JetBrain's documentation site and came up with nothing related to changing this to a more appropriate setting. I also looked for regex support, but didn't find anything.

Can anyone suggest a good solution, or should I just go back to trying to configure my original set of tools?

Dave Schweisguth
  • 36,475
  • 10
  • 98
  • 121
Dave
  • 14,618
  • 13
  • 91
  • 145
  • 1
    Be careful about using your vcs number in versioning. Even though some things claim to ignore the 4th field, other things will break (like msp patching) if the number goes too high. I've seen problems happen somewhere around 32768. – Dave Andersen Jul 27 '11 at 19:28
  • @Dave thanks for the comment, I'll have to keep that in mind. – Dave Jul 29 '11 at 13:31

3 Answers3

11

The assembly info patcher only patches the complete version string at once. But the system variable build.number can be generated from the "general" page of the build configuration, like this: General settings

When you specify %build.number% as your AssemblyInfo version, it will pick up the combined number from your General settings page.Assermbly info patcher

Per-Frode Pedersen
  • 1,027
  • 1
  • 6
  • 15
  • Thanks, I'll give this a try. I already have a solution using WiX, but if this works I will definitely mark this as the answer! – Dave Aug 12 '11 at 15:51
  • I tried this one. Half my tests started to fail because of it. – sonstabo Aug 23 '11 at 14:02
2

Try including the full intended version number as part of your format:

1.0.0.%build.vcs.number.1%
Bilal
  • 922
  • 6
  • 7
  • I had considered that, but that solution will quickly break down when I change AssemblyInfo.cs to be 2.0.0.0, and want TeamCity to make the version number 2.0.0.yyyy. – Dave Jul 26 '11 at 20:54
  • Is there a reason you're not using the TeamCity build configuration's "Build number format" setting to dictate this? You likely want to be able to see that as the same version that shows up in the assemblies. My suggestion would be to set the "Build number format" as "1.0.0.%build.vcs.number.1%" (you would change this when your version number changes). The Assembly version format would then just be based off the build number (%system.build.number%). – Bilal Jul 26 '11 at 21:04
  • 2
    It's because IMO the build number should be associated with the source code that is actively being developed. If we need to bump a minor version number, then we should do that within the project, and not request that someone log into the TeamCity server and change the version there. – Dave Jul 26 '11 at 21:15
  • You can have the version number maintained in a file within source control - read this out and echo it using TeamCity's Service Message extensibility points: http://confluence.jetbrains.net/display/TCD65/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-ReportingBuildNumber – HowardvanRooijen Jul 26 '11 at 21:30
  • hi! I was not clear how to utilize this tip to have a file with the primary version, read it, and echo it with the "TC Service Message Extensibility", which with the right format, causes change in TC's value. This post helped; http://stackoverflow.com/a/8898060/242110 – AnneTheAgile Aug 13 '12 at 17:25
-3

Hmmm haven't seen AssemblyInfo Patcher but you can do it manually using MsBuild and Regex:

http://jonalb.com/post/2010/10/04/Automatic-Versioning-using-TeamCity-an-MSBuild.aspx

JonAlb
  • 1,702
  • 10
  • 14
  • Thanks, but my question is specifically trying to determine if it's possible to do what I want with only the AssemblyInfo Patcher. – Dave Jul 29 '11 at 13:32