{"record":{"id":"2cf6987574eca403","repo":"MahApps/MahApps.Metro","slug":"reponame-will-only-build-on-windows-because-it-s","errorCode":null,"errorMessage":"{repoName} will only build on Windows because it's not possible to target WPF and Windows Forms from UNIX.","messagePattern":"(.+?) will only build on Windows because it's not possible to target WPF and Windows Forms from UNIX\\.","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"critical","filePath":"build.cake","lineNumber":69,"sourceCode":"        DotNetVerbosity = dotNetVerbosity;\n    }\n\n    public void SetGitVersion(GitVersion gitVersion)\n    {\n        GitVersion = gitVersion;\n        IsPrerelease = GitVersion.NuGetVersion.Contains(\"-\");\n    }\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// SETUP / TEARDOWN\n///////////////////////////////////////////////////////////////////////////////\n\nSetup<BuildData>(ctx =>\n{\n    if (!IsRunningOnWindows())\n    {\n        throw new NotImplementedException($\"{repoName} will only build on Windows because it's not possible to target WPF and Windows Forms from UNIX.\");\n    }\n\n    Spectre.Console.AnsiConsole.Write(new Spectre.Console.FigletText(repoName));\n\n    var buildData = new BuildData(\n        configuration: Argument(\"configuration\", \"Release\"),\n        verbosity: Argument(\"verbosity\", Verbosity.Minimal),\n        dotNetVerbosity: Argument(\"dotNetVerbosity\", DotNetVerbosity.Minimal)\n    )\n    {\n        IsLocalBuild = BuildSystem.IsLocalBuild,\n        IsPullRequest =\n            (BuildSystem.GitHubActions.IsRunningOnGitHubActions && BuildSystem.GitHubActions.Environment.PullRequest.IsPullRequest)\n            || (BuildSystem.AppVeyor.IsRunningOnAppVeyor && BuildSystem.AppVeyor.Environment.PullRequest.IsPullRequest)\n    };\n\n    // Set build version for CI\n    if (buildData.IsLocalBuild == false || buildData.Verbosity == Verbosity.Verbose)","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/MahApps/MahApps.Metro/blob/72099e310bac2d12ac98fd7560b69679252519f5/build.cake#L51-L87","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","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.","Run inside a Windows VM (Hyper-V, Parallels, VMware) when developing on macOS/Linux."],"exampleFix":"// before: running on Linux\n./build.ps1\n// after: run on a Windows host or CI image\n# GitHub Actions example\nruns-on: windows-latest\n- run: ./build.ps1 -Target Default","handlingStrategy":"validation","validationCode":"// Cake: guard the target so non-Windows hosts skip cleanly instead of throwing during Setup\nTask(\"Default\")\n    .WithCriteria(IsRunningOnWindows(), \"Build is Windows-only (WPF/WinForms)\")\n    .Does(() => { /* ... */ });\n\n# PowerSh0ell: check before invoking\nif ($PSVersionTable.Platform -ne 'Win32NT') {\n    Write-Error 'Run on Windows (WPF/WinForms build)'; exit 1\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin CI to windows-latest / a Windows image for any job that builds this repo.","Document the Windows-only requirement in the repo README so contributors don't attempt Linux builds.","Use Cake WithCriteria(IsRunningOnWindows()) so the target is skipped gracefully on non-Windows rather than throwing in Setup."],"tags":["build","cake","platform","wpf","windows","ci"],"backgroundTag":null,"analyzedSha":"72099e310bac2d12ac98fd7560b69679252519f5","analyzedAt":"2026-08-13T20:19:34.419Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}