简体   繁体   English

为WebAPI项目添加nuget包

[英]Adding nuget packages for a webapi project

I am trying to change the default location of nuget packages 我正在尝试更改nuget包的默认位置

I have a nuget.config file in the same location as the solution file . 我在same location as the solution file有一个nuget.config same location as the solution file

Its contents are 其内容是

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <config>
    <add key="repositoryPath" value="Lib" />
  </config>
</configuration>

But the problem is still when I go to Manage Nuget Packages and click Restore , the libraries go to packages folder but not to lib folder. 但是问题仍然存在,当我转到“ Manage Nuget Packages并单击Restore ,库转到packages文件夹,而不是lib文件夹。

This only happens to the WebAPI project file but not to any other projects in the same solution. 这只会发生在WebAPI项目文件上,而不会发生在同一解决方案中的任何其他项目上。

Any ideas why ? 有什么想法吗?

Should any thing be changed to the web.config files ? 是否应该将任何内容更改为web.config文件?

Turns out that after placing the nuget.config file, close and re-open the visual studio (restart it). 事实证明,放置nuget.config文件后,关闭并重新打开Visual Studio(重新启动它)。

It will now read the nuget.config file and then will understand that it needs to download all the packages to the configured folder in the nuget.config file. 现在它将读取nuget.config文件,然后将了解需要将所有软件包下载到nuget.config文件中的nuget.config配置文件夹中。

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

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