iTranslated by AI
Development Environment: Visual Studio Build Tools Installation Guide
Introduction
This guide explains how to set up a C++/C#/F# development environment using Visual Studio Build Tools.
Target Audience
This article is intended for IT engineers programming on Windows.
Key Keywords
Here are the important keywords and notes covered in this article:
- Visual Studio Build Tools: A toolset for compiling programs from the command line.
- Visual Studio Installer: A tool for installing/uninstalling various components that make up
Build Tools. - Configuration file: A file containing a list of components to be installed, used by the
Visual Studio Installer. - JSON format: A lightweight data format used for data description, also used for configuration files.
- Component: A unit of parts that make up each function of
Visual Studio Build Tools. - Roslyn Compiler: An open-source C# compiler provided by Microsoft.
- Developer PowerShell: A
PowerShellenvironment that sets up necessary environment variables for compiling each language upon startup. - "Hello, World": A simple program written first in a programming language. Often used as a baseline for development environments or programming studies.
1. What is Visual Studio Build Tools?
Visual Studio Build Tools is a tool for compiling and building programs from the command line.
While the standard Visual Studio allows for easy compilation and building through a GUI, Build Tools requires operations from the command line.
Each command in Build Tools is executed from the command line. Therefore, it can be used in automation scripts and build tools.
Note that you must agree to the Microsoft license terms to use Build Tools.
Note:
- You must agree to the Microsoft Software License Terms.
2. Build Tools Installation Steps
Build Tools is installed via the Visual Studio Installer.
Usually, you select the components to install through the installer's GUI. Alternatively, you can also install them using a configuration file called xx.config.
2.1. Installing Build Tools Using a Configuration File
By specifying the --config option in the Visual Studio Installer, you can install Build Tools based on a specific configuration file. This option allows you to precisely and accurately reproduce a Build Tools configuration once it has been created.
i In the example below, Build Tools is installed using the configuration file minimum.vsconfig.
vs_BuildTools.exe --config minimum.vsconfig
Notes:
- Regarding the configuration file
minimum.config, please refer to 2.2.
2.2. Configuration File to Use
A configuration file is a JSON format file that contains a list of components to be installed. In the Visual Studio Installer GUI, you select packages such as Desktop development with C++ or individual components. Each selected component is then recorded in the Vsconfig file.
For example, Microsoft.VisualStudio.Component.Roslyn.Compiler is the Roslyn compiler used for compiling C# programs.
The configuration file used in this guide is as follows:
{
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Component.Roslyn.Compiler",
"Microsoft.Component.MSBuild",
"Microsoft.VisualStudio.Component.CoreBuildTools",
"Microsoft.VisualStudio.Workload.MSBuildTools",
"Microsoft.VisualStudio.Component.VC.CoreBuildTools",
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
"Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
"Microsoft.VisualStudio.Component.TextTemplating",
"Microsoft.VisualStudio.Component.VC.CoreIde",
"Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core",
"Microsoft.VisualStudio.Workload.VCTools",
"Microsoft.VisualStudio.Component.Windows11SDK.22621",
"Microsoft.VisualStudio.Component.FSharp.MSBuild",
"Microsoft.VisualStudio.Component.Roslyn.LanguageServices"
]
}
Below are the main components to be installed and their descriptions:
| Component | Overview | Remarks |
|---|---|---|
Microsoft.VisualStudio.Component.Roslyn.Compiler |
Roslyn Compiler | C# Compiler |
Microsoft.Component.MSBuild |
MS Build Tool | Required (Not used directly this time) |
Microsoft.VisualStudio.Component.VC.CoreBuildTools |
VC Core Build Tools |
C++ Compiler Core |
Microsoft.VisualStudio.Component.VC.Tools.x86.x64 |
Visual C++ Tools |
C++ Compiler for Windows |
Microsoft.VisualStudio.Component.Windows11SDK.22621 |
Windows 11 SDK |
Includes standard libraries for C/C++ |
Microsoft.VisualStudio.Component.FSharp.MSBuild |
F# MS Build |
F# Compiler |
2.3. Creating a Configuration File
Create a configuration file following these steps:
-
Launch
Visual Studio Installer:
SelectVisual Studio Installerfrom the Start menu to launch the installer. -
Export the configuration file:
Select[More]-[Export configuration]to output the configuration file.
2.4. Installing Build Tools via Configuration File
Visual Studio Build Tools installs the components specified in the configuration file by adding the --config <vsconfig file> option to the installer.
You can also install Build Tools using winget.
Install Build Tools using winget with the following steps:
-
Run the following command:
Executewingetin the command line. Use the--overrideoption to pass the--configoption to theVisual Studio Installer.winget install Microsoft.VisualStudio.2022.BuildTools --override "--passive --config minimum.vsconfig" -
Display the installation screen:
If executed successfully, the following installation screen will be displayed.

