Skip to content

dotnet restore doesn't respect the <RuntimeIdentifier> for sdk-style project. #40517

Closed as not planned
@dxynnez

Description

@dxynnez

Describe the bug

We are migrating our Azure Functions (isolated mode) to .Net 8 but got following errors when trying to build & publish the app as self-contained:

NETSDK1112: The runtime pack for Microsoft.NETCore.App.Runtime.win-x64 was not downloaded. Try running a NuGet restore with the RuntimeIdentifier 'win-x64'.
NETSDK1112: The runtime pack for Microsoft.AspNetCore.App.Runtime.win-x64 was not downloaded. Try running a NuGet restore with the RuntimeIdentifier 'win-x64'.

It appears that in .Net 8, the dotnet restore would not respect the RID specified in the sdk-style project - we got a similar error when trying to publish a console app in the same way.

To Reproduce

Create an Azure Funtions for .Net 8.0 Isolated using the VS built-in template, Add <RuntimeIdentifier>win-x64</RuntimeIdentifier> into the csproj.

Make sure the 'Microsoft.NETCore.App.Runtime' is not in the local nuget cache.

dotnet restore
dotnet build --configuration release --no-restore --self-contained true
dotnet publish --configuration release --no-restore --no-build --self-contained true

Exceptions (if any)

NETSDK1112: The runtime pack for Microsoft.NETCore.App.Runtime.win-x64 was not downloaded. Try running a NuGet restore with the RuntimeIdentifier 'win-x64'.
NETSDK1112: The runtime pack for Microsoft.AspNetCore.App.Runtime.win-x64 was not downloaded. Try running a NuGet restore with the RuntimeIdentifier 'win-x64'.

Further technical details

  • Include the output of dotnet --info
  • The IDE (VS / VS Code/ VS4Mac) you're running on, and its version

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions