sdk: dotNet Core SDK 3.1.100 failing to restore because of bad versions

Issue Description

On a brand new install of dotNet Core SDK 3.1.100 for Windows 10 x64, It seems to be missing dependencies with the install. Should I need to include other feeds to get the dotnet restore to work after doing a dotnet new xunit? I was following this document: Organizing and testing projects with the .NET Core command line. Some of the references are a little old so maybe something changed?

Steps performed

dotnet new xunit
dotnet restore

System Information

C:\Users\Phillip\Desktop\dotNetCore\01_NewTypes\test\NewTypesTests>systeminfo

Host Name:                 FENIX
OS Name:                   Microsoft Windows 10 Pro
OS Version:                10.0.18362 N/A Build 18362
OS Manufacturer:           Microsoft Corporation

dotnet Errors

C:\Users\Phillip\Desktop\dotNetCore\01_NewTypes\test\NewTypesTests>dotnet restore 
Restore completed in 25.54 ms for C:\Users\Phillip\Desktop\dotNetCore\01_NewTypes\src\NewTypes\NewTypes.csproj.
C:\Users\Phillip\Desktop\dotNetCore\01_NewTypes\test\NewTypesTests\NewTypesTests.csproj : error NU1100: Unable to resolve 'Microsoft.NET.Test.Sdk (>= 16.2.0)' for '.NETCoreApp,Version=v3.1'.
C:\Users\Phillip\Desktop\dotNetCore\01_NewTypes\test\NewTypesTests\NewTypesTests.csproj : error NU1100: Unable to resolve 'xunit (>= 2.4.0)' for '.NETCoreApp,Version=v3.1'.
C:\Users\Phillip\Desktop\dotNetCore\01_NewTypes\test\NewTypesTests\NewTypesTests.csproj : error NU1100: Unable to resolve 'xunit.runner.visualstudio (>= 2.4.0)' for '.NETCoreApp,Version=v3.1'.
C:\Users\Phillip\Desktop\dotNetCore\01_NewTypes\test\NewTypesTests\NewTypesTests.csproj : error NU1100: Unable to resolve 'coverlet.collector (>= 1.0.1)' for '.NETCoreApp,Version=v3.1'.
  Restore failed in 150.83 ms for C:\Users\Phillip\Desktop\dotNetCore\01_NewTypes\test\NewTypesTests\NewTypesTests.csproj.

dotnet information

C:\Users\Phillip\Desktop\dotNetCore\01_NewTypes\test\NewTypesTests>dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.1.100
 Commit:    cd82f021f4

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.18362
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.1.100\

Host (useful for support):
  Version: 3.1.0
  Commit:  65f04fb6db

.NET Core SDKs installed:
  3.1.100 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

About this issue

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

Commits related to this issue

Most upvoted comments

I used the following to get my dotnet nuget sources setup. Then it worked.

dotnet nuget add source --name nuget.org https://api.nuget.org/v3/index.json

Then the restore worked. Thank you coding|blocks community.

I used the following to get my dotnet nuget sources setup. Then it worked.

dotnet nuget add source --name nuget.org https://api.nuget.org/v3/index.json

Then the restore worked. Thank you coding|blocks community.

It works!! thanks for share!!

I used the following to get my dotnet nuget sources setup. Then it worked.

dotnet nuget add source --name nuget.org https://api.nuget.org/v3/index.json

Then the restore worked. Thank you coding|blocks community.

Ok, this worked. But why do I need to run this manually on a fresh Win10 machine with the dotnet 5.0 SDK?

I used the following to get my dotnet nuget sources setup. Then it worked.

dotnet nuget add source --name nuget.org https://api.nuget.org/v3/index.json

Ok, this worked. But why do I need to run this manually on a fresh Win10 machine with the dotnet 5.0 SDK?

Would it be possible to have the dotnet cli raise a more informative error when the version of nuget that’s built in hasn’t been configured with a source yet?

Something like

no source configured for the dotnet nuget cli, please run the following:
dotnet nuget add source --name nuget.org https://api.nuget.org/v3/index.json

I spent ~2 days determining that this was the root of the problem for me as well. Fresh install of the sdk on a Windows machine

I used the following to get my dotnet nuget sources setup. Then it worked.

dotnet nuget add source --name nuget.org https://api.nuget.org/v3/index.json

Then the restore worked. Thank you coding|blocks community.

This worked perfect!

When project templates are installed by the SDK or the user, the packages used by those template aren’t necessarily already downloaded to the machine. Development tools (like VS or dotnet sdk) can choose to support offline use by pre-installing packages locally (via a local feed or fallback folders). If they aren’t preinstalled, then restore will fail unless those packages are available on another nuget package feed that is configured on the developers workstation. Correct, if nuget.org is not a configured package feed, this scenario will error.

.NET SDK used to preinstall some packages in a fallback folder. In .NET Core SDK 3.0.100 and later, they stopped doing that.

This should stay an issue that .NET Core SDK chooses to address or not. Don’t believe this is a NuGet bug.