One way to build a custom DevTest Labs artifact to install Visual Studio 2019.
The public artifacts repo for DevTest Labs includes a Visual Studio artifact. But it only supports VS2015 and VS2017. The easiest way to work around this is to use the Chocolatey artifact with the “visualstudio2019enterprise” target. This only installs the core editor workload though and the Chocolatey artifact doesn’t allow specifying options.
For my team’s environment, we have a specific set of workloads and individual components that are generally needed. Specifying these all on the command line is a lot of text and it’s easy to make mistakes.
The solution I took was to make a custom artifact that uses Chocolatey and passes in a config file that specifies all the workloads and individual components needed. Here are the steps I took.
Export the desired Visual Studio 2019 configuration
Get VS2019 configured the way you want first. Then open the Visual Studio Installer.
Click More next to VS2019 and select Export Configuration. Save the resulting .vsconfig file to your new artifact folder.
Create the artifact file
Since my custom artifact doesn’t need customization, I used a base Artifactfile.json file.
I use the same iconUri as the public Visual Studio artifact. The command calls a PowerShell script to install the Chocolatey package.
Write the install script
I started by copying the install script from the public Chocolatey artifact. Then I removed the script parameters and changed the Install-Packages function.
The config file is passed to the Visual Studio installer via the
--config option. But this needs
to be wrapped in
--package-parameters so Chocolatey will send it to the installer.
The full file is in this Gist for convenience: