Skip to content

PublishAot with a specific Runtime version is broken #89040

@eerhardt

Description

@eerhardt

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions