简体   繁体   English

无法在 .net 核心中使用本地 nuget 包

[英]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.我已将 .net 核心 Web 应用程序所需的所有 nuget 包下载到名为 nuget-packages 的文件夹中。

In nuget.config file which is stored in the same folder as .csproj file, I have the following在与 .csproj 文件存储在同一文件夹中的 nuget.config 文件中,我有以下内容

 <?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).在 Visual Studio 2019 工具选项 Nuget 包管理器源中,我取消了所有源(nuget.org、Telerik、MSFT 离线包)。

I would like the project to use the packages stored in the nuget-packages instead of anywhere else.我希望该项目使用存储在 nuget-packages 中的包而不是其他任何地方。

However when I build this project, I am getting NU1100 Unable to resolve errors.但是,当我构建这个项目时,我收到 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.打开参数窗口,选择源包选项卡,按“添加源包”按钮,然后在打开的对话框中选择新的包源,输入包源文件夹的路径并将此源移动到顶部。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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