Open ctaggart opened 6 years ago
I created a script. I'm currently calling it Add-VisualCpp.ps1
. It must be run ad admin:
# start Visual Studio Installer to add the Rust dependencies
# currently just Visual C++
# get the latest Visual Studio installation path
$installationPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath
# install VC++
& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vs_installershell.exe" modify `
--installPath $installationPath `
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64
Unfortunately, rustup-init.exe
still does not detect it. I wonder which components it is detecting.
It doesn't really matter which VC++ toolset version you use, or which Universal CRT version you use, or which Windows SDK version you use as long as you have all three of them. However, it is generally better to have the newest versions when possible. https://github.com/rust-lang-nursery/rustup.rs/issues/1003#issuecomment-289825927
Based on this, I installed this two items and it worked.
Now I just need to update the script.
I don't know what the component name is for Windows Universal C Runtime
. I'm not sure it was required. I'm hoping Microsoft.VisualStudio.Component.Windows10SDK
is just an alias for the latest, currently Microsoft.VisualStudio.Component.Windows10SDK.17134
.
This does the trick:
# start the Visual Studio Installer to install Rust dependencies
# current component names are:
# VC++ 2017 version 15.7 v14.14 latest v141 tools
# Windows 10 SDK (10.0.17134.0)
# get the latest Visual Studio installation path
$installationPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath
# launch the installer (must be admin)
& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vs_installershell.exe" modify `
--installPath $installationPath `
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
--add Microsoft.VisualStudio.Component.Windows10SDK
See here: https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-community
Looks like the unversioned Microsoft.VisualStudio.Component.Windows10SDK
component is actually the "Windows Universal C Runtime`, whilst the versioned ones are the actual SDK.
It should be possible to run a command to install the C++ dependencies required by Rust.
rust-init-exe
could actually check kick offvs_installershell.exe modify
.Finding installed Visual C++ tools for Visual Studio 2017 https://blogs.msdn.microsoft.com/vcblog/2017/03/06/finding-the-visual-c-compiler-tools-in-visual-studio-2017/
trust PSGallery
install
VSSetup
if not alreadyIt should be a simpler version of: https://github.com/Microsoft/visualfsharp/blob/master/scripts/Add-VisualStudioComponents.ps1
Visual Studio Where
latest install path
Visual Studio Installer