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?
dotnet new xunit
dotnet restore
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 ErrorsC:\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 informationC:\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
This issue was moved to NuGet/Home#9051
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.
Thank you for the update. I will see if I can find the docs to set that up and do it. However, the regular documentation did not seem to have that in them when I was reading them.
How does one setup dotNet Core to use the appropriate NuGet repository since dotNet Core SDK doesn't include these packages anymore?
Typically nuget.org is used by default. Have you taken steps to disable nuget.org as a feed?
The packages that are not pre-distributed with the sdk are by design. We will not be reintroducing them. Also, I don鈥檛 even believe all the packages needed for this example (dotnet new xunit) were ever bundled
@nkolev92 is there a good way to dump the nuget configuration in effect to list all the feeds being used and the files that configured them as such?
In the current restore, there is a GetRestoreSettingsTask through which all the configuration runs, that's one way.
You can also use the assets file but it doesn't tell you exactly what came from where, but rather what was used, if you can get the binlog.
Given a sample assets file the project section will contain:
@nguerrera I don't know how to setup nuget. I believe at my organization they have it already preconfigured on my laptop, but at home I don't have it setup. Simply adding nuget.exe to my command-line didn't seem to do the trick. I don't have nuget on my linux machine and this all worked just fine.
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 nugetsources setup. Then it worked.dotnet nuget add source --name nuget.org https://api.nuget.org/v3/index.jsonThen the restore worked. Thank you coding|blocks community.
It works!! thanks for share!!
Most helpful comment
I used the following to get my
dotnet nugetsources setup. Then it worked.Then the restore worked. Thank you coding|blocks community.