First of all set the default TLS Version for .net to 1.2:

With Chocolatey a lot of things are easy to set up:

Now let’s modify visual studio and add some components, so that the node-gyp can compile popular packages. We could have used the windows build tools but they default to VS 2015 and the install location of python cannot be adjusted.

  • Visual Studio C++ core features Microsoft.VisualStudio.Component.VC.CoreIde
  • Windows Universal C Runtime Microsoft.VisualStudio.Component.Windows10SDK
  • Windows 10 SDK (10.0.16299.0) for Desktop C++ [x86 and x64] Microsoft.VisualStudio.Component.Windows10SDK.16299.Desktop
  • VC++ 2017 v141 toolset (x86,x64) Microsoft.VisualStudio.Component.VC.Tools.x86.x64

We will also utilize code generation using T4:

  • Text Template Transformation Microsoft.VisualStudio.Component.TextTemplating

The new MsBuild Project  SDKs requires the installation of .NET Core components of Visual Studio. Otherwise you’ll receive errors like “Error MSB4236: The SDK ‘Microsoft.NET.Sdk’ specified could not be found.”. Additionally we will add the .NET Framework targeting packs to build against several frameworks:

  • .NET Core runtime Microsoft.Component.NetFX.Core.Runtime
  • Microsoft.Net.Core.Component.SDK .NET Core 2.0 development tools
  • Microsoft.NetCore.ComponentGroup.DevelopmentTools .NET Core 2.0 development tools

The next issues arise: Visual Studio installer is lacking the –wait argument on the command line. So we need to start it as a new process and wait:

Next update Visual Studio to its latest version:

For Windows Installer XML Toolset we also want the Wix Toolset Visual Studio 2017 Extension to be installed. So we download the latest version from the Visual Studio Marketplace and install it silently:

For python we need to add the install location to the path variable:

Using NPM we nee to install the following packages globally:

And finally all together - the final script:

HTH