Benchmarkdotnet: AssemblyInformationalVersion doesn't work

Created on 4 Mar 2017  路  6Comments  路  Source: dotnet/BenchmarkDotNet

In the build\common.props file, we have the following lines:

<AssemblyVersion>$(Major).$(Minor).$(Revision).$(BuildNumber)</AssemblyVersion>
<AssemblyFileVersion>$(Major).$(Minor).$(Revision).$(BuildNumber)</AssemblyFileVersion>
<AssemblyInformationalVersion>$(Major).$(Minor).$(Revision).$(BuildNumber)$(PrereleaseLabel)</AssemblyInformationalVersion>

However, in the generated AssemblyInfo file (e.g. BenchmarkDotNet\src\BenchmarkDotNet\obj\Debug\net45\BenchmarkDotNet.AssemblyInfo.cs) we have the following lines:

[assembly: System.Reflection.AssemblyFileVersionAttribute("0.10.3.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("0.10.3.0")]

Thus, AssemblyVersion and AssemblyFileVersion attributes work fine, and AssemblyInformationalVersion doesn't.

bug

Most helpful comment

Ok, I solve it! In the C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.GenerateAssemblyInfo.targets file, I have the following lines:

<AssemblyAttribute Include="System.Reflection.AssemblyInformationalVersionAttribute" Condition="'$(InformationalVersion)' != '' and '$(GenerateAssemblyInformationalVersionAttribute)' == 'true'">
  <_Parameter1>$(InformationalVersion)</_Parameter1>
</AssemblyAttribute>

So, we have to use InformationalVersion instead of AssemblyInformationalVersion. Already check it, it works! We fix it in master soon!

All 6 comments

@AndreyAkinshin maybe we should report a bug to the msbuild team?

@adamsitnik, do you have a link to some kind of documentation for these new MSBuild properties? I didn't found anything related to the AssemblyInformationalVersion property. Are you sure that this property should work?

do you have a link to some kind of documentation for these new MSBuild properties? Are you sure that this property should work?

I don't and I am not sure. I took the idea from here

Hmm. Last commit in this file was made Sep 5, 2014. I guess it can be outdated. =)

Ok, I solve it! In the C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.GenerateAssemblyInfo.targets file, I have the following lines:

<AssemblyAttribute Include="System.Reflection.AssemblyInformationalVersionAttribute" Condition="'$(InformationalVersion)' != '' and '$(GenerateAssemblyInformationalVersionAttribute)' == 'true'">
  <_Parameter1>$(InformationalVersion)</_Parameter1>
</AssemblyAttribute>

So, we have to use InformationalVersion instead of AssemblyInformationalVersion. Already check it, it works! We fix it in master soon!

Was this page helpful?
0 / 5 - 0 ratings