我正在尝试更改NuGet的默认包文件夹的位置
我阅读了很多帖子,包括NuGet 2.1 Release Notes的文档,NuGet 2.1版的新配置如下:
<configuration>
<config>
<add key=" repositoryPath" value=" C:\myteam\teampackages" />
</config>
...
</configuration>
我还阅读了以下帖子,Is it possible to change the location of packages for NuGet?
But this configuration doesn't work?
唯一的配置工作是旧配置,如下所示:
<settings>
<repositoryPath>C:\myteam\teampackages</repositoryPath>
</settings>
我正在使用包含NuGet Package 2.1版的Visual Studio 2012 Update 1
重现步骤:
-
在解决方案目录中,创建一个文件"nuget.config"
-
编辑nuget.config并添加:
<settings> <repositoryPath> C:\ myteam \ teampackages </ repositoryPath> </ settings>
-
删除默认包文件夹
-
在visual studio中,右键单击Solution,然后选择Manage NuGet Packages安装包(任何包)
-
确认包已下载到C:\ myteam \ teampackages
-
删除C:\ myteam \ teampackages中下载的包
-
将nuget.config更改为以下内容:
<configuration> <config> <add key =“repositoryPath”value =“C:\ myteam \ teampackages”/> </ config> </ configuration>
尝试再次安装任何库 .
我发现在packages文件夹中安装的库不是我的文件夹???
2 回答
因此,如果nuget.config位于项目/解决方案文件夹中,则不会受到尊重 . 您可以尝试将其移动到.nuget文件夹并重新加载解决方案 .
当您在路径的末尾放置\时,它可以工作: