项目参考 VS NuGet

编程入门 行业动态 更新时间:2024-10-28 05:26:09
本文介绍了项目参考 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

本文发布于:2023-11-08 08:12:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1568834.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:项目   NuGet

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!