MahApps/MahApps.Metro · critical · NotImplementedException

{repoName} will only build on Windows because it's not possi

Error message

{repoName} will only build on Windows because it's not possible to target WPF and Windows Forms from UNIX.

What it means

The build script (Cake) aborts during the Setup phase because it detected a non-Windows host. The repo targets WPF and Windows Forms, whose MSBuild SDKs and XAML compiler tasks cannot run on Linux/macOS, so the build is intentionally Windows-only. Cake throws a NotImplementedException at build.cake:69 inside Setup<BuildData> before any task runs.

Source

Thrown at build.cake:69

        DotNetVerbosity = dotNetVerbosity;
    }

    public void SetGitVersion(GitVersion gitVersion)
    {
        GitVersion = gitVersion;
        IsPrerelease = GitVersion.NuGetVersion.Contains("-");
    }
}

///////////////////////////////////////////////////////////////////////////////
// SETUP / TEARDOWN
///////////////////////////////////////////////////////////////////////////////

Setup<BuildData>(ctx =>
{
    if (!IsRunningOnWindows())
    {
        throw new NotImplementedException($"{repoName} will only build on Windows because it's not possible to target WPF and Windows Forms from UNIX.");
    }

    Spectre.Console.AnsiConsole.Write(new Spectre.Console.FigletText(repoName));

    var buildData = new BuildData(
        configuration: Argument("configuration", "Release"),
        verbosity: Argument("verbosity", Verbosity.Minimal),
        dotNetVerbosity: Argument("dotNetVerbosity", DotNetVerbosity.Minimal)
    )
    {
        IsLocalBuild = BuildSystem.IsLocalBuild,
        IsPullRequest =
            (BuildSystem.GitHubActions.IsRunningOnGitHubActions && BuildSystem.GitHubActions.Environment.PullRequest.IsPullRequest)
            || (BuildSystem.AppVeyor.IsRunningOnAppVeyor && BuildSystem.AppVeyor.Environment.PullRequest.IsPullRequest)
    };

    // Set build version for CI
    if (buildData.IsLocalBuild == false || buildData.Verbosity == Verbosity.Verbose)

View on GitHub (pinned to 72099e310b)

Solutions

  1. Run the build on a Windows host (native Windows, a Windows Server CI image, or a Windows Docker container) — e.g. use a windows-latest GitHub Actions runner / Windows AppVeyor image.
  2. If you must use Linux/macOS for non-XAML work, skip build.ps1 and dotnet build only the test/doc projects that do not reference WPF/WinForms.
  3. Run inside a Windows VM (Hyper-V, Parallels, VMware) when developing on macOS/Linux.

Example fix

// before: running on Linux
./build.ps1
// after: run on a Windows host or CI image
# GitHub Actions example
runs-on: windows-latest
- run: ./build.ps1 -Target Default
Defensive patterns

Strategy: validation

Validate before calling

// Cake: guard the target so non-Windows hosts skip cleanly instead of throwing during Setup
Task("Default")
    .WithCriteria(IsRunningOnWindows(), "Build is Windows-only (WPF/WinForms)")
    .Does(() => { /* ... */ });

# PowerSh0ell: check before invoking
if ($PSVersionTable.Platform -ne 'Win32NT') {
    Write-Error 'Run on Windows (WPF/WinForms build)'; exit 1
}

Prevention

When it happens

Trigger: Invoking build.ps1 or the Cake runner on Linux or macOS. The Cake helper IsRunningOnWindows() returns false, so the Setup action throws and the whole build aborts before tasks like Restore/Clean execute.

Common situations: Running the build inside a Linux Docker container, WSL (Linux side), macOS, or a CI image that is not windows-based. Also triggered by developers who clone the repo on macOS to edit code and then try to validate with a local build.

Related errors


AI-assisted analysis of MahApps/MahApps.Metro@72099e310b (2026-08-13). Data as JSON: /api/errors/2cf6987574eca403. Report an issue: GitHub.