Windows Administrator Installation
The setup-machine.ps1 PowerShell script is run whenever you or your users run the Diskuv OCaml installer.
"setup-machine.ps1" will ask for elevated Administrator permissions to
install the Microsoft C compiler (Visual Studio Build Tools). However,
if the script detects that the correct versions and components of Visual
Studio are already present on the machine, the installation is skipped
and no Administrator permissions are needed.
That leads to two different ways you as an Administrator can avoid giving your users Administrator permissions. Choose either "Method One" or "Method Two" in the sections below.
However, make sure you have a plan for disk space. The disk
requirements are: *
"setup-machine.ps1" will consume 2GB of disk
space installing Visual Studio * Each user can take up to 25GB of disk
space in their User Profile
"$env:LOCALAPPDATA\\opam") just for the initial Diskuv OCaml
distribution. That includes the OCaml compiler, Unix compatibility
tools, and a set of OCaml packages to let each user be productive
immediately after installation.
Method One - Pre-run setup-machine.ps1
You can download and run setup-machine.ps1 on behalf of your users, and then your users will not be asked for elevated Administrator permissions.
Specifically, after downloading
"setup-machine.ps1", you should run:
PS> .\setup-machine.ps1 -AllowRunAsAdmin
You can also use the
"-SilentInstall" switch if you need to automate
Method Two - Existing Visual Studio
Visual Studio specifications
If you have all four (4) of the following:
Visual Studio 2015 Update 3 or later for any of the following products:
- Visual Studio Community
- Visual Studio Professional
- Visual Studio Enterprise
- Visual Studio Build Tools (the compilers without the IDE)
If and only if you are using vcpkg (the C package manager) either because you are using DKSDK or because you used the
"setup-machine.ps1 -VcpkgCompatibility"option, you will need the English language pack.
Most open-source users of DkML will not need the English language pack.
Both of the following:
- MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.26)
"Microsoft.VisualStudio.Component.VC.14.26.x86.x64") which is used by OCaml to compile C code
- MSVC v142 - VS 2019 C++ x64/x86 build tools (Latest)
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64") which is used by vcpkg to compile C code
vcpkg does not have the ability pick a precise version (ex. 14.26) of Visual Studio. If you are in the rare situation where you must have exact matching versions of the compiler, you can install Visual Studio 2019 version 16.6 which can be downloaded at Visual Studio 2019 Releases. Use the VS2019 16.6 installer to install "MSVC v142 - VS 2019 C++ x64/x86 build tools (Latest)". Then you won't need to install "MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.26)".
- MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.26) (
Windows 10 SDK 18362 (
"Microsoft.VisualStudio.Component.Windows10SDK.18362") which is also known as the 19H1 SDK or May 2019 Update SDK.
then the Diskuv OCaml distribution will not automatically try to install its own Visual Studio Build Tools.
Chocolatey install of Visual Studio
If you use Chocolatey to manage Windows software on your machines or in your CI builds, then one of the following code blocks will satisfy all the requirements:
# Any 16.6.x.x will work. This code block is recommended # if you do not already install Visual Studio on your machines choco install visualstudio2019buildtools --version=188.8.131.52 ` --package-parameters "--addProductLang en-US --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK.18362" # This will also work, and is recommended if you already # install the latest Visual Studio 2019 choco install visualstudio2019buildtools choco install visualstudio2019-workload-vctools ` --package-parameters "--addProductLang en-US --add Microsoft.VisualStudio.Component.VC.14.26.x86.x64" # This will also work, and is recommended if you already # install the latest Visual Studio 2017 choco install visualstudio2017buildtools choco install visualstudio2017-workload-vctools ` --package-parameters "--addProductLang en-US --add Microsoft.VisualStudio.Component.VC.14.26.x86.x64" # This will also work with any 16.6.x.x version, although it # will install more packages than are strictly required. # This code block is not recommended, although GitLab CI, as of # September 2021, already includes the first line in its shared # GitLab Windows Runners. # But the shared GitLab CI may update the version at any time. choco install visualstudio2019buildtools --version=184.108.40.206 choco install visualstudio2019-workload-vctools
Manual installation of Visual Studio
The following installers allow you to add several optional components including the correct Windows 10 SDK:
It is common to have multiple versions of Windows 10 SDK installed. Don't be afraid to install the older Windows 10 SDK 18362.
Validating Visual Studio components
After you have installed all the required components of Visual Studio,
you can run
with the switch
"-SkipAutoInstallVsBuildTools" to verify you have a
correct Visual Studio installation:
Set-ExecutionPolicy ` -ExecutionPolicy Unrestricted ` -Scope Process ` -Force setup-machine.ps1 -SkipAutoInstallVsBuildTools
"setup-machine.ps1" script will error out if you are missing any