为什么使用 NuGet 而不是直接在我的机器上安装库 [英] Why use NuGet over installing libraries directly on my machine

查看:15
本文介绍了为什么使用 NuGet 而不是直接在我的机器上安装库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不明白 - 有人可以向我解释为什么我应该使用 NuGet 而不是通过安装一堆库setup.exe 或 MSI?有什么优势?

I don't get it - can someone please explain to me why I should use NuGet rather than installing a bunch of libraries via a setup.exe or MSI? What advantage is there?

例如,通过 NuGet 安装 Entity Framework 4.3 是否比下载安装程序更好?此外,如果我通过 NuGet 安装实体框架,那么它是否可用于我创建的任何新解决方案或项目(这里有点混淆).

For example is it better to install Entity Framework 4.3 via NuGet rather than downloading the setup? Also, if I install entity framework via NuGet then is it available to any new solutions or projects that I create (bit confused here).

基本上,NuGet 做了哪些普通安装不做的事情(反之亦然!)

Basically what does NuGet do that a normal install doesn't do (or vice versa!)

推荐答案

我认为 NuGet 最大的优势是除了可以轻松地将包添加到您的项目中.

Besides making it simple to add a package to your project, I think NuGet's biggest advantage is dependency management.

NuGet 允许项目所有者将其库打包为包.以前,如果他们依赖于 log4net 等其他库,他们会将这些程序集包含在他们的 setup/zip 文件中并上传到他们的网站.

NuGet allows project owners to package their libraries as packages. Before, if they depended on other libraries like log4net, they would include those assemblies in their setup/zip file and upload to their web site.

使用 NuGet,他们只需在 .nuspec 文件中添加对这些外部包的引用.当 NuGet 安装包时,它会看到存在依赖项,并会自动下载并安装这些包.它还支持冲突管理,因此如果两个包依赖于不同的版本,它会找出正确的一个来安装.

With NuGet, they simply add a reference to these external packages in the .nuspec file. When NuGet installs the package, it will see that there are dependencies and will automatically download and install those packages as well. It also supports conflict management so that if 2 packages depends on different versions, it will figure out the correct one to install.

我认为确定 NuGet 是否适合您的最佳方法是实际尝试使用它.我相信一旦你这样做了,你就会意识到它有很多好处.

I think the best way to determine if NuGet will work for you is to actually try using it. I'm sure that once you do, you'll realize that it has many benefits.

这篇关于为什么使用 NuGet 而不是直接在我的机器上安装库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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