Is it possible to automatically upload a Nuget package to a feed when building a project using Visual Studio 2017 and .net core?
I can check the option to automatically generate the package, but I don't know how to automate the publish process.
Thanks!
The answer is yes. Since NuGet Command Line Interface (CLI) provides the full extent of NuGet functionality to install, create, publish, and manage packages.
https://docs.microsoft.com/en-us/nuget/tools/nuget-exe-cli-reference#push
We could add a target to execute the publish command line after Visual Studio generate package. In addition, when you check the option to automatically generate the package, you can notice that the target which generate the package is "
GenerateNuspec
" (MSBuild project build output verbosity->Detailed). So we could a target after the target "GenerateNuspec
"Right click project->Select Edit
projectname.csproj
->Add below scripts:Note: The exec command should be:
With this target, Visual Studio will automatically upload a Nuget package to a feed when building a project using Visual Studio: