Skip to content

crossgen2 packages missing native components #37196

@swaroop-sridhar

Description

@swaroop-sridhar

Description

Running crossgen2.exe using recent SDK (ex: 5.0.100-preview.6.20280.6) is not working.
This is because the platform-specific crossgen2 packages are missing native binaries.

For example:
Microsoft.NETCore.App.Runtime.win-x64 (ver 5.0.0-preview.6.20277.12) doesn't have clrcompression.dll
Microsoft.NETCore.App.Runtime.linux-x64 (ver 5.0.0-preview.6.20264.1) doesn't have libSystem.Globalization.Native.a

Consequently, running crossgen2.exe from this package fails because of a missing dependency.

Repro

Publish a hello-world app using master-branch SDK (5.0.100-preview.6.20280.6) with PublishReadyToRun=true and PublishReadyToRunUseCrossgen2=true.

D:\test\hello>dotnet publish -r win-x64 /p:PublishReadyToRun=true /p:PublishReadyToRunUseCrossgen2=true
Microsoft (R) Build Engine version 16.7.0-preview-20270-03+bee129d1b for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  Restored D:\test\hello\hello.csproj (in 95 ms).
  You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
  hello -> D:\test\hello\bin\Debug\net5.0\win-x64\hello.dll
C:\Program Files\dotnet\sdk\5.0.100-preview.6.20278.14\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(376,5): error : Error: [D:\test\hello\hello.csproj]
C:\Program Files\dotnet\sdk\5.0.100-preview.6.20278.14\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(376,5): error :   An assembly specified in the application dependencies manifest (crossgen2.deps.json) was not found: [D:\test\hello\hello.csproj]
C:\Program Files\dotnet\sdk\5.0.100-preview.6.20278.14\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(376,5): error :     package: 'runtimepack.Microsoft.NETCore.App.Runtime.win-x64', version: '5.0.0-preview.5.20230.9' [D:\test\hello\hello.csproj]
C:\Program Files\dotnet\sdk\5.0.100-preview.6.20278.14\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(376,5): error :     path: 'clrcompression.dll' [D:\test\hello\hello.csproj]
C:\Program Files\dotnet\sdk\5.0.100-preview.6.20278.14\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(286,5): error NETSDK1096: Optimizing assemblies for performance failed. You can either exclude the failing assemblies from being optimized, or set the PublishReadyToRun property to false. [D:\test\hello\hello.csproj]
~/test/hello$ ../dotnet-5.preview6/dotnet publish -r linux-x64  /p:PublishReadyToRun=true /p:PublishReadyToRunUseCrossgen2=true
Microsoft (R) Build Engine version 16.7.0-preview-20270-03+bee129d1b for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  Restored /home/swaroops/test/hello/hello.csproj (in 11.88 sec).
  You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
  hello -> /home/swaroops/test/hello/bin/Debug/net5.0/linux-x64/hello.dll
/home/swaroops/test/dotnet-5.preview6/sdk/5.0.100-preview.6.20280.6/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(376,5): error : Error: [/home/swaroops/test/hello/hello.csproj]
/home/swaroops/test/dotnet-5.preview6/sdk/5.0.100-preview.6.20280.6/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(376,5): error :   An assembly specified in the application dependencies manifest (crossgen2.deps.json) was not found: [/home/swaroops/test/hello/hello.csproj]
/home/swaroops/test/dotnet-5.preview6/sdk/5.0.100-preview.6.20280.6/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(376,5): error :     package: 'runtimepack.Microsoft.NETCore.App.Runtime.linux-x64', version: '5.0.0-preview.6.20264.1' [/home/swaroops/test/hello/hello.csproj]
/home/swaroops/test/dotnet-5.preview6/sdk/5.0.100-preview.6.20280.6/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(376,5): error :     path: 'libSystem.Globalization.Native.a' [/home/swaroops/test/hello/hello.csproj]
/home/swaroops/test/dotnet-5.preview6/sdk/5.0.100-preview.6.20280.6/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(286,5): error NETSDK1096: Optimizing assemblies for performance failed. You can either exclude the failing assemblies from being optimized, or set the PublishReadyToRun property to false. [/home/swaroops/test/hello/hello.csproj]

Regression?

The problem seems to have started in the last few days, after SDK 5.0.100-preview.6.20266.3.

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions