Published on

Configuring a Chocolatey Install

Authors
  • Name
    Twitter

So yesterday I posted Pushing a new project to Chocolatey and I said I would create another post showing how to configure how the Chocolatey install runs and this is that post ๐Ÿ˜œ.

ChocolateyInstall.ps1

The first (only really) step to do this is creating a ChocolateyInstall.ps1 script. From looking at other packages I saw that there was a file like this in a tools folder so I created one for myself in my DotNet Pretty project

ChocolateyInstall.ps1 in Visual Studio Solution Explorer
Figure: ChocolateyInstall.ps1 file added to the tools folder in the DotNet Pretty project

and set the Build Action to Content and Copy to Output Directory to Copy Always

Properties for ChocolateyInstall.ps1
Figure: Properties for ChocolateyInstall.ps1 set to Content and Copy Always

The contents of the script was as below

Basically doing the exact same thing as what I was doing with the DEBUG post build event in the project settings

I checked that in (over a couple of commits because I didn't get it right the first time ๐Ÿ˜œ). MyGet picked up the new commit and performed a build for me. Instead of waiting for my hourly push of packages to Chocolatey from MyGet I just pushed the package as I did in the previous post. I then ran the Chocolatey install for my package

and then navigated to the Visualizers folder and my new assemblies were there ๐Ÿ™‚

Visualizers folder with new assemblies
Figure: Visualizers folder showing newly copied assemblies after Chocolatey install
ย 

If you have any feedback or a better way to perform this install do let me know ๐Ÿ˜