I am running .NET Core 1.1.0 on Ubuntu 14.04, with the goal of hosting my Web APIs in Docker on Ubuntu. I want to build my packages on Ubuntu, but some of the NuGet references are hosted on an internal NuGet repository (Artifactory). This works fine in VS2015 on Windows after I add the package source, but when I run:
dotnet restore
on Ubuntu, the packages hosted on the public NuGet repo download fine, but those on Artifactory fail:
error: Unable to resolve 'Mercury.BaseModel (>= 1.1.0)' for '.NETCoreApp,Version=v1.1'.
I found a NuGet config file at \home\<user>\.nuget\NuGet\NuGet.Config
and added the Artifactory repository as follows:
<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> <add key="Artifactory-DEV" value="https://theluggage-agct.gray.net/artifactory/api/nuget/nuget-institutional-development-local" protocolVersion="3"/> </packageSources> </configuration>
but I am still getting the same error.
NuGet itself does not work after installing the .NET Core SDK, I am using dotnet restore
as mentioned - is there similar config I must edit for the dotnet CLI (which must be using NuGet?) or is there something else I need to do?
Thanks!
Use the dotnet restore command, which restores packages listed in the project file (see PackageReference). With . NET Core 2.0 and later, restore is done automatically with dotnet build and dotnet run .
The service index location for nuget.org is https://api.nuget.org/v3/index.json .
Dotnet CLI restore can take -s as source feed url, so if you have Artifactory with Remote repository to nuget.org.
dotnet restore -s https://artifactory.example.com/api/nuget/nuget.org
Reference :
https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-restore?tabs=netcore2x
https://www.jfrog.com/confluence/display/RTF/NuGet+Repositories
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With