Is it possible to pack all *.nuspecs but provide the build number as the version?

Pure Krome's Avatar

Pure Krome

28 Jun, 2015 12:12 PM

Pre AppVeyor, I've been using a PS file to pack all my nuspecs (in a source destination) then push them up to NuGet.org. Works fine.

I've had a quick look at the AV docs (http://www.appveyor.com/docs/deployment/nuget) and it seems that AV offers this - yay!

Is there a way that AV can pack and publish all my nuspec's and set the version (instead of relying on the version in the nuspec) ?

Taken from the NuGet docs, this is how I would do it via nuget.exe:

(for each file in found files...)
   nuget.exe pack file -Version <version/build number>

Is this available to AV?

NOTE 1: Of course, all nuspecs will have the same build number because there's only one build number per build

Here's a kewl scenario I'm trying to get to:
2x AV projects.
1 -> all branches except master. No deployment. (appveyor.yml).
2 -> master branch only AND does deployment to NuGet.org. (appveyor-master.yml)

lots of commits all push up to dev/feature/bug branches. AV #1 fires off with each push. Finally, when all is good and we're ready for a new nuget release, we do one final commit => update the build version in appveyor-master.yml to .. whatever (eg. 1.2.0-alpha <-- which will be a pre-release). push up with [skip ci]. AV does nothing.

PR from dev to master. Merge. AV #2 kicks off, does it's dance .. then packs .. sets the -Version to the build (1.2.0-alpha) and the pushes up to NuGet.org.

then :moneybag: :)

NOTE 2: If build var cannot take the format x.y.z-alpha (which is semver, btw), then replace this concept with a different file that contains a single line that is the version for packing the nuspec's.

Oh yeah - one last thing. I know everyone will say: just set the version in the nuspec file. That's obvious and pretty easy for simple scenario's (like the one above) but it's a PITA when a project has multiple nuspec's (and therefore multi nugets to push up -- have to make sure I change all the files) ... but even more annoying is when we use a private nuget repo (eg. MyGet) and we're pushing our dev project nuspec's all the time. that's when it comes really handy! In those cases, we could just always use the build version. This is when we use nuget's to sync code between projects, instead of have huge solutions with 10's of projects.

reference PS file I use: https://github.com/PureKrome/HttpClient.Helpers/blob/master/NuGet%2...

  1. Support Staff 1 Posted by Feodor Fitsner on 30 Jun, 2015 02:58 AM

    Feodor Fitsner's Avatar

    You can have $version$ in nuspecs - this way the version will be taken from assembly meta-information. AppVeyor is able to patch AssemblyInfos and yes, you can have semver in build version format.

  2. 2 Posted by Pure Krome on 05 Jul, 2015 09:49 AM

    Pure Krome's Avatar

    Ah -- thanks!

    (you're awesome!)

  3. Pure Krome closed this discussion on 05 Jul, 2015 09:49 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac