问题描述
在任何 csproj
或 project.json 个软件包
解决方案文件夹/ code>为基础的.NET Core项目。
There is no more packages
solution folder in any csproj
or project.json
-based .NET Core project.
获取使用的缓存文件夹列表:
NuGet CLI gets the list of used cache folders:
nuget locals all -list
响应:
http-cache: C:\Users\<foo>\AppData\Local\NuGet\v3-cache
global-packages: C:\Users\<foo>\.nuget\packages\
temp: C:\Users\<foo>\AppData\Local\Temp\NuGetScratch
如何更改或覆盖这些位置?
How to change or override these locations?
推荐答案
缓存位置
.NET Core和Visual Studio 2017不再存在本地解决方案软件包文件夹。
Cache locations
Solution-local packages folders are no longer exist for .NET Core and Visual Studio 2017.
NuGet 4.0+使用至少两个全局软件包位置:
NuGet 4.0+ uses at least two global package locations:
- 特定于用户:
%userprofile%\ .nuget\packages\
- 机器范围:
%ProgramFiles(x86)%\Microsoft SDKs\NuGetPackages\
- User-specific:
%userprofile%\.nuget\packages\
- Machine-wide:
%ProgramFiles(x86)%\Microsoft SDKs\NuGetPackages\"
您可以使用以下控制台命令列出所有用户特定的文件夹:
You can list all user-specific folders using the following console command:
nuget locals all -list
请注意,这里没有列出计算机范围的文件夹,但是它是在Visual Studio设置中定义的:
Notice that the machine-wide folder isn't listed there. However, it is defined at Visual Studio settings:
Options -> NuGet Package Manager -> Package Sources
配置文件
NuGet.config
文件:
- 用户特定:
%APPDATA% \NuGet\
- 机器范围:
%ProgramFiles(x86)%\NuGet\Config\
- User-specific:
%APPDATA%\NuGet\
- Machine-wide:
%ProgramFiles(x86)%\NuGet\Config\
可以在多个级别更改和覆盖NuGet设置:
It is possible to change and override NuGet settings at many levels:
- 项目
- 解决方案
- 用户
- 计算机
- project
- solution
- user
- machine
甚至更多!在此处阅读有关 NuGet.config
层次优先级排序的更多信息:。
And even more! Read more about NuGet.config
hierarchical priority ordering here: How settings are applied.
例如, globalPackagesFolder
参数更改程序包缓存位置。看看这个 NuGet.config
示例:
For example, globalPackagesFolder
parameter changes a package cache location. Look at this NuGet.config
example:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<clear />
<add key="globalPackagesFolder" value="c:\packages" />
</config>
</configuration>
这篇关于更改Visual Studio 2017使用的NuGet软件包文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!