Today my DotNet Pretty articles were featured on @coding4fun by Greg Duncan and one of the comments by Niner bc3tech (@bc3tech) requested that I share this solution on Chocolatey. I decided that this was a good idea and decided to share my experience Smile.

Creating a Chocolatey Account

Creating the Chocolatey account was as simple as filling a couple of common fields at https://chocolatey.org/account/Register.


In the registration mail you are given a link to Rules to be observed before publishing packages which mentions that you can host your packages with MyGet


Creating a MyGet Account

Heading over to MyGet I saw that they had a Free subscription


But they also have an offer for MVP's, ASPInsiders, Windows Azure Insiders and ALM Rangers Smile. Fitting into 2 of these categories now I decided to head over to https://www.myget.org/mvp and request a NFR license Open-mouthed smile. The extra features available on this subscription made it perfect for my community project (and ones to follow Smile). In no time I had my DotNet Pretty Package Feed up.

MyGet Build Services

The DotNet Pretty project is currently hosted out on GitHub and so I decided that I'll try out MyGet's build services which is now in preview. This was as simple as clicking on BUILD SERVICES from the menu and then on Add build sources and then from GitHub.


this poped open the Link build source dialog where I selected the DotNet Pretty project from the list and clicked Add.


From here I clicked Build and in no time the build completed


2014-10-27_18-54-50 and I had a package hosted in MyGet



Updating GitHub project to show MyGet build status

From the build services page I was able to click on copy markdown


which gave me the markdown that I could insert into the readme.md file which I did with my new favorite Markdown editor MarkdownPad 2


A quick commit added this status to the public project on GitHub


Pushing the packaged to Chocolatey

The next thing I needed to do was add a new package source to my MyGet package feed Chocolatey. I went over to the Package Sources menu and clicked on Add package source and the NuGet feed.


The next bit was very simple, I simple clicked on Presets and then Chocolatey


This then went ahead and filled in the Name and Source for me


All that was left to do was provide my Chocolatey which was my Username, Password and API Key. I also filled in some of the extra meta data for my source


Next I headed over to build services again and clicked on Push upstream


this presented a window like below


where I just clicked on Push


And received the message saying they on it Open-mouthed smile. Headed back over to Chocolatey and my package was in the list


Installing Chocolatey "Client"

On the machine I'm using I didn't have Chocolatey installed so opened up a PowerShell Command Window as Administrator (just for in case Smile) and ran the command

iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))

Installing my package

To test if my package was installer I ran the command below

choco install DotNetPretty -Pre 

which confirmed that my package now now been installed


At this point my Chocolatey package "installs" by dropping the package contents in the Chocolatey folder


In a later post I will share how to configure the installation logic for a Chocolatey script.

Update: The post can be found here (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.


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


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


The contents of the script was as below

[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


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


So you shouldn't need to do this but in my case for some reason I needed to activate windows after performing and upgrade from Windows 8.1.

In my case I tried activating Windows by clicking on Activate Online and that didn't work for me. I managed to activate Windows 10 by entering the product key for enterprise.


Windows 10 Pro Key: NKJFK-GPHP7-G8C3J-P6JXR-HQRJR

Windows 10 Enterprise Key: PBHCJ-Q2NYD-2PX34-T2TD6-233PK

You can download bat files that set the key from my GitHub gists using the links below

Activate Pro Gist: http://31og.com/gist/fc85f772fbc35c470f7d

Activate Enterprise Gisthttp://31og.com/gist/b49470b9ba1cf861d56c 

You should be able to find these on the preview site as well. Hopefully this is useful for someone else as well Smile


In windows 10 when you go to Change the background and colors on Start


it loads up the Color and Appearance window


which does let you change the accent and background color for windows. So you stuck with that weird purple looking theme or I managed to get blue type color on one of my machines. After a quick Bing I found that you can just set 2 registry entries restart your pc and you now have theme color that you want Smile.

Basically you need a registry file with the contents below (save that into a .reg file), set the hex values for your color and then run it.

   1: Windows Registry Editor Version 5.00
   3: [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Personalization]
   4: "PersonalColors_Accent"="#00b8ff"
   5: "PersonalColors_Background"="#000000"

You can also download this reg file from GutHub using https://github.com/Gordon-Beeming/ChangeWindowsTheme/blob/master/Downloads/set-theme-colors.reg and you can download an app that takes in the 2 hex values and then set it, you will need to run the app as administrator otherwise it will crash. https://github.com/Gordon-Beeming/ChangeWindowsTheme/blob/master/Downloads/ChangeWindowsTheme.exe


The app lets you preview the theme before setting it because you will need to restart after editing the registry to see the changes


I need a VSO account for Demos which needs to be separate from my personal and business VSO accounts. The problem is though if you go to the Visual Studio Online page and click Get started for free


and then sign in with your existing account details you are directed to your VSO profile page that shows all your VSO accounts.


So what do you do?

The first thing you are going to need to do is create another Microsoft Account (Live ID). At this point I'd recommend starting a new In-Private browsing session so that you aren't automatically logged into services. Head over to https://account.live.com/ and create a new Microsoft Account or you can head directly to http://www.visualstudio.com/ and create a Microsoft Account as part of your VSO Account creation.

I created my Microsoft Account before continuing to create my VSO account.

Creating a new VSO Account

Go to http://www.visualstudio.com/ and click on the Get started for free button. Enter an account name and click Create Account.


You now have a new VSO account Smile.

Adding a new User to your VSO Account

From the new accounts landing page which should look like below


Click on the Users tab in the main navigation


Enter your primary VSO account Sign-in address (that you want to link this account to) and choose the License that this user must get and then click Send Invitation.


At this point you will be able to log into the new VSO account with your primary VSO account.

Switching your VSO account Ownership

The last thing we need to do is switch the ownership of our new VSO account. Ideally for most Demos you would want to be the owner of the VSO account. To change the owner of a VSO account click on the Settings icon in the top right


Then click on the Settings tab


Choose the owner account (your primary VSO account for this example) and click Save.


Deleting a user from VSO

At this point you'd be able to delete the user from the demo account that you used to create the account with. You might want to do this if you for one need to use your 5 basic users free accounts for other demo users or if you want to repeat the steps in this post and don't want to create another Microsoft Account to do it with. To delete the user your create simply select them in the users screen and then click Delete.


You'll be asked if you are sure, click Delete User.


You now have a new VSO account linked to your primary Microsoft Account so you don't have to use different sign-in accounts for demos and your other VSO accounts that you may be apart of Smile