Creating a headless Windows Server 2016 VM for CI/CD using VSTS

Setting up Visual Studio Build Tools 2017

Recently wanted to setup a Windows Server Core VM/image for portability. It's mainly used to build ASP.NET MVC web apps on the full .NET Framework which would then need to be deploy to Azure. Just documenting the steps I took along the way.

# Download and install VS Build Tools
Invoke-WebRequest https://aka.ms/vs/15/release/vs_buildtools.exe -OutFile vs_buildtools.exe ;
Start-Process -FilePath 'vs_BuildTools.exe' -ArgumentList `
  '--quiet', '--norestart', '--locale en-US' `
, '--add Microsoft.VisualStudio.Workload.NetCoreBuildTools' `
, '--add Microsoft.VisualStudio.Workload.WebBuildTools' `
, '--includeOptional', '--includeRecommended' -Wait ;

References

Other Workloads
Installer CLI Docs
Installer CLI Examples

Setup Installers

# Install chocolatey
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

# Choco setup
choco feature enable -n allowGlobalConfirmation

Setting up other dependencies

My builds require Web Deploy and NodeJS so let's install them using Chocolatey

choco install git 
choco install webdeploy
choco install nodejs-lts
choco install nuget.commandline

Next steps

Would like to containerize this image with exposable environment variables such as VSTS URLs, PAT etc.