question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Satellite assemblies omit assembly version attributes, only under `dotnet build`

See original GitHub issue

Repro steps

git clone https://github.com/microsoft/vs-validation
cd vs-validation\src\Microsoft.VisualStudio.Validation
dotnet restore
dotnet build -f net45

Expected

The built satellite assemblies have an assembly version that matches the one in the primary output assembly.

Actual

The built satellite assemblies lack any version attributes, leaving the assemblies claiming a version of 0.0.0.0.

The detailed build log from dotnet build includes this relevant portion:

     1>Target "CoreGenerateSatelliteAssemblies" in file "C:\Program Files\dotnet\sdk\2.0.0-preview1-005842\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets" from project "C:\git\validation\src\Microsoft.VisualStudio.Validation\Microsoft.VisualStudio.Validation.csproj" (target "CreateSatelliteAssemblies" depends on it):
       Building target "CoreGenerateSatelliteAssemblies" completely.
       Output file "C:\git\validation\src\..\obj\Microsoft.VisualStudio.Validation\Debug\net45\cs\Microsoft.VisualStudio.Validation.resources.dll" does not exist.
       Task "MakeDir"
       Done executing task "MakeDir".
       Task "WriteCodeFragment"
         Emitted specified code into "C:\git\validation\src\..\obj\Microsoft.VisualStudio.Validation\Debug\net45\cs\Microsoft.VisualStudio.Validation.resources.cs".
       Done executing task "WriteCodeFragment".
       Task "Csc"
         C:\Program Files\dotnet\sdk\2.0.0-preview1-005842\Roslyn\RunCsc.cmd /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Drawing.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.IO.Compression.FileSystem.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Numerics.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Runtime.Serialization.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xml.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xml.Linq.dll" /keyfile:C:\Users\andarno\.nuget\packages\microbuild.visualstudio\2.0.40\build\FinalPublicKey.snk /out:C:\git\validation\src\..\obj\Microsoft.VisualStudio.Validation\Debug\net45\cs\Microsoft.VisualStudio.Validation.resources.dll /resource:C:\git\validation\src\..\obj\Microsoft.VisualStudio.Validation\Debug\net45\Microsoft.Strings.cs.resources /target:library /deterministic+ /publicsign+ C:\git\validation\src\..\obj\Microsoft.VisualStudio.Validation\Debug\net45\cs\Microsoft.VisualStudio.Validation.resources.cs
         Microsoft (R) Visual C# Compiler version 2.0.0.61325
         Copyright (C) Microsoft Corporation. All rights reserved.
         
       Done executing task "Csc".

When using msbuild.exe instead of dotnet build, I get the expected behavior:

msbuild /t:rebuild /p:targetframework=net45 

This produces properly versioned satellite assemblies. We see in the detailed build logs this time that instead of using csc.exe to generate them, the targets use AL.exe, which uses the version from the primary assembly explicitly as a template:

     1>Target "GenerateSatelliteAssemblies" in file "C:\Program Files (x86)\Microsoft Visual Studio\2017\vsuvscore\MSBuild\15.0\bin\Microsoft.Common.CurrentVersion.targets" from project "C:\git\validation\src\Microsoft.VisualStudio.Validation\Microsoft.VisualStudio.Validation.csproj" (target "CreateSatelliteAssemblies" depends on it):
       Building target "GenerateSatelliteAssemblies" completely.
       Output file "C:\git\validation\src\..\obj\Microsoft.VisualStudio.Validation\Debug\net45\cs\Microsoft.VisualStudio.Validation.resources.dll" does not exist.
       Task "MakeDir"
       Done executing task "MakeDir".
       Using "AL" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
       Task "AL"
         C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\al.exe /culture:cs /delaysign+ /keyfile:C:\Users\andarno\.nuget\packages\microbuild.visualstudio\2.0.40\build\FinalPublicKey.snk /out:C:\git\validation\src\..\obj\Microsoft.VisualStudio.Validation\Debug\net45\cs\Microsoft.VisualStudio.Validation.resources.dll /template:C:\git\validation\src\..\obj\Microsoft.VisualStudio.Validation\Debug\net45\Microsoft.VisualStudio.Validation.dll /embed:C:\git\validation\src\..\obj\Microsoft.VisualStudio.Validation\Debug\net45\Microsoft.Strings.cs.resources
         Microsoft (R) Assembly Linker version 14.0.1055.0
         Copyright (C) Microsoft Corporation. All rights reserved.
         
       Done executing task "AL".

This was originally reported https://github.com/AArnott/Nerdbank.GitVersioning/issues/131, discovered by @onovotny.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
nguerreracommented, Jun 7, 2017

Ok, let’s first fix this in sdk, then push to have our targets moved to msbuild in vnext.

1reaction
dasMullicommented, Jun 2, 2017

@livarcocc The key point is that CoreGenerateSatelliteAssemblies relies on @(AssemblyAttribute) but doesn’t work for projects with disabled assembly info generation (or just disabled version attributes) that use a custom AssemblyInfo.cs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create satellite assemblies - .NET
Get started with creating satellite assemblies for .NET apps. A satellite assembly can be easily updated or replaced to provide localized ...
Read more >
Set assembly attributes
Three attributes, together with a strong name (if applicable), determine the identity of an assembly: name, version, and culture.
Read more >
MSBuild reference for .NET SDK projects
The GenerateSatelliteAssembliesForCore property controls whether satellite assemblies are generated using csc.exe or Al.exe (Assembly Linker) in ...
Read more >
Download satellite assembly on demand (ClickOnce API)
This walkthrough demonstrates how to mark your satellite assemblies as optional, and download only the assembly a client machine needs for its ...
Read more >
Package and deploy resources in .NET Apps
NET apps using a main assembly (hub) and satellite assemblies (spokes). A spoke contains localized resources but no code.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found