Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Versioning strategy for Feature branch in nuget

We are building a system which comprises of multiple repositories. Some of them are common. This solution is built with .net technologies, nuget and jenkin server.

We are planning to introduce versioning. All binaries should have product version like Major.Minor.Patch.Build.

We will have a dedicated Nuget server on our CI server where we will publish our internal packages for common projects. And similarly, we will create a nuget server on developer's local machine.

Here is the problem scenario:

Support one developer is working on a long running feature branch. And this feature requires changes across multiple branches (including a common branch). The developer will create feature branch for both the repositories and start working on them.

Since we will have a job to build feature branch (whenever any commit is done or pull request is raised on CI server), CI server will create a nuget package on centralized nuget server for the common repository.

If the generated nuget package has the same version (as the previous one), it will replace the existing package.

So the version should be different. Either we can increment any part of the previous version, like build part Or we can append -featureName at the end of the version number. Which one should be preferred?

And if we do any of these two things on dev machine as well, the developer has to change the package reference every time he switches between branches. So, ideally, package generated on dev machine should replace the previous package. But in this case as well, the developers switches between branches, he will have to make sure to build the appropriate common package.

Please suggest any standard solution for this scenario.

Thanks in Advnace

like image 263
Pragmatic Avatar asked Jun 25 '17 19:06

Pragmatic


People also ask

How do I change NuGet package version?

Right-click the Packages folder in the project, and select Update. This will update the NuGet package to the latest version. You can double-click the Add packages and choose the specific version.

Does NuGet use SemVer?

NuGet 4.3. 0+ supports SemVer 2.0. 0, which supports pre-release numbers with dot notation, as in 1.0.


1 Answers

We went with a pretty easy solution - this may have some limitations with a larger team that I am unaware of, but this is working for our small team.

Change the version in your .nuspec file to have the branch name. For example:

  • 1.0.60-enumfix this is on the enumfix branch
  • 1.0.61-enumfix
  • 1.0.59-newfeature
  • 1.0.60-dev this is our dev branch
  • 1.0.60 (this is our master)
  • 2.3.80-whocares

You get the point

When installing packages in the nuget packet manager check "allow pre-release" Delete or unlist nuget pre-release branch versions if needed.

like image 72
Iannazzi Avatar answered Sep 20 '22 23:09

Iannazzi