Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an easy way to automatically create a NuGet package from a Visual Studio 2015 project?

Before Visual Studio 2015, it was trivial to setup your project to automatically generate NuGet packages. Specifically, you did:

  1. Add a .nuspec file to your project
  2. Enable NuGet Package Restore in the Solution right-click context menu
  3. Edit the project .csproj file and set the build property <BuildPackage> to true

And that was it!

However, starting from VS 2015, MSBuild-integrated package restore has been removed and replaced by the new Automatic Package Restore. While these are all good news, it seems that setting the build property <BuildPackage> to true no longer triggers an automatic package build.

This is a major break of functionality! Is there a way to setup automatic builds of NuGet without using post-build events? Specifically, I'm looking for an MSBuild solution, as it forms the backbone of my build workflow.

like image 608
glopes Avatar asked Jan 26 '16 13:01

glopes


1 Answers

Try OctoPack: https://www.nuget.org/packages/OctoPack/

Just add nuget package to your project.

If you want to build it every time you build release, add to section <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|Whatever' "> next line:

 <RunOctoPack>true</RunOctoPack>

More information about finetuning can be found here: https://github.com/OctopusDeploy/OctoPack

like image 182
Andriy K Avatar answered Sep 22 '22 01:09

Andriy K