dotnet / docs

This repository contains .NET Documentation.
https://learn.microsoft.com/dotnet
Creative Commons Attribution 4.0 International
4.25k stars 5.89k forks source link

CI Server cannot run this command, restore will not succeed #10553

Closed AndersBillLinden closed 5 years ago

AndersBillLinden commented 5 years ago

Running dotnet build foo.sln does not restore nuget packages successfully when running the command from a CI Server (using CruiseControl.net as administrator). Running the same command from a CLI works flawlessly.

Error being error NU1100: Unable to resolve 'Serilog.AspNetCore (>= 2.1.1)' for '.NETCoreApp,Version=v2.2'..


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

AndersBillLinden commented 5 years ago

This line is only one of many in the same form. It seems like every nuget package results in an error.

AndersBillLinden commented 5 years ago

If I had am running this once in the CI Server

nuget sources add nuget.org

it will from now on succeed restoring packages.

AndersBillLinden commented 5 years ago

The conclusion is that dotnet.exe not necessarily is aware of nuget sources but can be assisted by the older nuget command to learn from where to fetch packages (it does not even know about nuget.org).

Thraka commented 5 years ago

Sounds like your CI server isn't configured for the nuget package source. You can create a nuget config file and deploy it with your app to the CI server. This would have the definition for the nuget server in it. that should solve your problem.

If it doesn't please follow up! I'll close this issue. Thanks!