Click here to Skip to main content
15,887,477 members
Articles / Operating Systems / Windows

Configuring a Chocolatey Install

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
27 Oct 2014CPOL1 min read 6.1K   3   1
Configuring a Chocolatey install

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 Smile with tongue out.

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.

2014-10-28_08-18-26

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

2014-10-28_08-18-52

The contents of the script were as below:

JavaScript
[string]$ScriptDir = Split-Path $MyInvocation.MyCommand.Path -Parent
[string]$copyTo = "$([System.Environment]::GetFolderPath
("mydocuments"))\Visual Studio 2013\Visualizers"
[string]$mainAssemblyPath = "$ScriptDir\..\..\lib\net45\*.*"
[string]$binDependenciesAssemblyPath = "$ScriptDir\..\binDependencies\*.*"
if (!(Test-Path -LiteralPath $copyTo))
{
    New-Item -Path $copyTo -ItemType directory
}
Copy-Item -Path "$mainAssemblyPath" -Destination "$copyTo" -Force
Copy-Item -Path "$binDependenciesAssemblyPath" -Destination "$copyTo" -Force

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 Smile with tongue out). 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.

choco install dotnetpretty -pre

and then navigated to the Visualizers folder and my new assemblies were there. Smile

2014-10-28_08-24-11

If you have any feedback or a better way to perform this install, do let me know. Open-mouthed smile

This article was originally posted at http://31og.com/post/configuring-a-chocolatey-install

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect SSW
South Africa South Africa

Comments and Discussions

 
QuestionI know this is an old article, but I could use a clue Pin
knockNrod10-Nov-17 4:16
knockNrod10-Nov-17 4:16 
I've a package (logexpert) that I'd like to update. The original poster is no longer using chocolatey or the package, which grows further out of date. He's made me a maintainer, but I can't figure out how to download the existing package. There's some information on how to create a new one, but nothing I can find on how to maintain (update) an existing one. So, even though this is an old article, and you very well may have moved on to bigger and better things, it's the only article I can find here.

I'm going to try to create a new package, and then I'll see what happens if I upload it over top of the old package name. It just seems like this should be a simple matter of pointing the package installer to a new package link, maybe adding the newer checksum hashes or whatever, but I can't find anything.
Without darkness, there are no dreams.
-Karla Kuban

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.