在相同的解决方案中,如何引用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软件包. (例如lib和框架).
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
发布评论