OctoPack version from AssemblyVersion only works once

I have an msbuild step in TFS which builds my csproj using octopack.
Now, I committed a change to git with the following in AssemblyInfo.cs :
[assembly: AssemblyVersion(“2.3.*”)]

I then proceeded to build this in tfs which gave me this release number:
PRODUCT.2.3.5757.18829

All Good.

Now I queued a build up again straight after to check it worked twice and octopack gives the following message (and then errors as a package exists in octopus with the same name):
Successfully created package ‘\TFSBUILDS\Fast\obj\octopacked\PRODUCT.1.0.0.0.nupkg’.

I’m just wondering why the version number from AssemblyInfo.cs was only taken the first time, and the second it failed?

Thanks

Well I found that the version of the dll (product.dll) in the bin folder is 1.0.0.0 but i don’t know where it is getting this from.

Hi Jack,

Thanks for reaching out. The version on the DLL will be set by AssemblyFileVersion inside of AssemblyInfo.cs. RE the package version going back to 1.0.0.0, have you checked that your change to AssemblyVersion wasn’t rolled back in source control after the first time it worked?

Thanks,

Dalmiro

One thing to note that I have hit a few times… MSBuild is a part of this process. If it doesn’t rebuild anything, it will not increment the version. For instance run a build. Then change only a web.config. Run another build and the nuget package name will not increment.

The solution i have found is to make sure the msbuild Clean parameter is always specified (/t:Clean,Build).