项目参考 VS NuGet [英] Project reference VS NuGet

查看:14
本文介绍了项目参考 VS NuGet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该如何在同一解决方案中从 project B 引用另一个 project A?
如果我得到什么,我会失去什么:

How should I reference to another project A from project B in the same solution?
What do I gain and what do I lose if I:

  • 添加对 project A 的引用作为项目引用.
  • project B中安装project A的NuGet包.
  • Add the reference to project A as a project reference.
  • Install the NuGet package of project A in project B.

困扰我的事情是构建依赖项、版本控制..?
或者这是否完全破坏了解决方案的目的?

Things that would bother me are build dependencies, versioning..?
Or does this totally destroy the purpose of a solution?

推荐答案

使用第一种方法,您获得了简单性,因为您不需要生成新版本的 ProjectA nuget 包,您在其中所做的每一次更改(即 ProjectA.nupkg).

With the first approach, you gain in simplicity, since you don't need to generate a new version of the ProjectA nuget package, every change you make in it (i.e. ProjectA.nupkg).

但是,使用第二种方法,您可以获得可移植性,因为您可以轻松地与其他项目/解决方案共享相同的 nuget 包.

However, with the second approach, you gain in portability, since you can easily share the same nuget package with other projects / solutions.

就个人而言,我只为旨在与其他解决方案共享的项目创建 nuget 包.(例如库和框架).

Personally, I create nuget packages only for projects whose goal is to share with other solutions. (E.g. libs and frameworks).

希望这可以帮助您做出决定!

Hope this helps you decide!

这篇关于项目参考 VS NuGet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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