简体   繁体   中英

Unable to use local nuget packages in .net core

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM