Getting started with Rust in Visual Studio Code
See how to set up a Rust development environment on your Windows machine using Visual Studio Code.

Interested in learning Rust? Rust is becoming increasingly popular, largely due to its built-in memory safety and phenomenal performance. With some of the world’s largest companies like Microsoft and Amazon adopting Rust in their own organisations, and supporting the development community, Rust is well on its way to becoming one of top used languages over the next 5 years.¹ For more information on Rust, have a look at the official site: Rust Programming Language (rust-lang.org)
You don’t need an IDE to develop in Rust, a text editor will suffice, but who doesn’t like having cool things like IntelliSense, and integrated source control, am I right? This article will show you how to set up a development environment for Rust by following these steps:
- Install Visual Studio Code
- Install Microsoft C++ Build Tools
- Install Rust
- Install Rust Extension for Visual Studio Code
- Create and Run a Basic Rust App
Install Visual Studio Code
Visual Studio Code is a powerful development tool, with support for almost every programming language you can think of. You can download the installation package of the latest version here for free, and then follow the installation instructions.

TIP: If you just want to test snippets of code, without having to compile and execute your code, you can do so on the Rust Playground.
Install Microsoft C++ Build Tools
Confused as to why you need to install the C++ compiler for Rust?² It is required by the Rust compiler because Rust first compiles the code down to LLVM IR and then that gets compiled into machine language.
From the Visual Studio downloads page, look for the “Build Tools for Visual Studio” section and click the “Download” button:

Once it has finished downloading, execute the file from your downloads folder and follow the installation instructions.
Install Rust
To install Rust you first need to download the installation file from here:

To launch the installer, execute the rustup-init.exe file (from your downloads folder):

NOTE: If you haven’t already installed the Microsoft C++ Build Tools, the installation will show this as a required prerequisite and instruct you to install it.
Select option "1" (default) and press enter:

Install Rust Extension for Visual Studio Code
Next open up Visual Studio Code and click on the Extensions icon on the left hand side, type "rust" into the search, select the "rust-analyzer" extension, and then click the "install" button:

Create and Run a Basic Rust App
Press CTRL + ' (single quote) to open a new terminal window in Visual Studio Code:

Then change the working directory to wherever you what to create your application folder (I normally use a development folder on my C drive):

Then to set up a new project in the folder, type the following in the terminal window and press enter:
cargo new MyRustApp

Click on the Explorer icon on the left hand side and then click on the Open Folder button:

Then select the new application folder that you just created:

Click on the src folder and then on the main.rs file:

Press F5 to try and run the file in debug mode. Visual Studio might first detect that launch configurations missing. Click on the "Yes" button:

The launch configurations will then be generated:

Again, select on the main.rs file and press F5 to compile and run the app:

Since Rust is a compiled language, you will notice that in the target -> debug folder, there is an executable file for your application:

There we have it! 🎉 We have successfully greeted the entire planet, according to social convention, using Rust. It would have been rude not to.
[2] What is LLVM? The power behind Swift, Rust, Clang, and more | InfoWorld
Thanks for reading. If you like my articles and find them useful, please follow me on Medium.com so that you know when I publish any new ones.






