Reputation: 416
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)
Upvotes: 9
Views: 14352
Reputation: 47907
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.
Upvotes: 16