Creating a Chocolatey package
I recently “converted” all of my installed apps over to using Chocolatey. I won’t dwelve too deeply into how much I love it, but let’s just say it’s a lot. It’s such a relief not having to hunt for executable files. There were packages for nearly all of the apps I use but some were missing so I added a few of them. The process is pretty straightforward.
Let’s say we have an app that’s called MyAwesomeApp
. First we need to create
a directory called myawesomeapp
and then create a nuspec
file in it with the
following content:
Then it’s time to create a chocolateyInstall.ps1
file and save it in another
directory inside the myawesomeapp
directory called tools
. Now, we could
technically do it as simple as this:
But I like adding a bit more functionality so instead we’ll use this:
This feels a bit nicer and it’s a hell of a lot easier to re-use, atleast for
me. After this we need to run cpack
in the root directory to create a nupkg
file and then cinst myawesomeapp -source %cd%
to test it. The last thing we
need to do is to upload the generated nupkg
file on the official
Chocolatey website. You could do this straight from
the PowerShell, but I haven’t done that yet.