# How to Compile VeraCrypt from Source on Windows: Complete Visual Studio 2022 Guide

> Compile VeraCrypt from source on Windows using Visual Studio 2022. Follow our complete guide to build and sign VeraCrypt binaries for enhanced security.

- Repository: [VeraCrypt/VeraCrypt](https://github.com/veracrypt/VeraCrypt)
- Tags: how-to-guide
- Published: 2026-06-30

---

**To compile VeraCrypt from source on Windows, install Visual Studio 2022 with the Desktop development with C++ workload, the Windows SDK, WDK, NASM, and YASM, then build the `src/VeraCrypt.sln` solution and sign the binaries using `src/Signing/sign_test.bat`.**

Compiling VeraCrypt on Windows involves building both the user-mode encryption application and the kernel-mode driver from the veracrypt/VeraCrypt repository. The process relies on Microsoft’s build toolchain to produce signed `veracrypt.sys` driver files and the main GUI executable from the Visual Studio solution located at `src/VeraCrypt.sln`.

## Prerequisites for Compiling VeraCrypt

Before cloning the repository, install the following toolchains and SDKs. VeraCrypt’s build system requires these components to compile the cryptographic modules and driver components.

- **Visual Studio 2022** with the **Desktop development with C++** workload. Include the MSVC v143 compiler, C++ ATL/MFC libraries, and the Windows 10/11 SDK (10.0.19041.0 or later).
- **Windows Driver Kit (WDK)** for Visual Studio 2022. This supplies the driver build environment, `inf2cat`, and the necessary headers for `src/Driver/Driver.vcxproj`.
- **NASM 2.08+**. The Netwide Assembler is required for compiling low-level cryptographic routines. Install to `C:\Program Files (x86)\nasm` and add this path to your system `PATH`.
- **YASM 1.3+**. Create a directory at `C:\Program Files\YASM`, place the `yasm.exe` binary there, and set both the `PATH` and a `YASMPATH` environment variable pointing to this folder.
- **WiX Toolset v3.x** (optional). Required only if you intend to generate MSI installer packages from the solution.
- **Legacy bootloader tools** (optional). Only needed for `ReleaseCustomEFI` builds: gzip, UPX, and dd.

The official reference for these requirements is documented in [`doc/html/en/CompilingGuidelineWin.html`](https://github.com/veracrypt/VeraCrypt/blob/main/doc/html/en/CompilingGuidelineWin.html) within the source tree.

## Step-by-Step Build Procedure

Follow these steps to compile VeraCrypt from source using either the Visual Studio IDE or command-line MSBuild tools.

### 1. Clone the Repository

Open a terminal and clone the VeraCrypt source code:

```bash
git clone https://github.com/veracrypt/VeraCrypt.git
cd VeraCrypt

```

### 2. Open the Solution in Visual Studio

Launch **Visual Studio 2022** and open `src/VeraCrypt.sln`. This solution aggregates the GUI application, command-line tools, driver project, and installer projects.

### 3. Build the Main Application

Select **Release|x64** (or **ARM64**) from the configuration dropdown and choose **Build → Build Solution**. Repeat this process for **Release|Win32** if you require 32-bit helper binaries.

### 4. Build the Kernel Driver

In the Solution Explorer, locate the **Driver** project. Right-click and build **Release|x64** and **Release|ARM64** configurations separately. This produces the `veracrypt.sys` files defined in `src/Driver/Driver.vcxproj`.

### 5. Command-Line Alternative Using MSBuild

For automated builds, open the **Developer Command Prompt for VS 2022** as Administrator and execute:

```bash
msbuild src\VeraCrypt.sln /m /p:Configuration=Release /p:Platform=x64
msbuild src\VeraCrypt.sln /m /p:Configuration=Release /p:Platform=ARM64
msbuild src\Driver\Driver.vcxproj /m /p:Configuration=Release /p:Platform=x64

```

### 6. Sign the Binaries with Test Certificates

Navigate to the signing directory and run the provided batch script:

```bash
cd src\Signing
sign_test.bat

```

This script uses `signtool.exe` to sign the executables and driver with the test certificates located in `src/Signing/TestCertificate` (password: `idrix`).

### 7. Locate Build Outputs

Completed binaries and installers appear in `src/Release/Setup Files`. This directory contains the final `VeraCrypt Setup.exe` and signed `veracrypt.sys` driver files.

## Code Examples for Common Tasks

### Complete MSBuild Script for x64 and ARM64

```bash
rem Run from Developer Command Prompt for VS 2022 (Administrator)
cd path\to\VeraCrypt

msbuild src\VeraCrypt.sln ^
    /m ^
    /p:Configuration=Release ^
    /p:Platform=x64

msbuild src\VeraCrypt.sln ^
    /m ^
    /p:Configuration=Release ^
    /p:Platform=ARM64

msbuild src\Driver\Driver.vcxproj ^
    /m ^
    /p:Configuration=Release ^
    /p:Platform=x64

```

### Enabling Windows Test Mode for Unsigned Driver Testing

If you encounter driver signature verification errors during testing, enable Test Mode:

```cmd
bcdedit /set testsigning on
shutdown /r /t 0

```

After testing, disable Test Mode with `bcdedit /set testsigning off`.

## Key Source Files and Their Roles

Understanding the repository structure helps troubleshoot build issues:

- **`src/VeraCrypt.sln`** – The master Visual Studio solution that orchestrates builds for the GUI, CLI, driver, and installer components.
- **`src/Driver/Driver.vcxproj`** – Project file specifically for the kernel driver. Outputs `veracrypt.sys` for x64 and ARM64 platforms.
- **`src/Signing/sign_test.bat`** – Automation script that signs all binaries using the bundled test certificates in `src/Signing/TestCertificate/`.
- **`src/Release/Setup Files/`** – Destination directory for final compiled artifacts and installers.
- **[`doc/html/en/CompilingGuidelineWin.html`](https://github.com/veracrypt/VeraCrypt/blob/main/doc/html/en/CompilingGuidelineWin.html)** – The authoritative HTML documentation for Windows builds.
- **[`src/Boot/EFI/Readme.txt`](https://github.com/veracrypt/VeraCrypt/blob/main/src/Boot/EFI/Readme.txt)** – Instructions for building the EFI bootloader when using the `ReleaseCustomEFI` configuration.

## Troubleshooting Common Build Errors

| Symptom | Cause | Solution |
|---------|-------|----------|
| `signtool` not found | Windows SDK path missing from environment | Use the **Developer Command Prompt for VS 2022** which automatically configures the PATH, or verify your SDK installation matches the WDK version. |
| Driver installation fails with signature errors | Test certificates not imported | Import certificates from `src/Signing/TestCertificate/` into **Local Machine → Trusted Root Certification Authorities** and **Personal** stores. Use password `idrix` for `.pfx` files. |
| YASM linker errors | Missing `YASMPATH` environment variable | Ensure `YASMPATH` points to `C:\Program Files\YASM` and that the directory is in your system PATH. |
| Build skips projects | Wrong configuration selected | Switch to **Release|x64** or **Release|ARM64**; Debug configurations intentionally exclude certain projects. |
| wxWidgets warnings | Static libraries not built | Either install shared wxWidgets 3.0 libraries or build static versions using `make WXSTATIC=1`. |

## Summary

- **Install** Visual Studio 2022, Windows SDK (10.0.19041.0+), WDK, NASM, and YASM before attempting to compile VeraCrypt from source.
- **Build** the main solution using `src/VeraCrypt.sln` for Release x64/ARM64 configurations, then compile `src/Driver/Driver.vcxproj` separately for driver support.
- **Sign** all binaries using `src/Signing/sign_test.bat` with the provided test certificates (password: `idrix`).
- **Output** files are located in `src/Release/Setup Files` and include both the application installer and signed kernel drivers.
- **Enable** Windows Test Mode (`bcdedit /set testsigning on`) only when testing custom-signed drivers that lack official Microsoft signatures.

## Frequently Asked Questions

### What version of Visual Studio is required to compile VeraCrypt?

Visual Studio 2022 is required with the **Desktop development with C++** workload installed. You must include MSVC v143, C++ ATL/MFC libraries, and the Windows 10/11 SDK (version 10.0.19041.0 or later). The Windows Driver Kit (WDK) must match your Visual Studio version to build the `veracrypt.sys` driver.

### Why do I need NASM and YASM to build VeraCrypt?

VeraCrypt uses assembly-optimized cryptographic implementations for performance. **NASM** (Netwide Assembler) and **YASM** are required to compile these low-level routines during the build process. The build system expects `nasm.exe` in your PATH and the `YASMPATH` environment variable pointing to your YASM installation directory.

### How do I sign the VeraCrypt driver for testing purposes?

After building, run `src/Signing/sign_test.bat` from an elevated command prompt. This script uses `signtool.exe` to apply test certificates located in `src/Signing/TestCertificate/`. The certificate password is `idrix`. For the signed driver to load, you must import the certificates into your Trusted Root store or enable Windows Test Mode using `bcdedit /set testsigning on`.

### Can I build VeraCrypt without the kernel driver?

While you can build the user-mode application independently by selecting only the GUI and CLI projects in `src/VeraCrypt.sln`, full functionality requires the driver component defined in `src/Driver/Driver.vcxproj`. Without the driver, VeraCrypt cannot create or mount encrypted system volumes or use certain encryption features that require kernel-level access.