Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PublishAot with a specific Runtime version is broken #89040

Closed
eerhardt opened this issue Jul 17, 2023 · 5 comments
Closed

PublishAot with a specific Runtime version is broken #89040

eerhardt opened this issue Jul 17, 2023 · 5 comments
Assignees
Labels
area-NativeAOT-coreclr partner-impact This issue impacts a partner who needs to be kept updated

Comments

@eerhardt
Copy link
Member

Description

In https://github.com/aspnet/Benchmarks we publish NativeAot apps with the latest version of the .NET runtime and the latest .NET SDK (even if the runtime repo hasn't flown into the SDK yet).

To accomplish this, we inject 2 items into the app's .csproj: <FrameworkReference Update="Microsoft.NETCore.App" and <PackageReference Include="Microsoft.Dotnet.ILCompiler". See #81382 and #84372 for more info.

Starting last week Thursday, this approach has been failing in our benchmark pipelines. See the latest run here.

C:\.nuget\packages\microsoft.dotnet.ilcompiler\8.0.0-preview.7.23364.11\build\Microsoft.NETCore.Native.Publish.targets(75,5): error : The PrivateSdkAssemblies ItemGroup is required for _ComputeAssembliesToCompileToNative [C:\Users\Administrator\AppData\Local\Temp\benchmarks-agent\benchmarks-server-6080\aaegmtxa.el0\benchmarks\src\BenchmarksApps\BasicMinimalApi\BasicMinimalApi.csproj]

Reproduction Steps

  1. Using the latest .NET SDK from https://github.com/dotnet/installer#table
  2. dotnet new console --aot
  3. add the following to the .csproj
<ItemGroup>
  <FrameworkReference Update="Microsoft.NETCore.App"
                      RuntimeFrameworkVersion="8.0.0-preview.7.23364.11" />
  <PackageReference Include="Microsoft.Dotnet.ILCompiler"
                    Version="8.0.0-preview.7.23364.11" />
</ItemGroup>
  1. dotnet publish

Expected behavior

The app should publish successfully with the runtime version specified above.

Actual behavior

The publish fails with

❯ dotnet publish
MSBuild version 17.8.0-preview-23363-02+4598629a2 for .NET
  Determining projects to restore...
  Restored C:\DotNetTest\Net8Api\Net8Api.csproj (in 231 ms).
C:\dotnet\sdk\8.0.100-preview.7.23364.32\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(314,5): message NETSDK1057:
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy [C:\DotNetTest\Net8Api\Net8Api.csproj]
  Net8Api -> C:\DotNetTest\Net8Api\bin\Release\net8.0\win-x64\Net8Api.dll
C:\Users\eerhardt\.nuget\packages\microsoft.dotnet.ilcompiler\8.0.0-preview.7.23364.11\build\Microsoft.DotNet.ILCompiler.SingleEntry.targets(46,5): warning : Delete explicit 'Microsoft.DotNet.ILCompiler' package reference in your project file to avoid versioning problems. [C:\DotNetTest\Net8Api\Ne
t8Api.csproj]
C:\Users\eerhardt\.nuget\packages\microsoft.dotnet.ilcompiler\8.0.0-preview.7.23364.11\build\Microsoft.NETCore.Native.Publish.targets(75,5): error :
The PrivateSdkAssemblies ItemGroup is required for _ComputeAssembliesToCompileToNative [C:\DotNetTest\Net8Api\Net8Api.csproj]

Regression?

Yes, this worked last week.

Known Workarounds

No response

Configuration

No response

Other information

When debugging this in msbuild, it appears that the runtime.win-x64.microsoft.dotnet.ilcompiler nuget package is not getting downloaded. Later in msbuild it expects it to be there, and since it isn't we get an unintelligible error.

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Jul 17, 2023
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jul 17, 2023
@eerhardt eerhardt added area-NativeAOT-coreclr and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Jul 17, 2023
@ghost
Copy link

ghost commented Jul 17, 2023

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

In https://github.com/aspnet/Benchmarks we publish NativeAot apps with the latest version of the .NET runtime and the latest .NET SDK (even if the runtime repo hasn't flown into the SDK yet).

To accomplish this, we inject 2 items into the app's .csproj: <FrameworkReference Update="Microsoft.NETCore.App" and <PackageReference Include="Microsoft.Dotnet.ILCompiler". See #81382 and #84372 for more info.

Starting last week Thursday, this approach has been failing in our benchmark pipelines. See the latest run here.

