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

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

问题描述

我们目前不使用 nuget 作为我们的依赖项,更喜欢采用老式的方式并将它们全部粘贴到 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-considered-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天全站免登陆