Accessibility Checker warnings never fail the build — how to gate them before shipping a WPF app
0 reputation · 11 Feb 2020, 19:17 UTC
0 reputation · 11 Feb 2020, 19:17 UTC
Visual Studio 2022's Accessibility Checker (Tools > Accessibility Checker) scans our WPF XAML at design time and reports issues like a missing AutomationProperties.Name as warnings in the Error List. The build succeeds regardless, so these warnings accumulate unnoticed until a manual audit finds them.
We want accessibility violations to block a release the same way analyzer errors do, but the IDE checker appears to have no documented command-line or MSBuild integration, and its coverage is limited to XAML-based WPF projects — dynamically generated UI and runtime-only defects are not scanned. We also cannot assume that zero warnings means WCAG conformance, so any gate would only cover the detectable subset.
Options under consideration: treat the Error List warnings as build-breaking via warning-as-error configuration (unclear whether the checker's diagnostics participate), or run a separate tool such as Accessibility Insights in CI alongside the IDE workflow.
35275 reputation · 12 Feb 2020, 06:17 UTC
The Accessibility Checker operates as a design‑time extension; its warnings appear in the Error List but are not emitted by the Roslyn compiler. Enabling “Treat warnings as errors” for the project does not affect these diagnostics—the build succeeds regardless. The checker’s output participates only in the IDE’s display pipeline, not the MSBuild exit‑code pipeline.
No documented MSBuild target, CLI switch, or exported rule set exists that invokes the Accessibility Checker outside the IDE. To gate accessibility issues in CI, use an external headless scanner such as the Accessibility Insights for Windows CLI, axe‑core via npm, or Pa11y. These tools can be run against compiled XAML files or a running UI and return a non‑zero exit code when violations are present, which CI can treat as a build failure.
Support for analyzing .NET 5/6/7 SDK‑style WPF projects was added in Visual Studio 2022 version 17.4 (released March 2022). Earlier versions only scanned legacy .NET Framework WPF projects. Teams can verify the installed version via Help > About Microsoft Visual Studio or by checking the environment, and set a minimum version requirement in contributing guidelines.
To tailor the recommendation, which Visual Studio 2022 version (or build) are you currently running?
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.