Boxstarter guide for Windows development, 2018 edition

It’s been over 3 years since I wrote Automating setup of your windows development environment for fun and profit and a lot has changed in that time.

For instance, <sobs>

But enough about that, let’s talk about Boxstarter. The core concepts I described in the original post have not changed, but I did have to do some tweaking of my sample script in order to account for new bugs and updated software packages.

A note on Azure VMs

Spinning up a Windows 10 Virtual Machine in Azure is ridiculously easy right now. If you can afford it (and remember to deallocate your VM every night) then it is a very low-impact and low-maintenance way to get a dev VM up and running. If you want to know more then i’ll walk you through the process, otherwise skip to the next section.

  1. Assuming you already have an Azure account, go to the Virtual Machines blade, and “Create virtual machine”.
  2. I’d suggest creating a new resource group for the Virtual Machine, just to make it easy to tear down
  3. Select the “Windows 10 Pro, Version {latest}” Image
  4. Select “Allow selected ports”, and check “RDP (3389)”
  5. Set the auto-shutdown time that works for you
  6. Set any other options as you need, then create the VM – it’ll probably take a few minutes before you can connect to it

Updated guidance for Boxstarter in 2018

So you’re logged into a fresh machine, now what?

Follow the guidance from the original post, with the following changes:

2. Write the install script

Here’s the updated sample scripts.

I now recommend using choco upgrade instead of choco install (AKA cup instead of cinst), as upgrade will install or upgrade an older existing version. If you’re starting with a pre-made VM image, then it might already have some items installed.

At the time of writing, there is a bug with Boxstarter & Chocolatey where the temp file directory keeps getting larger and larger, eventually failing the installs because the path gets too long. To fix it,

Add this code once, prior to any chocolatey calls
$ChocoCachePath = "$env:USERPROFILE\AppData\Local\Temp\chocolatey"
New-Item -Path $ChocoCachePath -ItemType Directory -Force

Add the cacheLocation parameter to all choco install or upgrade commands
choco upgrade --cacheLocation="$ChocoCachePath" visualstudio2017enterprise

4. Install Chocolatey

Skip this, you can install Chocolatey and Boxstarter at the same time with a single command:

5. Install Boxstarter

Set-ExecutionPolicy Unrestricted -Force
. { iwr -useb } | iex; get-boxstarter -Force

Exit the current Powershell window, and run “Boxstarter Shell” – it’s Powershell with the Boxstarter modules already loaded.

Everything else is still valid

With those tweaks I was able to get my Boxstarter script working again. In case you’re interested, here’s my stats from the 2018 run:

  • The complete run with an Azure Win 10 VM with SSD took 1h20m. That’s 19 apps including Visual Studio 2017, and 6 Windows Updates
  • Only 4 reboots (all unattended)

One thought on “Boxstarter guide for Windows development, 2018 edition

  1. Pingback: Automating setup of your windows development environment for fun* and profit** |

Leave a Reply