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 sp
I tried what giammin suggested, and with a few tweaks got this working for me:
I added the "Condition attribute so that I could specify when I would have this built to a specific location (in my case creating a backup for rollbacks). Also, the "xcopy" was giving me errors...but a normal "copy" was not.
Then, in my post-build event I have something like this:
copy $(TargetDir)*.dll \\dev-server\folder
IF NOT "$(ConfigurationName)" == "Stage" EXIT
mkdir "$(ProjectDir)Versions"
copy /Y "$(TargetPath)" \\stage-server\folder
I hope that all helps in some way.
Note that the post-build event is executed BEFORE the "AfterBuild" element of the csproj XML.
So you could just use in you post build event: nuget.exe pack "$(SolutionDir)MyLib.nuspec" and add the afterbuild element for the copy and you should be fine.