Skip to content

Commit 3fddd25

Browse files
authored
Merge pull request #3060 from ChrisDenton/install-msvc
Improve Windows MSVC install instructions
2 parents 8f9d87b + 3fa3a9c commit 3fddd25

File tree

12 files changed

+78
-24
lines changed

12 files changed

+78
-24
lines changed

doc/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[Introduction](index.md)
44
- [Installation](installation/index.md)
55
- [Windows](installation/windows.md)
6+
- [MSVC Prerequistes](installation/windows-msvc.md)
67
- [Other installation methods](installation/other.md)
78
- [Package managers](installation/package-managers.md)
89
- [Concepts](concepts/index.md)
22.3 KB
Loading
19.4 KB
Loading

doc/src/installation/images/step1.png

6.6 KB
Loading

doc/src/installation/images/step2.png

4.25 KB
Loading

doc/src/installation/images/step3.png

41.4 KB
Loading

doc/src/installation/images/step4.png

21 KB
Loading

doc/src/installation/images/step5.png

17.3 KB
Loading

doc/src/installation/windows-msvc.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# MSVC prerequistes
2+
3+
To compile programs into an exe file, Rust requires a linker, libraries and Windows API import libraries.
4+
For `msvc` targets these can be acquired through Visual Studio.
5+
6+
## Automatic install
7+
8+
If you don't have Visual Studio already installed then [rustup-init] will offer to automatically install the prerequisites.
9+
Doing so means you can skip the rest of this page.
10+
However, it installs Visual Studio Community edition which may not be appropriate for all users.
11+
12+
## Manual install
13+
14+
[Download Visual Studio][vs downloads].
15+
Rust supports Visual Studio 2013 and later but it is recommended that you use the latest version (currently 2022) for new projects.
16+
You can opt to download only the Build Tools for Visual Studio, which does not include the IDE.
17+
However this requires you already have a license to the Community, Professional or Enterprise edition.
18+
19+
Once you've downloaded and started the installer, the easiest way to get everything installed is to select "Desktop Development with C++".
20+
This will include the necessary components.
21+
On the "Language Packs" tab, make sure the English language pack is installed in addition to your preferred language.
22+
23+
If you want more details on the installation process or want to further customize the install then follow the walkthrough below.
24+
Otherwise complete the Visual Studio install and continue with installing Rust.
25+
26+
## Walkthrough: Installing Visual Studio 2022
27+
28+
This walkthrough uses the Community edition of Visual Studio but the Professional, Enterprise and the Build Tools all work the same way.
29+
30+
The installer will start by linking to the [license][vs licences] and for your edition of Visual Studio and then preparing the installer.
31+
32+
![Accept the license](images/step1.png)
33+
![Installing the installer](images/step2.png)
34+
35+
Once this finishes, you can then select the components to be installed.
36+
Here we use the "Workload" tab to select the "Desktop Development with C++" workload.
37+
This will includes all needed components for Rust:
38+
![Select the C++ Workload](images/step3.png)
39+
40+
### Installing only the required components (optional)
41+
42+
If you'd like a more minimal install (and won't doing C++ development) then you can use the "Individual Components" tab to select just the essentials, which are:
43+
44+
* MSVC v143 - VS 2022 C++ x64/x86 build tools (Latest)
45+
* Windows 11 SDK (10.0.22621.0)
46+
47+
Note that the specific version of the Windows SDK doesn't matter for pure Rust code but if using C++ as well you'll likely want either the latest or whichever version is required by the C++ project (or both).
48+
49+
![Select the latest MSVC component](images/component-msvc.png)
50+
![Select the Windows 11 SDK component](images/component-sdk.png)
51+
52+
### Completing the install
53+
54+
After choosing the components, switch to the "Language Packs" tab and add the English language pack in addition to your preferred language.
55+
56+
![Add the English language](images/step4.png)
57+
58+
Finally click the install button and wait for everything to be installed.
59+
60+
![Wait for the install to complete](images/step5.png)
61+
62+
Once finished, you can continue on to installing Rust.
63+
64+
[rustup-init]: https://rustup.rs
65+
[vs downloads]: https://visualstudio.microsoft.com/downloads/
66+
[vs licences]: https://visualstudio.microsoft.com/license-terms/

doc/src/installation/windows.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,8 @@ Visual Studio use the MSVC build of Rust; for interop with GNU software built
1010
using the [MinGW/MSYS2 toolchain] use the GNU build.
1111

1212
When targeting the MSVC ABI, Rust additionally requires an [installation of
13-
Visual Studio 2013 (or later) or the Visual C++ Build Tools 2019][vs] so
14-
`rustc` can use its linker and libraries. The Visual C++ Build Tools require a Visual
15-
Studio license (either Community, Pro, or Enterprise).
16-
17-
For Visual Studio, make sure to check the "C++
18-
tools" and "Windows 10 SDK" option. No additional software installation is
19-
necessary for basic use of the GNU build.
13+
Visual Studio][msvc install] so `rustc` can use its linker and libraries.
14+
No additional software installation is necessary for basic use of the GNU build.
2015

2116
By default `rustup` on Windows configures Rust to target the MSVC ABI, that is
2217
a target triple of either `i686-pc-windows-msvc`, `x86_64-pc-windows-msvc`, or `aarch64-pc-windows-msvc`
@@ -68,5 +63,4 @@ targets with the same compiler.
6863
[MinGW/MSYS2 toolchain]: https://msys2.github.io/
6964
[msvc-toolchain]: https://www.rust-lang.org/tools/install?platform_override=win
7065
[toolchain specification]: ../concepts/toolchains.md#toolchain-specification
71-
[Visual Studio]: https://visualstudio.microsoft.com/visual-cpp-build-tools/
72-
[vs]: https://visualstudio.microsoft.com/downloads/
66+
[msvc install]: windows-msvc.html

0 commit comments

Comments
 (0)