C:\.nuget\packages\microsoft.dotnet.ilcompiler\8.0.0-preview.7.23364.11\build\Microsoft.NETCore.Native.Publish.targets(75,5): error : The PrivateSdkAssemblies ItemGroup is required for _ComputeAssembliesToCompileToNative [C:\Users\Administrator\AppData\Local\Temp\benchmarks-agent\benchmarks-server-6080\aaegmtxa.el0\benchmarks\src\BenchmarksApps\BasicMinimalApi\BasicMinimalApi.csproj]

Reproduction Steps

  1. Using the latest .NET SDK from https://github.com/dotnet/installer#table
  2. dotnet new console --aot
  3. add the following to the .csproj
<ItemGroup>
  <FrameworkReference Update="Microsoft.NETCore.App"
                      RuntimeFrameworkVersion="8.0.0-preview.7.23364.11" />
  <PackageReference Include="Microsoft.Dotnet.ILCompiler"
                    Version="8.0.0-preview.7.23364.11" />
</ItemGroup>
  1. dotnet publish

Expected behavior

The app should publish successfully with the runtime version specified above.

Actual behavior

The publish fails with

❯ dotnet publish
MSBuild version 17.8.0-preview-23363-02+4598629a2 for .NET
  Determining projects to restore...
  Restored C:\DotNetTest\Net8Api\Net8Api.csproj (in 231 ms).
C:\dotnet\sdk\8.0.100-preview.7.23364.32\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(314,5): message NETSDK1057:
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy [C:\DotNetTest\Net8Api\Net8Api.csproj]
  Net8Api -> C:\DotNetTest\Net8Api\bin\Release\net8.0\win-x64\Net8Api.dll
C:\Users\eerhardt\.nuget\packages\microsoft.dotnet.ilcompiler\8.0.0-preview.7.23364.11\build\Microsoft.DotNet.ILCompiler.SingleEntry.targets(46,5): warning : Delete explicit 'Microsoft.DotNet.ILCompiler' package reference in your project file to avoid versioning problems. [C:\DotNetTest\Net8Api\Ne
t8Api.csproj]
C:\Users\eerhardt\.nuget\packages\microsoft.dotnet.ilcompiler\8.0.0-preview.7.23364.11\build\Microsoft.NETCore.Native.Publish.targets(75,5): error :
The PrivateSdkAssemblies ItemGroup is required for _ComputeAssembliesToCompileToNative [C:\DotNetTest\Net8Api\Net8Api.csproj]

Regression?

Yes, this worked last week.

Known Workarounds

No response

Configuration

No response

Other information

When debugging this in msbuild, it appears that the runtime.win-x64.microsoft.dotnet.ilcompiler nuget package is not getting downloaded. Later in msbuild it expects it to be there, and since it isn't we get an unintelligible error.

Author: eerhardt
Assignees: -
Labels:

untriaged, area-NativeAOT-coreclr

Milestone: -

@eerhardt eerhardt added the partner-impact This issue impacts a partner who needs to be kept updated label Jul 17, 2023
@am11
Copy link
Member

am11 commented Jul 17, 2023

Known Workarounds

-  <PackageReference Include="Microsoft.Dotnet.ILCompiler"
+  <PackageReference Include="Microsoft.Dotnet.ILCompiler; runtime.$(RuntimeIdentifier).Microsoft.DotNet.ILCompiler"
                    Version="8.0.0-preview.7.23364.11" />

@sbomer
Copy link
Member

sbomer commented Jul 18, 2023

This looks like a regression introduced by nuget somewhere in the range NuGet/NuGet.Client@13f2b6a...ba16cb0. SDK picked this up in dotnet/sdk#33913. I suggest we try reverting the update: dotnet/sdk#34069

@sbomer
Copy link
Member

sbomer commented Jul 19, 2023

The root cause was a nuget regression around case sensitivity - which was being hit due to the incorrect casing of the package. You can fix it by replacing Microsoft.Dotnet.ILCompiler with Microsoft.DotNet.ILCompiler.

@eerhardt
Copy link
Member Author

eerhardt commented Jul 20, 2023

Closing as the underlying issue is in NuGet. - NuGet/Home#12757

Thanks @sbomer for the great investigation here!

@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Jul 20, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Aug 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-NativeAOT-coreclr partner-impact This issue impacts a partner who needs to be kept updated
Projects
None yet
Development

No branches or pull requests

3 participants