开发者

TeamCity AssemblyInfo patcher Patches file, but DLL version isn't "right"

开发者 https://www.devze.com 2023-04-06 07:21 出处:网络
Here\'s what my assemblyinfo.cs version strings look like pre build: [assembly: AssemblyVersion(\"2.0.0920.10\")]

Here's what my assemblyinfo.cs version strings look like pre build:

[assembly: AssemblyVersion("2.0.0920.10")]
[assembly: AssemblyFileVersion("2.0.0920.10")]

During the build, the patcher does what I want, modifies the files:

[assembly: AssemblyVersion("2.0.0.1146")]
[assembly: AssemblyFileVersion("2.0.0.1146")]

But at some point during the build it also does this:

[assembly: AssemblyVersion("2.0.0921.00")]
[assembly: AssemblyFileVersion("2.0.0921.00")]

Then when the build is finished, it looks like this again:

[assembly: AssemblyVersion("2.0.0920.10")]
[assembly: AssemblyFileVersion("2.0.0920.10")]

When I right click on the resulting DLL in Windows Explorer, hit Properties then go to the Details tab, File Version is "2.0.921.0" and Product version is "2.0.921.00".

I also get "2.0.921.0" with Assembly.GetExecutingAssembly().GetName().Version.ToString()

My Build has 2 Build steps, one that is a VS Solution Build and another that is a command line step that just copies the DLLs to the dev server.

I don't want to paste the whole build log because it's large, but here are what I think are the highlights:

[14:24:54]: Step 1/2: Visual Studio 2010 Build (Visual Studio (sln)) (27s)
[14:24:54]: [Step 1/2] Update assembly versions: scanning checkout directory for AssemlyInfo files to update version
[14:24:54]: [Update assembly versions] ... for all of our assemblies

[14:24:55]: [Step 1/2] Starting: C:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.MsBuildBootstrap.exe /workdir:C:\TeamCity\buildAgent\work\677e8e784c19cc26 /msbuildPath:C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
[14:24:55]: [Step 1/2] in directory: C:\TeamCity\buildAgent\work\677e8e784c19cc26
[14:25:01]: [Step 1/2] main\solution.sln: Build target: Rebuild (20s)
[14:25:01]: [main\solution.sln] ValidateSolutionConfiguration
[14:25:01]: [ValidateSolutionConfiguration] Building solution configuration "Release|Mixed Platforms".
[14:25:02]: [Step 1/2] main\SolutionDir\solution.csproj: Build target: Rebuild (7s)

...

[14:25:21]: [Step 1/2] Process exited with code 0
[14:25:21]: Step 2/2: Copy Dlls and Templates to Sohodev (Command Line) (3s)
[14:25:21]: [Step 2/2] "BuildAndCopyDllsAndTemplatesv2.cmd" is not present in directory C:\TeamCity\buildAgent\work\677e8e784c19cc26
[14:25:21]: [Step 2/2] Starting: C:\Windows\system32\cmd.exe /c BuildAndCopyDllsAndTemplatesv2.cmd
[14:25:21]: [Step 2/2] in directory: C:\Scripts\Build
[14:25:21]: [Step 2/2]         1 file(s) copied.
[14:25:21]: [Step 2/2]         1 file(s) copied.
[14:25:24]: [Step 2/2] Process exited with code 0
[14:25:24]: Reverting patched assembly versions
[14:25:24]: [Reverting patched assembly versions] Restoring ... for all of our assemblies
[14:25:24]: Publishing internal artifacts (2s)
[1开发者_JS百科4:25:27]: [Publishing internal artifacts] Sending build.finish.properties file
[14:25:27]: Build finished

Edit Our TeamCity version number: 6.5.1 (build 17834)

Edit I just upgraded to 6.5.4 (build 18046). No change in behavior.


As expected, everything is working as configured.

We had a VersionNumber.targets file that was fiddling with the assemblyinfo.cs files

<Import Project="$(MSBuildExtensionsPath)\Microsoft\AssemblyInfoTask\Microsoft.VersionNumber.targets"/>

Commenting this out made everything work as desired.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号