无法识别解决方案文件夹中的 Visual Studio 2017 Nuget.config [英] Visual Studio 2017 Nuget.config at solution folder not recognized
问题描述
我在使用 Visual Studio 2017 时遇到问题,
I'm having issue with visual studio 2017,
新解决方案不断引用C:\Users\yopa\AppData\Roaming\NuGet\Nuget.config"中意外位置的 Nuget.config 文件.
where new solution keeps referencing the Nuget.config file in unexpected location in 'C:\Users\yopa\AppData\Roaming\NuGet\Nuget.config'.
我已将/.nuget/Nuget.config"文件添加到我的解决方案文件夹中.
I've added '/.nuget/Nuget.config' file to my solutions folder.
然而,解决方案仍然引用了'C:\'中的nuget配置文件,并且正在恢复'C:\'包文件夹中的nuget包.
However, the solution is still referencing the nuget configuration file in the 'C:\', and the nuget packages are being restored in 'C:\' package folder as well.
如何配置我的解决方案以支持其目录中的 package.config 文件?
How do I configure my solution to honour package.config file in its directory?
我已尝试删除漫游文件夹中的 nuget.config 文件,但解决方案会在完成 nuget 包还原后重新创建该文件.
I've tried deleting the nuget.config file in the roaming folder, but the solution re-creates the file when nuget package restore is done.
推荐答案
如何配置我的解决方案以支持其目录中的 package.config 文件?
How do I configure my solution to honour package.config file in its directory?
要确保您的解决方案遵循 .nuget
文件夹中的 package.config 文件,您应该正确配置此文件,例如,我创建了一个测试示例解决方案,然后添加一个 .nuget
文件夹内的 >Nuget.config:
To make sure your solution to honor the package.config file in the .nuget
folder, you should configure this file correctly, for example, I created a test sample solution, then add a Nuget.config
inside .nuget
folder:
我的NuGet.Config
文件:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="repositoryPath" value="D:\Test" />
</config>
</configuration>
然后,另一个重要信息是记住在添加 Nuget.config
文件后重启 Visual Studio.
Then, another important info is remember restart Visual Studio after adding the Nuget.config
file.
作为测试结果,nuget 包正在D:\Test"包文件夹中恢复:
As test result, the nuget packages are being restored in 'D:\Test' package folder:
这篇关于无法识别解决方案文件夹中的 Visual Studio 2017 Nuget.config的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!