我想知道Visual Studio 2017项目中的NuGet.Config文件在哪里?我试图在项目的根目录中创建自己的NuGet.Config文件,但没有找到任何新的存储库(NuGet源)。有人有什么主意吗?
这是我要为。Net Core项目获得的文件:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="AspNetCore" value="https://dotnet.myget.org/F/aspnetcore-ci-dev/api/v3/index.json" />
<add key="AspNetCoreTools" value="https://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json" />
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
Visual Studio从解决方案根目录读取NuGet.Config文件。尝试将其移到那里,而不是将其放置在与项目相同的文件夹中。
您也可以将文件放置在%appdata%\NuGet\NuGet.Config
,它将在任何地方使用。
https://docs.microsoft.com/en-us/nuget/schema/nuget-config-file
有多个按以下顺序读取的nuget程序包:
NuGetDefaults.Config file
。您可以在%ProgramFiles(x86)%\NuGet\Config
中找到它。%APPDATA%\NuGet\nuget.config
中找到它。nuget.config
的文件。您可以找到更多信息here。
除了接受的答案,我还要添加一个信息,即Visual Studio 2017中的NuGet包位于项目文件本身中。即,右键单击项目->编辑,以找到所有软件包参考条目。
如果使用代理,则必须编辑Nuget.config文件Windows 7和10中的此文件位于路径:C:\ Users \ YouUser \ AppData \ Roaming \ NuGet。
包括设置:
<config>
<add key = "http_proxy" value = "http://Youproxy:8080" />
<add key = "http_proxy.user" value = "YouProxyUser" />
</config>