I developed a web api (.net core) in windows and hosting it in ubuntu server. My application needs packages from private nuget repository.
I have set the package source as nuget config -Set RepoName=http://sample-nuget-repo.net/api/odata
.
I have verified with nuget resources.
When I run dotnet restore, it gives me failure messages.
Please help me if i am missing anything.
what is the location of nuget.config file in ubuntu (as in windows it is appdata/nuget/nuget.config)
Restore by using MSBuild You can use msbuild -t:restore to restore packages in NuGet 4. x+ and MSBuild 15.1+, which are included with Visual Studio 2017 and higher. This command restores packages in projects that use PackageReference for package references.
Quick solution for Visual Studio usersSelect the Tools > NuGet Package Manager > Package Manager Settings menu command. Set both options under Package Restore. Select OK. Build your project again.
The dotnet restore command uses NuGet to restore dependencies as well as project-specific tools that are specified in the project file.
Install packages from NuGet.orgNavigate to NuGet.org and search for the package you want to install. Select Package Manager, and then copy the Install-Package command. In Visual Studio, select Tools > NuGet Package Manager > Package Manager Console to open the package manager console.
You can define custom package sources in a NuGet.Config file in the root directory of your source control repository containing your source code. Then you do not need to configure it on every machine.
NuGet.Config:
<configuration>
<packageSources>
<add key="NuGet.org" value="https://api.nuget.org/v3/index.json" />
<add key="sample-nuget-repo" value="http://sample-nuget-repo.net/api/odata" />
</packageSources>
</configuration>
When you run a nuget restore solution.sln
or dotnet restore solution.sln
the solution's directory will be checked first for a NuGet.Config file, then the directory above, all the way back to the root directory. Finally the NuGet.Config under the user's profile will be checked.
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