Jim Bennett
Xamarin MVP Microsoft MVP

Mobile developer at EROAD, Xamarin MVP and Certified Developer, Microsoft MVP, author of Xamarin In Action, blogger, speaker, father and lover of beer, whisky and Thai food. Opinions are my own.

  Auckland, New Zealand
See me soon at:
NDC Sydney 2017
Xamarin In Action
  Xamarin In Action
  Twitter
  GitHub
  LinkedIn
  YouTube
  Email
  CV

One cool new feature in Visual Studio for Mac is the ability to create NuGet packages from your projects automatically whenever you compile. This new feature is thanks to a cool project started by Xamarin called the Nugetizer 3000 (I do love Miguel's naming conventions).

Nugetizer 3000

It's really easy to turn this on. From your project open the project properties and head to the 'NuGet Package -> Build' tab. From there tick the 'Create a NuGet package' box.

Tick the 'Create nuget package' box in the NuGet build tab of the project properties

Once this is ticked you need to set up the metadata for your package, and this can be done from the metadata tab. You have to fill in everything in the 'General' tab, and you can optionally fill in the 'Details' tab.

Add all the required NuGet metadata

Once you click 'OK', Visual Studio will add a new NuGet package to your project - NuGet.Build.Packaging. This package doesn't contain any assemblies, it just contains build targets to create the NuGet package.

Once this package is installed you can compile your project and it will spit out a nupkg file in the projects output directory. This package has everything all set up for it, including dependencies on all the packages and framework libraries used by your project.

This makes package creation easy as there is no faffing around with nuspec files and command lines. You can even control values such as the version by configuring project properties when calling MSBuild from the command line, very useful if you want to tweak the version number at build time.




About the Author

Jim Bennett

International C# and Xamarin geek - Microsoft MVP, Xamarin MVP and Certified Developer, blogger, speaker, father and lover of beer, whisky and Thai food

 

One cool new feature in Visual Studio for Mac is the ability to create NuGet packages from your projects automatically whenever you compile. This new feature is thanks to a cool project started by Xamarin called the Nugetizer 3000 (I do love Miguel's naming conventions).

Nugetizer 3000

It's really easy to turn this on. From your project open the project properties and head to the 'NuGet Package -> Build' tab. From there tick the 'Create a NuGet package' box.

Tick the 'Create nuget package' box in the NuGet build tab of the project properties

Once this is ticked you need to set up the metadata for your package, and this can be done from the metadata tab. You have to fill in everything in the 'General' tab, and you can optionally fill in the 'Details' tab.

Add all the required NuGet metadata

Once you click 'OK', Visual Studio will add a new NuGet package to your project - NuGet.Build.Packaging. This package doesn't contain any assemblies, it just contains build targets to create the NuGet package.

Once this package is installed you can compile your project and it will spit out a nupkg file in the projects output directory. This package has everything all set up for it, including dependencies on all the packages and framework libraries used by your project.

This makes package creation easy as there is no faffing around with nuspec files and command lines. You can even control values such as the version by configuring project properties when calling MSBuild from the command line, very useful if you want to tweak the version number at build time.