New in Visual Studio 2017 is the ability to generate a NuGet package on build for some target types (namely, .NET Standard 2.0
which is what I'm using).
This works great, and the .nupkg
file is generated on successful build.
However, I'm not able to figure out how to get the built package automatically published to our local repository.
I already tried a post-build event of:
nuget push -Source https://my.nuget.server/nuget/ "C:\Source\MyProject\bin\Release\MyProject.1.0.0.nupkg"
But this presents 2 problems:
- The name of the package includes the version number and this isn't available as a post-build event variable, so I can't say, for example,
nuget push $(NugetPackage)
. I also can't figure out a combination of macros/variables that would get me the package name effectively. - The automatic NuGet packaging process occurs after the post-build event, so at the time of post-build, the package has not even been generated yet!
Microsoft has provided this kick-ass automatic NuGet packaging, but no way to push it to a local repository (or so it seems)!
Has anyone gotten this to work? Am I missing something? Is there a workaround? Is this something being worked on?