dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
19.12k stars 4.04k forks source link

al.exe doesn't handle our AssemblyInformationalVersionAttributes #23190

Open tmeschter opened 7 years ago

tmeschter commented 7 years ago

The AssemblyInformationalVersionAttribute takes a free form string as its value, and when compiling code using csc or vbc this value becomes the "Product version" reported in the "Details" tab of the Properties of the resulting file.

Roslyn includes the "NuGet" version plus the commit hash, like so:

2.4.0-beta1-62225-02. Commit hash: f0ca1234

However, this doesn't work when generating satellite assemblies using al.exe; it erroneously expects the string to be in 'major.minor.build.revision' format. This prevents us from generating satellite assemblies as part of the Roslyn build.

See this Connect item for a customer report of the issue.

See commit cc465bfb for our current workaround, which is to drop the AssemblyInformationalVersionAttribute entirely.

I see several potential fixes and workarounds that would be acceptable.

Fixes

  1. Update al.exe itself to properly support this.
  2. Update the build targets to call something other than al.exe to generate the satellite assemblies. Indeed, the Microsoft.NET.SDK build uses csc instead of alink.

Workarounds

  1. Turn off generation of AssemblyInformationalVersionAttribute for just the satellite assemblies (instead of all assemblies). It probably isn't as interesting for satellite assemblies as it is for regular assemblies.
  2. Override satellite assembly generation in dotnet/roslyn by copying in the Microsoft.NET.SDK approach.
tmat commented 7 years ago

There are many issues with ALink. I believe fix no. 2 is the right way to go: the msbuild targets should be updated.

tmeschter commented 7 years ago

As a first step in dealing with this and #23191 I'm going to make it possible for us to always opt-in to the Microsoft.Net.SDK approach.

tmeschter commented 7 years ago

Change to MSBuild to enable opt-in: https://github.com/Microsoft/msbuild/pull/2726