2

The Version is 1.0.0.0 even though both the file version and product version are defined in the DLL and display correctly when I view its properties in Windows 7. Any suggestions?

  <Target Name="TestingAssemblyIdentity">
    <GetAssemblyIdentity AssemblyFiles="MyCSharp.dll">
      <Output TaskParameter="Assemblies" ItemName="assemblyInfo"/>
    </GetAssemblyIdentity>
    <Message Text="GetAssemblyIdentity Version is %(assemblyInfo.Version)" />
  </Target>
user1967469
  • 21
  • 1
  • 3

1 Answers1

4

The GetAssemlyIdentity task returns the assembly version (AssemblyVersionAttribute), not the file or product version. The later are not part of the assembly's identity.

Note that assembly version and assembly file/product version serve different purposes.

See here for a possible way to read the file version from within msbuild.

Community
  • 1
  • 1
Christian.K
  • 47,778
  • 10
  • 99
  • 143
  • Thanks. I will set AssemblyVersionAttribute as well as AssemblyFileVersionAttribute in MyCSharp project. – user1967469 Jan 10 '13 at 18:33
  • I am using the AssemblyVersion in my Project's AssemblyInfo.cs but the version is always 0.0.0.0 ! However I am not checking the AssemblyInfo of a Dll but the AssemblyInfo of the .exe file generated by my Project. Could that be the problem? – AgentKnopf May 30 '13 at 12:40