Introduction

If you are using Chocolatey and you would now like to make a package of your own program to make it available through Chocolatey then you need to go through a few steps. Here is how I did it for ChocolateyGUI.

But you can also watch the video ferventcoder has put up on youtube.

WarmUp

First I installed WarmUp via Chocolatey of course.

cinst warmup

Or in my case I just used the GUI.

Then I downloaded the nugetpackages from ferventcoders github account and copied the Chocolatey folder in the _template folder to c:/CODE/_templates which will give you something like this.

And now you can do the commandline thing and prepare your package easily.

You will now find that it has created a package in your user folder.

The package

We now have to change the nuspec file. To this.

xml <?xml version="1.0"?> <package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <metadata> <id>ChocolateyGUI</id> <title>ChocolateyGUI</title> <version>0.0.1</version> <authors>Christiaan Baes</authors> <owners>Christiaan Baes</owners> <summary>A GUI for Chocolatey</summary> <description>ChocolateyGUI | Please install with chocolatey (http://nuget.org/List/Packages/chocolatey).</description> <projectUrl>https://github.com/chrissie1/chocolatey-Explorer</projectUrl> <tags>ChocolateyGUI chocolatey admin</tags> <licenseUrl>http://www.apache.org/licenses/LICENSE-2.0</licenseUrl> <requireLicenseAcceptance>false</requireLicenseAcceptance> </metadata> </package> And I also added a License.txt to the content folder.

Then I copied my MSI-file into the tools folder.

Now it is time to change the chocolateyinstall.ps1.

Mine looks like this.

xml try { $scriptPath = $(Split-Path $MyInvocation.MyCommand.Path) $nodePath = Join-Path $scriptPath 'SetupChocolateyGUI.msi' Install-ChocolateyInstallPackage 'ChocolateyGUI' 'msi' '/quiet' $nodepath Write-ChocolateySuccess 'ChocolateyGUI' } catch { Write-ChocolateyFailure 'ChocolateyGUI' "$($_.Exception.Message)" throw } After you have done all this. You have to pack it up with nuget.

and now we should be able to test our package.

And, woohoo, our program is installed.

Now I just need to upload the nupkg file to thocolatey.org and let you guys play with it.

And here it is.

Conclusion

This was all pretty easy to do. And it works. Go ahead try it out.