runtime: [R2R] Publishing with ReadyToRunUseCrossgen2 fails on 5.0 RC2

After installing .NET 5.0 RTM from dotnet/installer, dotnet publish -p:PublishReadyToRunUseCrossgen2=True is failing with NETSDK1094 due to the missing crossgen2 package.

Repro:

# bash on macOS

$ rm ~/.dotnet; mkdir ~/.dotnet
$ curl -sSL https://aka.ms/dotnet/net5/daily/Sdk/dotnet-sdk-osx-x64.tar.gz | tar xzf - -C ~/.dotnet

$ dotnet --version
5.0.100-rtm.20506.2

$ dotnet new console -n r2rtest; cd r2rtest
The template "Console Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on r2rtest/r2rtest.csproj...
  Determining projects to restore...
  Restored /Users/am11/projects/r2rtest/r2rtest.csproj (in 78 ms).
Restore succeeded.

# fails both, with and without this NuGet.Config
$ cat > NuGet.Config << EOF
<configuration>
  <packageSources>
    <add key="dotnet5" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json" />
  </packageSources>
</configuration>
EOF

$ dotnet publish -p:PublishReadyToRun=True -p:PublishReadyToRunUseCrossgen2=True -c Release -r osx-x64
Microsoft (R) Build Engine version 16.8.0-preview-20473-01+250161603 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
/Users/am11/.dotnet/sdk/5.0.100-rtm.20506.2/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(63,5): error NETSDK1094: Unable to optimize assemblies for performance: a valid runtime package was not found. Either set the PublishReadyToRun property to false, or use a supported runtime identifier when publishing. [/Users/am11/projects/r2rtest/r2rtest.csproj]

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (16 by maintainers)

Most upvoted comments

Hey @am11, I am going to reopen this issue since it tracks the crossgen2 failure on other platforms too. Will update the title to reflect that.

cc @dagood, included all the infos here. 🙂