Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get version number in post-build event

I want to use post-build event to automatically create a nuget package and then copy it to a shared folder on our network, something like this (the version number 1.0.0.0. is specified inside the MyLib.nuspec file):

nuget.exe pack "$(SolutionDir)MyLib.nuspec"
xcopy /Y "$(TargetDir)MyLib.1.0.0.0.nupkg" \\folder\subfolder\NuGetPackages

This works, but now I would like to update this script, so that it would include the assembly version also, but I cannot get assembly version inside the post-build event. I would need something like this:

nuget.exe pack -Version $(AssemblyVersion) "$(SolutionDir)MyLib.nuspec"
xcopy /Y "$(TargetDir)MyLib." + $(AssemblyVersion) + ".nupkg" \\folder\subfolder\NuGetPackages

But the $(AssemblyVersion) variable does not exists... Any ideas?

like image 806
sventevit Avatar asked Sep 20 '11 14:09

sventevit


1 Answers

This post build script works for me. It packages and publishes my dev versions on each build. Pretty simple.

del $(ProjectDir)bin\Debug\*.nupkg
"$(ProjectDir)NuGet.exe" pack "$(ProjectDir)MyProject.csproj"
forfiles /P $(ProjectDir)bin\Debug\ /m *.nupkg /c "cmd /c "$(ProjectDir)NuGet.exe" push @FILE -Source \\SHARE\NuGet"
like image 144
Papa Burgundy Avatar answered Sep 24 '22 19:09

Papa Burgundy