How can I get the version number to display in Layout from currently built Octpack nupkg?

256 Views Asked by At

Below are the steps taking place

  • OctoPack: Attempting to build package from 'MySoltuion.MyProject.nuspec'.
  • OctoPack: Successfully created package
    'C:\pathToMySolution\MyProject\obj\octopacked\MyProject.2018.03.26.6654.nupkg'.
  • OctoPack: OctoPack successful

I want to get the version i.e 2018.03.26.6654.
FYI, I don't need my assembly version

[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Any help is appreciated, thanks

1

There are 1 best solutions below

0
On

OctoPack cannot resolve the tokens in the nuspec from the project file (unfortunately). Only from the build parameters (OctoPackNuGetProperties).

msbuild MySolution.sln /t:Build /p:RunOctoPack=true "/p:OctoPackNuGetProperties=suffix=release;title=My Title;version=1.0.0;myname=Paul"

See: UsingOctoPack-Replacementtokens

I am not sure myself if I will switch to a script with nuget to pack and push, so I can have the token replacements from the project file.

Btw.: It does work if you do not have a nuspec file, and Octopack generates one from the csproj file. But I would like to have my own nuspec, with a valid project url, dependencies, etc.