Before you can build Windows Presentation Foundation (WPF) applications, you need to set up your development environment. Fortunately, Microsoft provides all the tools you need for free. In this tutorial, you’ll install Visual Studio, the .NET SDK, the required desktop development tools, and create your first WPF application.
By the end of this guide, you’ll have a fully configured WPF development environment and be ready to start building desktop applications.
Prerequisites #
Before installing the required software, make sure you have:
- Windows 10 or Windows 11
- At least 8 GB RAM (16 GB recommended)
- Around 20 GB of free disk space
- Stable internet connection
- Administrator privileges on your PC
Install Visual Studio #
Visual Studio is Microsoft’s official Integrated Development Environment (IDE) for .NET development. It provides everything needed to develop, debug, and deploy WPF applications.
Step 1: Download Visual Studio #
Visit the official Microsoft website and download Visual Studio Community (free for individual developers).
Choose:
- Visual Studio Community (Recommended)
- Professional
- Enterprise
For most developers, the Community Edition is more than sufficient.
Step 2: Run the Installer #
After downloading:
- Double-click the installer.
- Allow Windows permissions if prompted.
- Wait for the Visual Studio Installer to launch.
The installer allows you to select workloads instead of installing every component.
Step 3: Choose Installation Location (Optional) #
You may customize:
- Installation directory
- Download cache
- Shared components location
Most users can simply keep the default settings.
Install .NET SDK #
The .NET SDK contains everything required to compile and run .NET applications.
Although Visual Studio usually installs the SDK automatically, it’s recommended to install the latest Long-Term Support (LTS) version separately.
Download the SDK #
Download the latest .NET SDK (LTS) from Microsoft’s official .NET website.
Choose:
- Windows
- x64 (most computers)
- ARM64 (only if using ARM devices)
Do not download the Runtime only.
Install the SDK #
Run the downloaded installer.
The installation takes only a few minutes.
After installation finishes, verify it by opening Command Prompt and running:
dotnet --version
Example output:
9.0.100
If a version number appears, the SDK is installed successfully.
Install Desktop Development Workload #
This is the most important step.
Visual Studio installs features using Workloads.
To build WPF applications, you must install the Desktop development with .NET workload.
Open Visual Studio Installer #
Launch:
Visual Studio Installer
Click Modify on your installed Visual Studio.
Select Workload #
Under the Workloads tab, check:
✅ Desktop development with .NET
This workload installs:
- WPF templates
- Windows Forms templates
- .NET Desktop Runtime
- C# compiler
- XAML Designer
- Debugger
- Build tools
- NuGet support
Optional Components #
You may also install:
- .NET Framework targeting packs
- Git for Windows
- Live Share
- SQL Server Data Tools
- GitHub Extension
These are optional but useful during development.
Install #
Click:
Install
or
Modify
Wait for Visual Studio to download and install all required components.
This may take several minutes depending on your internet speed.
Create Your First WPF Project #
Now that everything is installed, let’s create your first application.
Step 1: Launch Visual Studio #
Open Visual Studio.
On the start screen click:
Create a new project
Step 2: Search for WPF #
In the search box, type:
WPF
Select:
WPF Application
Language:
C#
Framework:
.NET
Click Next.
Step 3: Configure Project #
Provide the following information:
Project Name
HelloWPF
Location
Choose where you want to save your project.
Solution Name
HelloWPF
Click Next.
Step 4: Select Framework #
Choose the latest available .NET version (preferably the latest LTS release).
Example:
.NET 9
Click:
Create
Visual Studio will generate the project.
Explore the Generated Project #
Your project will contain files similar to these:
HelloWPF
│
├── App.xaml
├── App.xaml.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── HelloWPF.csproj
└── Properties
Important Files #
| File | Purpose |
|---|---|
| App.xaml | Application startup configuration |
| App.xaml.cs | Application startup logic |
| MainWindow.xaml | User interface (XAML) |
| MainWindow.xaml.cs | C# code-behind |
| .csproj | Project configuration |
Run Your Application #
To execute the application:
Press
F5
or click the green Start button.
Visual Studio will:
- Build the project
- Launch the application
- Open the default WPF window
Congratulations! 🎉
You’ve just created your first WPF application.
Verify Everything Is Working #
You should now have:
- ✅ Visual Studio installed
- ✅ .NET SDK installed
- ✅ Desktop Development workload installed
- ✅ First WPF project created
- ✅ Application successfully running
If all these steps completed successfully, your development environment is ready.
Common Installation Issues #
WPF Template Not Found #
Cause
Desktop Development workload is missing.
Solution
Open Visual Studio Installer → Modify → Install Desktop development with .NET.
dotnet Command Not Recognized #
Cause
The .NET SDK is not installed or the PATH environment variable hasn’t been updated.
Solution
- Install the latest .NET SDK.
- Restart your computer or terminal after installation.
Build Errors on New Project #
Cause
Required SDK or workload is missing.
Solution
- Update Visual Studio.
- Install the latest .NET SDK.
- Ensure the Desktop Development workload is selected.
Best Practices #
- Install the latest Long-Term Support (LTS) version of .NET for production projects.
- Keep Visual Studio updated to receive the latest features and bug fixes.
- Use the Community Edition if you’re an individual developer, student, or learning WPF.
- Organize your projects into a dedicated development folder for easier management.
- Verify your SDK installation with
dotnet --versionbefore starting development.
Summary #
Setting up a WPF development environment is straightforward. Install Visual Studio, ensure the latest .NET SDK is available, enable the Desktop development with .NET workload, and create your first WPF project. Once your application runs successfully, you’re ready to explore XAML, controls, layouts, data binding, MVVM, and other advanced WPF concepts.
In the next tutorial, we’ll explore the structure of a WPF project, including the purpose of files such as App.xaml, MainWindow.xaml, and the .csproj project file.
