How to get Visual Studio 2019 Build Tools for Offline Install

When running Rust on Windows targeting the MSVC, rustup will helpfully prompt to install the Visual Studio 2019 Build Tools from Download Visual Studio Tools - Install Free for Windows, Mac, Linux.

This works fine for machines directly connected to the Internet (a small web installer downloads the necessary files), but what about machines wanting to compile Rust that don't have a direct Internet connection? Is there an easy way to bootstrap that in this situation, for example downloading a single zip file or executable installer that has only the C++ build tools?

2 Likes

I also have the same task.
When i try to download this pack from miscrosoft - it downloaded only installer, installed it to the system and then propmted me to install the main pack of 3.9 Gb size!!!! Is it really necessary to install such huge pack of ... what???

And how to simplify this without direct internet connection?

So i can't install Rust because i can't install build tools directly - what should i do???

Maybe the solution is to migrate to clang-cl instead? Since it is MSVC compatible, and both Google and Mozilla use it for Chrome and Firefox correspondingly.

See https://github.com/rust-lang/rust-forge/blob/master/cross-compilation/to-windows.md for more information.

1 Like

Using clang-cl does not eliminate the need for the rest of the VC++ toolchain as LLVM is not a complete toolchain on its own. The VC++ and Windows SDK libraries are still required to link Rust binaries.

Is this a hard requirement that's going to stay, or just a matter of not having enough components/features shipped with Rust yet?

I recall there was some work to link with Windows DLLs directly, instead of via intermediate .lib file. Will that help, at least for "hello world" exes?

VC++ will remain a hard requirement for the -msvc toolchain. In order to be compatible with VC++ compiled code, we have to link to the VC++ CRT, which requires installing VC++ as there is no way we can ship that with Rust nor create a replacement.

The recent work to link to DLLs without import libraries is https://github.com/rust-lang/rust/issues/58713. What it will enable is a new pure Rust toolchain using lld, without any C bits involved.

3 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.