Nuget package version is not consistent when using Octopack in build definition

Hi Everyone,

We are using Octopack to package our solution after the building the source code. In the MS build definition we haven’t provided any parameter for versioning. So we have assumed Octopack would use the Assembly version of the solution for the Nuget package version.

We have added * in the AssemblyInfo.cs file. It is working as expected. But the versioning is not consistent. It is not incremental. Somehow there is a difference between yesterday’s and today’s build.

For Example,

1.0.0.18921.nupkg (Most recent)
1.0.0.42195.nupkg (From yesterday)

Hence Octopus Deploy is not creating the release automatically since today’s package is not the greatest version.

Any suggestion to resolve this issue would be very helpful.

Thanks,
Sasi

Hi Sasi,

Thanks for getting in touch.

.NET will expect a version string of major.minor.build.revision. When you use a wildcard, the build and revision numbers are time-based.

For example, I created a class library project, included Octopack and set my assembly version to this:
[assembly: AssemblyVersion("1.0.*")]

By default it built this:
MyProject.1.0.6186.18453.nupkg

If I set my time to 15 minutes earlier, it build this (note the revision number is less than the first build):
MyProject.1.0.6186.18026.nupkg

If I set my computer’s time to one day in the future, it build this:
MyProject.1.0.6187.18540.nupkg

In this case, you can see the build number incrementing by one, and the revision number incrementing according to the time of the day.

I’m not sure why your build number is not incrementing. Can you confirm you are using an assemblyversion wildcard of “1.0.*”?

I have a feeling you are using “1.0.0." instead of "1.0.” and are stripping the automatic build number.

Hope this helps.

Cheers
Mark

Thank you so much for your response. It worked. I had it like 1.0.0.*

Thanks again.

Regards,
Sasikumar

Hi Mark,
Your suggestion helped. It is working fine now. Thank you so much
Thanks,Sasikumar

  From: Mark Siedle <tender2+dd8f39da65@tenderapp.com>

To: sasikumar2079@yahoo.com
Sent: Wednesday, December 7, 2016 6:33 PM
Subject: Re: Nuget package version is not consistent when using Octopack in build definition [Problems #49636]

#yiv7055228278 pre {width:92%;margin:10px 2%;padding:5px 2%;background:#efefef;border:1px solid #d6d6d6;}#yiv7055228278 blockquote {margin-left:0;padding-left:1em;border-left:5px solid #ccc;}