Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nuget packages in local work

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.

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

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?

Thanks

like image 819
Thaven Avatar asked Mar 21 '17 13:03

Thaven


2 Answers

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

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.

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.

like image 160
Leo Liu-MSFT Avatar answered Oct 03 '22 00:10

Leo Liu-MSFT


In the Node community, local packages problem is long solved with symbolic links (see this blog post and npm link command).

How it works: the directory of a distributed package is "symlinked" to package source directory. In this way, package consumers are transparently redirected to package source project, and changes in package sources are automatically reflected on the consumer side.

For some reason, NuGet still has no link feature. There is a feature request https://github.com/NuGet/Home/issues/1821, which indicates they have no plans of adding it.

Meanwhile I created a tool, which works similarly to npm link for NuGet packages, you may want to give it a try: https://www.nuget.org/packages/NuLink

like image 39
felix-b Avatar answered Oct 02 '22 23:10

felix-b