[英]Why does NuGet install two copies of JavaScript packages?
When I install JavaScript packages in Visual Studio using NuGet, targeting Project1, I find the scripts are installed into the Solution1/Project1/Scripts folder of the target Project, and also into the Solution1/packages folder. 当我使用NuGet在Visual Studio中以Project1为目标安装JavaScript程序包时,我发现脚本既安装在目标Project的Solution1 / Project1 / Scripts文件夹中, 又安装在Solution1 / packages文件夹中。
What is the point of this additional copy? 此附加副本有何意义?
Think of the packages folder as a cache. 将packages文件夹视为高速缓存。 If you had multiple projects in the solution, they would copy their local copies out of the packages folder into their individual directories.
如果您在解决方案中有多个项目,他们会将其本地副本从packages文件夹复制到各自的目录中。 The idea is that you only have to download the actual nuget package once and in the event that a project gets messed up, it just refreshes its copy from the cache.
这个想法是,您只需要下载一次实际的nuget包,并且一旦项目陷入混乱,它只会从缓存中刷新其副本。
The packages folder also contains much more than just the javascript files. packages文件夹不仅包含javascript文件,还包含更多内容。 It has instructions for modifying the config files, the nuget package definition, and a few other tidbits that visual studio uses to keep track of them.
它具有有关修改配置文件,nuget程序包定义以及Visual Studio用来跟踪它们的其他一些提示的说明。
For content packages like jQuery, you would still have multiple copies of the .js file on your system, just like the DLLs that get copied into your bin folder. 对于jQuery这样的内容包,您的系统上仍将具有.js文件的多个副本,就像将DLL复制到bin文件夹中一样。 You just wouldn't have the package folder copied with every solution.
您只是不会在每个解决方案中都复制package文件夹。
For packages that have binaries that support lots of frameworks, you presently have the binaries for every framework supported sitting in each solution's packages folder, regardless of which frameworks the solution is using. 对于具有支持许多框架的二进制文件的软件包,无论解决方案使用的是哪种框架,当前都将每个受支持的框架的二进制文件放在每个解决方案的packages文件夹中。 With a global package installation, you'd have 1 global package install, and then each project would copy into its bin the assemblies that apply to it.
使用全局软件包安装时,您将安装1个全局软件包,然后每个项目都将适用于它的程序集复制到其bin中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.