nuget创建两个包文件夹? [英] nuget creating two package folders?
问题描述
确定
所以我最近重新安装了Windows 10并升级了vs2013-> vs2015.在这一点上,我试图抓住几个nuget包.
So i recently reinstalled windows 10 and upgraded vs2013 -> vs2015. At this point i tried to grab a couple of nuget packages.
我遇到的问题是我有一个与我的解决方案文件(通过NuGet.config设置)处于同一级别的.nuget/packages文件夹,但是我在用户文件夹的根目录中也创建了完全相同的文件夹
The problem i am having is that i have a .nuget/packages folder at the same level as my solution file (set via NuGet.config) but i also have exactly the same folder getting created in the root of my user folder.
我的解决方案的packages文件夹包含为该解决方案安装的软件包,而我不想在我的用户目录中包含的软件包包含我正在处理的所有项目和解决方案的所有软件包.
the packages folder for my solution contains the packages installed for that solution, while the one i don't want in my user directory contains all the packages for all the projects and solutions i am working on.
有没有办法防止在用户目录中创建此.nuget文件夹?当我已经有用于解决方案的软件包文件夹时,这似乎没用
Is there a way i can prevent this .nuget folder being created in my user directory? it seems useless when i already have package folders for my solutions
谢谢
推荐答案
您可以清除用户配置文件下的.nuget\packages
目录,但是如果再次安装它们,则将再次下载这些软件包.
You can clear the .nuget\packages
directory under your user profile however the packages will be downloaded again if you install them again.
%USERPROFILE%\.nuget\packages
是NuGet v3在为新项目类型(例如Universal Windows项目)安装NuGet软件包时使用的本地计算机缓存.
%USERPROFILE%\.nuget\packages
is the local machine cache used by NuGet v3 when installing NuGet packages for new project types, such as Universal Windows projects.
对于C#控制台项目,NuGet将使用%LOCALAPPDATA%\NuGet\Cache
目录,这也是NuGet v2所使用的目录.
For a C# console project NuGet will use the %LOCALAPPDATA%\NuGet\Cache
directory which is also what NuGet v2 uses.
ASP.NET Core项目当前为NuGet软件包使用它们自己的%USERPROFILE%\.dnx\packages
目录.
ASP.NET Core projects currently use their own %USERPROFILE%\.dnx\packages
directory for NuGet packages.
要防止NuGet将软件包复制到用户配置文件中,您可以创建一个新的%NUGET_PACKAGES%
环境变量,该变量指向您希望NuGet复制文件的位置,例如C:\git-repositories\.nuget\packages
.
To prevent NuGet from copying the packages to your user profile you can create a new %NUGET_PACKAGES%
environment variable pointing to the location where you want NuGet to copy the files e.g. C:\git-repositories\.nuget\packages
.
要防止NuGet也将软件包复制到解决方案文件夹,您可以在解决方案文件夹中或更高级别的根目录中创建一个新的NuGet.config
文件.作为内容,您可以指定以下XML.
To prevent NuGet from copy the packages to the solution folder too you can create a new NuGet.config
file either in the solution folder or at any higher level up to the root. As content you can specify following XML.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="repositoryPath" value="C:\git-repositories\.nuget\packages" />
</config>
</configuration>
作为配置继承的帮助,请点击以下链接: NuGet配置继承
As help for configuration inheritance please follow this link: NuGet Configuration Inheritance
这篇关于nuget创建两个包文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!