# How to Build openclaw-windows-node from Source

> Learn to build openclaw-windows-node from source with PowerShell 7 and the .NET 7 SDK. Compile the solution and run validation tests easily.

- Repository: [openclaw/openclaw-windows-node](https://github.com/openclaw/openclaw-windows-node)
- Tags: how-to-guide
- Published: 2026-06-06

---

**Run `.\build.ps1` in PowerShell 7 after installing the .NET 7 SDK (pinned in [`global.json`](https://github.com/openclaw/openclaw-windows-node/blob/main/global.json)) to compile the solution and execute the mandatory validation test suite.**

Building `openclaw-windows-node` from source requires a Windows environment with modern .NET tooling. This repository contains C# projects, PowerShell automation scripts, and optional frontend assets that compile into the OpenClaw Windows client node. The master build script enforces the validation workflow defined in [`AGENTS.md`](https://github.com/openclaw/openclaw-windows-node/blob/main/AGENTS.md) to ensure code quality before producing binaries.

## Prerequisites

Before compiling, ensure your development environment meets these requirements:

- **Windows 10 or later** — The node targets Windows-specific APIs and WinUI 3.
- **PowerShell 7+** — The `build.ps1` script uses modern language features not available in Windows PowerShell 5.1. Install via `winget install Microsoft.PowerShell`.
- **.NET SDK 7.0** — The repository pins the exact SDK version in [`global.json`](https://github.com/openclaw/openclaw-windows-node/blob/main/global.json) to prevent "SDK not found" errors. Install the matching version with `winget install Microsoft.DotNet.SDK.7`.
- **Git** — Required to clone the repository and manage submodules.
- **Inno Setup (optional)** — Only needed if generating the self-extracting installer via `installer.iss` located at the repository root.
- **Node.js 18+ (optional)** — Required for running `npm ci` to restore frontend assets referenced by the build pipeline.

> **Tip:** Verify your installed .NET version matches [`global.json`](https://github.com/openclaw/openclaw-windows-node/blob/main/global.json) exactly. Mismatches cause the build to halt immediately.

## Step-by-Step Build Instructions

### 1. Clone the Repository

```powershell
git clone https://github.com/openclaw/openclaw-windows-node.git
cd openclaw-windows-node

```

### 2. Run the Master Build Script

Execute the orchestration script from the repository root:

```powershell
.\build.ps1

```

This script performs three critical actions defined in [`AGENTS.md`](https://github.com/openclaw/openclaw-windows-node/blob/main/AGENTS.md):

1. **Restore and Build** — Calls `dotnet restore` followed by `dotnet build` on `openclaw-windows-node.slnx`, compiling all C# projects including `OpenClaw.Tray.WinUI` and `OpenClaw.SetupEngine`.

2. **Shared Library Tests** — Executes `dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore`.
3. **Tray Application Tests** — Executes `dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore`.

If any validation step fails, the script aborts with diagnostic output. Successful completion produces binaries under each project's `bin/Release/net7.0-windows/` directory.

### 3. Package the Installer (Optional)

To generate a distributable `.exe` installer using the Inno Setup script:

```powershell
.\scripts\build-inno-local.ps1

```

This invokes `iscc` against `installer.iss`, bundling the compiled output and any frontend assets built via `npm`.

### 4. Launch the Local Build

Verify the build by launching the tray application:

```powershell
.\run-app-local.ps1

```

This helper script starts the WinUI 3 tray node directly from the build output without requiring installation.

## Troubleshooting Common Build Failures

**`dotnet` command not found or SDK version errors**
The build requires the exact .NET SDK version specified in [`global.json`](https://github.com/openclaw/openclaw-windows-node/blob/main/global.json). Install the specific version listed in that file to resolve "SDK not found" exceptions.

**Build fails with MSB4018 (WinUI related)**
Missing Windows SDK components for WinUI 3. Install the **Desktop Development with C++** workload through the Visual Studio Installer to provide required native tooling.

**Tests report "No tests were run" on first execution**
The test commands in `build.ps1` use the `--no-restore` flag. On a clean clone, test binaries do not exist yet. Run `dotnet build` on the test projects first, or temporarily omit `--no-restore` for the initial run.

**Inno Setup script cannot locate resources**
The frontend build steps require Node.js dependencies. Run `npm ci` in the repository root to populate `node_modules` before executing `build-inno-local.ps1`.

## Summary

- **Install** PowerShell 7 and the .NET SDK version pinned in [`global.json`](https://github.com/openclaw/openclaw-windows-node/blob/main/global.json).
- **Clone** the `openclaw/openclaw-windows-node` repository.
- **Execute** `.\build.ps1` to restore packages, compile `openclaw-windows-node.slnx`, and run the AGENTS.md validation workflow.
- **Optional:** Generate installers with `.\scripts\build-inno-local.ps1` or launch locally with `.\run-app-local.ps1`.

## Frequently Asked Questions

### What version of the .NET SDK is required?

According to the [`global.json`](https://github.com/openclaw/openclaw-windows-node/blob/main/global.json) file in the repository root, the build pins a specific .NET 7 SDK version. Installing the latest .NET 7 SDK usually satisfies this requirement, but the exact patch version listed in [`global.json`](https://github.com/openclaw/openclaw-windows-node/blob/main/global.json) prevents "SDK not found" errors during `dotnet build`.

### Can I build openclaw-windows-node without using PowerShell?

While you can manually invoke `dotnet build` on `openclaw-windows-node.slnx` and run `dotnet test` on the individual test projects, you bypass the validation workflow defined in [`AGENTS.md`](https://github.com/openclaw/openclaw-windows-node/blob/main/AGENTS.md). The `build.ps1` script enforces this sequence, so manual builds are supported for development but not recommended for release verification.

### Why do tests fail with "No test assets found" on the first run?

The `build.ps1` script passes `--no-restore` to `dotnet test` for performance. On a fresh clone, the test projects have not been built yet, so the test runner finds no binaries. Either build the test projects once with `dotnet build` beforehand, or run the tests without `--no-restore` for the first execution.

### Where are the compiled binaries located after running build.ps1?

Successful builds place output in each project's `bin/Release/net7.0-windows/` folder. For example, the main tray UI executable resides at `src/OpenClaw.Tray.WinUI/bin/Release/net7.0-windows/OpenClaw.Tray.WinUI.exe`.