简体   繁体   English

NuGet为什么要安装两个JavaScript软件包副本?

[英]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.

相关问题 如何包含从 Nuget 安装的 JavaScript 软件包? - How do I include JavaScript packages I install from Nuget? 为什么Nuget Javascript包会复制到Scripts文件夹 - Why do Nuget Javascript packages copy to Scripts folder 为什么凉亭安装包两次? - Why does bower install packages twice? 为什么更改 JavaScript 中的阵列会影响阵列的副本? - Why does changing an Array in JavaScript affect copies of the array? 为什么在 CentOS 上获取软件包时 `yarn install` 会挂起? - Why does `yarn install` hang when fetching packages on CentOS? 为什么这个JavaScript在将输入值成功复制到元素文本后删除了所有内容 - Why does this JavaScript delete everything after it successfully copies the input value to the element text 为什么Atom文档使用CoffeeScript,但是用JavaScript生成包? - Why does Atom documentation use CoffeeScript, but generate packages in JavaScript? npm 在哪里安装包? - Where does npm install packages? TFS是否应该在源代码管理中存储通过NuGet安装的JavaScript软件包? - Should TFS be storing JavaScript packages installed via NuGet in Source Control? 从Source Control中的NuGet包添加Javascript文件 - Adding Javascript files from NuGet packages in Source Control
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM