2

I have downloaded all the nuget packages required by my .net core web app in a folder called nuget-packages.

In nuget.config file which is stored in the same folder as .csproj file, I have the following

 <?xml version="1.0" encoding="utf-8"?>
   <configuration>
       <packageSources>
         <add key="local-packages" value=".\nuget-packages" />
       </packageSources>
   </configuration>

In Visual Studio 2019 Tools Options Nuget Package Manager Sources, I have unchecked all the sources (nuget.org, Telerik, MSFT Offline Packages).

I would like the project to use the packages stored in the nuget-packages instead of anywhere else.

However when I build this project, I am getting NU1100 Unable to resolve errors.

For some reason, the project is not able to find the packages.

Can you please suggest what am I missing? Thank you

blue piranha
  • 3,706
  • 13
  • 57
  • 98
  • Does this answer your question? [How do I install a NuGet package .nupkg file locally?](https://stackoverflow.com/questions/10240029/how-do-i-install-a-nuget-package-nupkg-file-locally) – Edward Brey Oct 31 '20 at 01:35

1 Answers1

0

You should specify your package source directory in the package manager parameters. Open the parameters window, select the source packages tab, press button "Add source packages" and after it in the open dialog you should select the new package source, enter path to the package source folder and move this source to the top.

  • 2
    Hi Konstantin, thanks for your reply. Then what is the purpose of defining package sources in nuget.config? If I do what you suggested, I have to define the path which is specific to local machine. If I check in my code, that will not build on the build server because that path will not exist. Thoughts? – blue piranha Jan 23 '20 at 12:56