After creating a simple build script (Attached) which essentially does the following
1) Create a Property Set containing .NET Assembly VersionInfo (reading the version from a SolutionInfo.cs file which contains just the current assembly: AssemblyVersion("1.0.0.0")] to allow for reading it easily by FinalBuilder. SolutionInfo.cs is only used to ensure that all projects in the solution will get the same version number..
2) Assign it in the ".NET Version" tab in the "Build VS.Net Solution" action
According to a snip of the log in Team Foundation Server I can observe that the minor version of the property set is correctly incremented to 1, and it also looks like the "Build VS.NET Solution" action has detected that product version should be updated.
[Load [VersionNumber] into [SolutionVersionInfo Property Set]]
Scanning AssemblyInfo file C:\Build\DAS_Sandkasse\7\TFS2012 Finalbuilder Tests\FinalBuilderTests\Sources\SolutionInfo.cs
Processing AssemblyInfo File : C:\Build\DAS_Sandkasse\7\TFS2012 Finalbuilder Tests\FinalBuilderTests\Sources\SolutionInfo.cs
Assigning values to PropertySet SolutionVersionInfo
Setting MajorVersion to "1"
Setting MinorVersion to "0"
Setting BuildVersion to "0"
Setting RevisionVersion to "0"
[PropertySet [ SolutionVersionInfo ] increment [ MinorVersion ]]
Property MinorVersion is now 1
[TFS build]
[Build VS.Net Solution [ C:\TfsBuildDoWork\DAS_Sandkasse\7\TFS2012 Finalbuilder Tests\FinalBuilderTests\Sources\FinalBuilderTests.sln ]]
ActionComment =
AllowUnsafe = False
AllWarningsAsErrors = False
AutoUpdateFileVersion = True
AutoUpdateProductVersion = True
But when I examine the output in the dropfolder (which is just a simple WPF test app), the assembly version is still 1.0.0.0, which is the value in the assemblyinfo that was checked in.
To ensure that it was not my handling of the property set, I set the minor version, so it should always be 1, directly in the ":NET Version" tab, but the compile executable still has the assembly
version 1.0.0.0.
*) Do you have any idea what I might be doing wrong here?
*) Is the stuff specified in ".NET Version" supposed to be written to disk as well or how should it be communicated to the actual MSBuild invocation.
--------------------------------------------------------------------------
Furthermore,
*) Do you have any procedure/best practice for maintaining the current version number in SourceControl.
The requirement is to have 2 TFS Build definitions
- Increment Major Version and prepare solution for deployment
- Increment Minor Version and prepare solution for deployment
These builds will be triggered manually.
My initial idea was to add the following actions
- Check out SolutionInfo
- According to custom argument passed from TFS build definition to FinalBuilder decide whether Major or Minor Version should be updated
- Create propertyset and update the
- Write SolutionInfo to disc again and check it into Source Control
- Trigger the build
Is this a feasible approach or is there another approach which would make more sense to use?