Nuget - 在源代码管理中存储包,还是不? [英] Nuget - store packages in source control, or not?

查看:62
本文介绍了Nuget - 在源代码管理中存储包,还是不?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们目前不将 nuget 用于我们的依赖项,更喜欢采用 old-skool 方式并将它们全部粘贴在 libs 文件夹中并从那里引用.我知道.所以 1990 年代.

We currently don't use nuget for our dependencies, preferring to go old-skool way and stick them all in a libs folder and reference from there. I know. So 1990's.

无论如何,nuget 总是让我感到有点不安……你知道,对云的依赖等等.因此,我发现自己主要同意 Mark Seeman(参见此处:http://blog.ploeh.dk/2014/01/29/nuget-package-restore-thinked-harmful/) 谁说:

Anyway, nuget has always made me feel a bit queasy... you know, reliance on the cloud and all that. As such, I'm find myself in the main agreeing with Mark Seeman (see here: http://blog.ploeh.dk/2014/01/29/nuget-package-restore-considered-harmful/) who says:

就我个人而言,我总是禁用该功能,而是检入我存储库中的所有包.这从来没有给我任何问题.

Personally, I always disable the feature and instead check in all packages in my repositories. This never gives me any problems.

问题是,这在第 3 版中发生了变化,您不能在解决方案旁边存储包,如下所述:https://oren.codes/2016/02/08/project-json-all-the-things/.哪一种把它们检查到源代码中搞砸了.

Trouble is, this has changed in version 3, you can't store packages alongside the solution, as outlined here: https://oren.codes/2016/02/08/project-json-all-the-things/. Which sorta screws up checking them into source code.

所以,我在这里什么都不担心吗?我应该从 nuget 中喝点酒,还是站在 Seeman 先生一边谨慎行事?

So, am I worrying about nothing here? Should I drink from the nuget well, or side with Mr Seeman and er on the side of caution?

推荐答案

在源代码管理中存储 NuGet 包是一个非常非常的坏主意.我不小心做了一次,最终导致我的源代码相当臃肿,那是在 .NET Core 之前......

Storing NuGet packages in source control is a really, really bad idea. I accidentally did it once and I ended up bloating my source code considerably, and that was before .NET Core...

从 NuGet 井中喝上一杯.现在大多数软件组件都以类似的方式打包(NPM、Bower 等).所引用的博文已有两年历史,而且 .NET 世界中的包管理正在迅速变化,因此这是我最近的一些经验.

Drink deep from the NuGet well. Most software components are packaged in a similar way these days (NPM, Bower etc). The referenced blog post is two years old and package management is changing rapidly in the .NET world, so here's some of my experience lately.

  • 无法从 nuget.org 中删除 NuGet 包.它们可以隐藏,但如果您的应用程序请求一个隐藏的包,它会下载它像平常一样.它永远不会消失在虚空中.
  • 启用包还原"不再有问题,因为它现在是 NuGet 2.7+ 中的默认选项.你别无选择了.
  • 包不再按解决方案存储,而是按机器存储,这将节省大量带宽并减少构建时的初始提取周期.
  • 如果您使用 .NET Core 构建新项目,您将拥有数十个包,因为整个 BCL 将作为 NuGet 包提供.您真的想将所有 System.* 包都签入到源代码中吗?

这篇关于Nuget - 在源代码管理中存储包,还是不?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