-
Notifications
You must be signed in to change notification settings - Fork 891
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows MSVC: automate installing Visual Studio components #2947
Comments
This sounds like a very clever way to deal with this. If you think you can drive this functionality forward then it would be nice to have; though I don't know how easily we'd be able to CI this. |
A simple improvement to start with might be to update the instructions to tell the user how to run the Visual Studio Installer from the command line with the C++ workload pre-selected. For example: Using winget: winget install --id Microsoft.VisualStudio.2022.Community --override "--add Microsoft.VisualStudio.Workload.NativeDesktop;includeRecommended --focusedUi --wait" If winget is not available then powershell can be used: Invoke-WebRequest https://aka.ms/vs/17/release/vs_community.exe -OutFile "$env:TEMP\vs_community.exe"
&"$env:TEMP\vs_community.exe" install --add "Microsoft.VisualStudio.Workload.NativeDesktop;includeRecommended" --focusedUi
rm "$env:TEMP\vs_community.exe" The availability of winget could be probed by rustup by attempting to run |
Certainly sounds like an approach - kinda hard to test for me, but perhaps someone with experience spooling up windows VMs will be able to give this a go. I'll be around here and on Discord if someone wishes to tackle this. |
Ok, so based on feedback to #2954 the following issues were identified:
|
I tried windows installation of rustup v1.25.0. How about usage of BuildTools installer? |
The problem is the licensing. See #2867 |
I understand it. Thanks. |
@ChrisDenton Do you believe this can now be closed? |
Yep! If there are any problems it would make sense to track them as new issues. |
Problem you are trying to solve
Using Rust for
msvc
toolchains requires some components from Visual Studio to be installed: However, this requires the user to download the vs installer and select the correct components. This can be a source of friction for new users.A good, regularly updated, install guide would help but it'd be great if rustup itself could ease the install process.
Solution you'd like
I would suggest this workflow:
Alternatively rustup could just do the second bullet point. The user would have to manually install Visual Studio but rustup would be able to fix anything missed by the user. In any case, this might be a good first step if this feature request is accepted.
Notes
Rustup already has logic to prompt the user to install Visual Studio if necessary.
The Visual Studio installer can be downloaded by using winget (if installed) or via
https://aka.ms/vs/17/release/vs_community.exe
.The install can be automated using command line arguments. It can be run either with a GUI (where rustup can set the components to be installed by default) or in "quiet" mode without a GUI or user interaction. In the latter case, the license terms would need to be linked by rustup itself.
If Visual Studio is installed but components are missing then
vswhere
can be used to find the existing installer, which in turn can be used to install missing components. Fortunately Visual Studio installs vswhere to a stable location so this should be easy to find. Alternatively there is a COM interface that can be used to query Visual Studio directly. This is what cc-rs uses internally so perhaps features could be added to that crate to support this use case.The text was updated successfully, but these errors were encountered: