nuget包在本地工作

nuget包在本地工作

本文介绍了nuget包在本地工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的产品中,我们有几个项目.它们中的几乎每一个都依赖于一个称为核心"的核心.我们将每个项目作为单独的nuget包分发.对于将我们的工作部署到其他团队/产品上,nuget效果很好,这在我们本地工作期间确实是很大的痛苦.

In our product, we have a few projects. almost each of them is depending on single one, called "core". We are distributing each project as separated nuget package. And for deployment our work for other teams/products nuget works great, it's really big pain during our local job.

每次更改核心"项目时,我们都需要对其进行重建,构建nuget并将其发布在某个存储库中,然后在其他项目中进行还原.需要时间.有时我们需要在几次迭代中对核心进行更改.我们要一遍又一遍地进行构建-发布nuget-update nuget循环

Each time when "core" project is changed, we need to rebuild it, build nuget, publish it in some repository, then in other projects make restore.It's take time.And sometimes we need to make changes in core in few iterations. It's fore us to make build-publish nuget-update nuget circle over and over

到目前为止,我们发现的最佳解决方案是在本地工作期间将nuget引用切换为项目引用,并在我们要发布时将其切换回nuget.

Best solutions we found so far is to switch nuget references to project references during our local work, and switch it back to nuget when we want to publish it.

但是我们不确定这是否是最好的方法.

But we are not sure if it's the best way.

那么,在不增加工作难度的情况下在两个本地项目中处理块引用的最佳方法是什么?

So, what is the best way to handle nugget references in two local projects without making work harder?

谢谢

推荐答案

NuGet作为Microsoft开发平台的程序包管理器有很多优点,但这并不意味着它没有缺陷.就像您遇到的一样,如果引用的项目经常被修改,我们必须重新构建它,构建nuget并为每次修改发布它.这将带来很多无聊的工作.为了解决此缺点,项目到项目"引用应该是一种更好的方法.

NuGet has many advantages as a package manager for the Microsoft development platform, this does not mean that it is not flawed. Just as you encountered, if the referenced project is modified frequently, we have to rebuild it, build nuget, publish it for each modification. That will bring a lot of boring work. To resolve this disadvantages, the Project-to-project references should be a better way.

项目到项目引用的优点在于,它在构建系统中的项目之间创建了依赖关系.如果自从上次创建引用项目以来更改了依赖项目,则将生成该依赖项目.文件引用不会创建构建依赖关系,因此可以在不构建依赖项目的情况下构建引用项目.

The advantage of a project-to-project reference is that it creates a dependency between the projects in the build system. The dependent project will be built if it has changed since the last time the referencing project was built. A file reference does not create a build dependency, so it is possible to build the referencing project without building the dependent project.

所以您要做的是最好的方法.当经常修改参考项目时,应该推荐项目间参考;当与他人共享参考项目或发布参考项目时,nuget参考更为合适.

So what you have done is the best way. The project-to-project reference should be recommend when the referenced project is modified frequently, the nuget reference is more appropriate when share the reference project to others or publish it.

这篇关于nuget包在本地工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 02:14