Skip to main content
This guide walks you through building Windows Calculator from source code using Visual Studio and MSBuild.

Prerequisites

Before you can build Calculator, ensure your development environment meets these requirements:
Your computer must be running Windows 11, build 22000 or newer to build and run Calculator.
1

Install Visual Studio

Download and install the latest version of Visual Studio. The free Community edition is sufficient.During installation, make sure to install:
  • Universal Windows Platform Development workload
  • C++ Universal Windows Platform tools component (optional)
  • Latest Windows 11 SDK Visual Studio Installation
2

Install XAML Styler Extension

Install the XAML Styler Visual Studio extension for consistent XAML formatting.
3

Clone the Repository

Get the Calculator source code from GitHub:
git clone https://github.com/Microsoft/calculator.git
cd calculator

Building with Visual Studio

The simplest way to build Calculator is using the Visual Studio IDE:
1

Open the Solution

Open src/Calculator.sln in Visual Studio.
2

Select Platform and Configuration

Choose your target platform from the toolbar:
  • x64 - For 64-bit Intel/AMD processors
  • x86 - For 32-bit Intel/AMD processors
  • ARM64 - For ARM-based devices
Select the build configuration:
  • Debug - For development with debugging symbols
  • Release - For optimized production builds
3

Build the Solution

Press F7 or select Build > Build Solution from the menu.The build output will appear in the Output window. A successful build will show:
========== Build: 11 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
4

Run Calculator

Press F5 to build and run Calculator with the debugger attached, or Ctrl+F5 to run without debugging.

Building with MSBuild

For command-line builds or CI/CD pipelines, use MSBuild directly:
1

Restore NuGet Packages

nuget restore ./src/Calculator.sln
2

Build with MSBuild

msbuild ./src/Calculator.sln `
  -p:Platform=x64 `
  -p:Configuration=Release `
  -maxCpuCount
3

Publish the Application

To create a deployment package:
msbuild ./src/Calculator.sln `
  -p:Platform=x64 `
  -p:Configuration=Release `
  -p:GenerateProjectSpecificOutputFolder=true `
  -maxCpuCount `
  -t:Publish `
  -p:PublishDir=./output/publish/

Solution Structure

The Calculator solution contains multiple projects:
ProjectTypeDescription
CalculatorC# UWP AppMain application UI and entry point
CalcManagerC++ LibraryCore calculation engine
CalcViewModelC++ LibraryView models for MVVM pattern
GraphControlC++ LibraryGraphing calculator controls
GraphingImplC++ LibraryMock graphing engine implementation
CalculatorUnitTestsC++ TestUnit tests for core components
CalculatorUITestsC# TestUI automation tests
CalculatorUITestFrameworkC# LibraryTest framework and utilities

Platform Support

Calculator supports three platforms:
Debug|x64
Release|x64

Build Configurations

Debug Configuration

  • Includes debugging symbols
  • Minimal optimization
  • Assertions enabled
  • Diagnostic data disabled by default

Release Configuration

  • Full optimization
  • No debugging symbols
  • Assertions disabled
  • Diagnostic data disabled in developer builds
Diagnostic data collection can be enabled with the SEND_DIAGNOSTICS build flag, but is disabled by default in development builds.

Continuous Integration

The Calculator project uses GitHub Actions for CI/CD. The workflow:
  1. Defines builds - Determines which platforms to build based on PR vs. main branch
  2. Builds - Compiles for x64, x86, and ARM64 (x64 only for PRs)
  3. Runs unit tests - Executes CalculatorUnitTests on x64 and x86
  4. Runs UI tests - Executes CalculatorUITests on x64
View the CI workflow configuration for details.

Troubleshooting

Build Errors

Missing Windows SDK
Error: Windows SDK version not found
Install the latest Windows 11 SDK through Visual Studio Installer. NuGet restore failed
Error: Unable to find package
Ensure you have internet connectivity and run:
nuget restore ./src/Calculator.sln -Force
Platform toolset not found
Error: The build tools for v143 cannot be found
Install the “C++ Universal Windows Platform tools” component in Visual Studio.

Performance Tips

  • Use -maxCpuCount with MSBuild to enable parallel compilation
  • Build only the platform you need during development (typically x64)
  • Use incremental builds when making small changes
  • Consider using a RAM disk for faster builds on systems with sufficient memory

Next Steps

Running Tests

Learn how to run unit tests and UI tests

Debugging

Set up debugging tools and techniques

Build docs developers (and LLMs) love