Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

NuGet: How can I append an auto-incrememted build number to my NuGet package version ONLY when $(ConfigurationName) == Debug?

$
0
0

I'm trying to accomplish this using Visual Studio post-build events.

What I want to happen:

When I build in debug, I want to create a .nupkg like MyProject.1.0.0.xxxx-ci.nupkg, where xxxx is some auto-incrementing build number, and 1.0.0 is defined in my .nuspec file.

However when I build release, I want just a simple MyProject.1.0.0.nupkg using my nuspec.


I have a Development NuGet feed, and a Production NuGet feed that I'd like to push these to after build, which is why I ONLY want this extra build number to show up in Debug.

I've almost figured this out using [assembly: AssemblyVersion("1.0.0.*")] in AssemblyInfo.cs, but then my release build also gets that build number tacked on, and I don't want that.


Here's the code I have in post-build right now using just the nuspec and not AssemblyInfo.cs:

if "$(ConfigurationName)" == "Debug" (nuget pack "$(ProjectDir)$(ProjectName).nuspec" -Suffix cinuget push -Source http://myfeed.com/nuget/NuGet-Development "*.nupkg" )if "$(ConfigurationName)" == "Release" (nuget pack "$(ProjectDir)$(ProjectName).nuspec"nuget push -Source http://myfeed.com/nuget/NuGet-Production "*.nupkg" )

Is there some sort of way I can use -Version to do this?

I'm very very new to this all, so there's a good chance I'm just missing simple things, or have the wrong commands all together :)

Sorry in advance if my question isn't clear!


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>