This completes the installation of Build Tools.
3. Setting Up the Development Environment
3.1. Path Settings
Add the following paths to the environment variable Path. After restarting your PC, the compilers for each language will be available.
| Path | Target Language |
|---|---|
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\bin\HostX64\x64 |
C/C++ Compiler (Windows x64)
|
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\bin\Roslyn |
C# Compiler |
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\CommonExtensions\Microsoft\FSharp\Tools |
F# Compiler |
3.2. Configuring the Development Console
Once Build Tools is successfully installed, an entry for "Developer PowerShell for ..." will be added to Windows Terminal.
The PowerShell used in this entry is the legacy Windows PowerShell, which may not be very user-friendly. Instead, let's change the settings to launch using your customized PowerShell Core.
Follow these steps to update Windows Terminal:
-
Open [Settings]:
InWindows Terminal, pressCtrl+,to open [Settings].

-
Select [Developer PowerShell]:

-
Update the [Command line]:
Changepowershell.exein the command line topwsh.exeand click [Save].

This completes the installation of Build Tools and the setup of your development environment.
4. Verifying the Development Environment
Check if Build Tools is working correctly by creating "Hello, World" programs in each language.
4.1. Verifying the Development Environment with "Hello, World"
If the steps in #3. Setting Up the Development Environment were completed successfully, you can compile and run programs in C++, C#, and F#.
In this chapter, we will create a "Hello, World" program for each language to confirm that they compile correctly.
Notes:
The following operations are verified using Developer PowerShell.
4.2. Verifying C++
Follow these steps to verify your C++ development environment:
-
Move to the working directory:
OpenDeveloper PowerShelland move to an appropriate working directory for programming.> cd ~\workspaces\temp\src\cpp -
Create
hello.cpp:
Create the followinghello.cppprogram:hello.cpp#include <iostream> using namespace std; void main() { cout << "Hello, I'm C++." << endl; } -
Create
hello.exe:
Compile thehello.cppprogram using the C++ compiler (cl).cl hello.cpp Microsoft(R) C/C++ Optimizing Compiler Version 19.36.32535 for x64 Copyright (C) Microsoft Corporation. All rights reserved. hello.cpp Microsoft (R) Incremental Linker Version 14.36.32535.0 Copyright (C) Microsoft Corporation. All rights reserved. /out:hello.exe hello.objNote:
Even if warnings appear, the compilation is successful as long as/out:hello.exeis displayed. -
Run
hello.exe:
Executehello.exeand verify it works correctly.Hello, I'm C++.
It is successful if Hello, I'm C++. is output as shown above.
4.3. Verifying C#
Follow these steps to verify your C# development environment:
-
Move to the working directory:
OpenDeveloper PowerShelland move to an appropriate working directory for programming.> cd ~\workspaces\temp\src\c# -
Create
hello.cs:
Create the followinghello.csprogram:hello.csusing System; namespace hello { public class hello { public static void Main(string[] args) { Console.WriteLine("Hello, I'm C#"); } } } -
Create
hello.exe:
Compile the "hello.cs" program using the C# compiler (csc).csc .\hello.cs Microsoft (R) Visual C# Compiler version 4.6.0-3.23259.8 (c3cc1d0c) Copyright (C) Microsoft Corporation. All rights reserved. > -
Run
hello.exe:
Executehello.exeand check the output.Hello, I'm C#
It is successful if Hello, I'm C# is output as shown above.
4.4. Verifying F#
Follow these steps to verify your F# development environment:
-
Move to the working directory:
OpenDeveloper PowerShelland move to a temporary working directory.> cd ~\workspaces\temp\src\f# -
Create
hello.fs:
Create the followinghello.fsprogram:hello.fsprintf "Hello, I'm F#" -
Create
hello.exe:
Run the F# compiler to createhello.exe.fsc hello.fs Microsoft (R) F# Compiler version 12.5.0.0 for F# 7.0 Copyright (C) Microsoft Corporation. All rights reserved. > -
Run
hello.exe:
Executehello.exeand check the output.Hello, I'm F#
It is successful if Hello, I'm F# is output as shown above.
Conclusion
This concludes the installation and verification of Visual Studio Build Tools.
You are now ready to program in C++, C#, and F#.
By combining this with development tools like make, you can develop large-scale software. You can also use programming languages like Rust that require C++ compilation for software development.
Take this opportunity to dive into the world of programming.
Happy hacking!
Discussion