Skip to content

dotnet app.cs #:sdk directive pinned version results in The SDK 'Sdk/Version' specified could not be found. #49797

@devlead

Description

@devlead

Describe the bug

MSBuild SDKs doesn't seem to be fetched correctly from NuGet.org when version is specified with #:SDK directive

To Reproduce

Given file like below

#:sdk Uno.Sdk@6.2.0-dev.26

Console.WriteLine("Hello, World!");

When

dotnet test.cs

Then

The SDK 'Uno.Sdk/6.2.0-dev.26' specified could not be found.  C:\temp\test.csproj

The build failed. Fix the build errors and run again.

But when file like below

#:sdk Uno.Sdk

Console.WriteLine("Hello, World!");

and global.json

{
  "sdk": {
    "version": "10.0.100-preview.6.25358.103"
  },
  "msbuild-sdks": {
    "Uno.Sdk": "6.2.0-dev.26"
  }
}

When

dotnet test.cs

Then

Restore complete (11,6s)
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
  test succeeded (5,6s) → C:\Users\MattiasKarlsson\AppData\Local\Temp\dotnet\runfile\test-48b0209a0a8b51dd213126c9e30b446b15b1985051974d4da1dde6742057b120\bin\debug\test.dll

Build succeeded in 19,5s
Hello, World!

Further technical details

  • Include the output of dotnet --info
.NET SDK:
 Version:           10.0.100-preview.6.25358.103
 Commit:            75972a5ba7
 Workload version:  10.0.100-manifests.6616851e
 MSBuild version:   17.15.0-preview-25358-103+75972a5ba

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.26100
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\10.0.100-preview.6.25358.103\

Metadata

Metadata

Assignees

Labels

Area-run-fileItems related to the "dotnet run <file>" effort

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions