You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature]: Support C++ (.vcxproj) projects in winapp run with clear prerequisite guidance #680
Is your feature request related to a problem? Please describe.
winapp run project mode builds with dotnet build / dotnet restore, which have no C++ project system — the .NET SDK cannot restore or build a .vcxproj, and on a machine without Visual Studio there is no MSBuild VC toolchain present at all. This shows up in two ways:
.vcxproj as the entry project — winapp run App.vcxproj is currently rejected as a non-runnable input.
.vcxproj as a build dependency of an otherwise-managed WinUI / Windows App SDK app — the common "managed app + native helper / out-of-process COM server" shape. winapp run restores and builds only the managed side, so the native project isn't built and the app can fail at or after build.
Visual Studio handles both because it ships the C++ project system and the VC toolchain. winapp run aims for parity with a Visual Studio F5 run but currently can't reach it for any project graph that contains native C++ projects.
Describe the solution you'd like
Give winapp run a detect-and-delegate path for C++ projects:
Detect the C++ toolchain via vswhere (the "Desktop development with C++" workload plus the matching MSBuild.exe).
When present: build C++ projects — the entry .vcxproj, or the .vcxproj dependencies of a managed app — by invoking the full MSBuild.exe (located via vswhere) instead of dotnet build, then continue the normal run / launch flow.
When absent:fail fast with a clear, actionable message naming the exact prerequisites to install (and a link), rather than a raw NETSDK1004 / MSB#### error. Prerequisites to name:
Visual Studio (any edition) or Build Tools for Visual Studio with the "Desktop development with C++" workload,
the Windows SDK, and
for WinUI / Windows App SDK C++ apps, the C++/WinRT and Windows App SDK components.
Non-goal: winapp will not bundle the C++ toolchain (multi-GB, licensed) — detect-and-guide only.
Acceptance criteria
winapp run <app.csproj> whose solution includes a .vcxproj dependency: with the Desktop C++ workload present, the native project builds (via MSBuild.exe) and the app runs; without it, a clear "install the Desktop development with C++ workload" message (not a raw SDK error).
winapp run <native.vcxproj> directly: same detect-and-guide behavior.
No regression for pure-managed project graphs (no vswhere / MSBuild shell-out when there is no .vcxproj in the graph).
Additional context
Part of a broader "additional project types" theme for winapp run. A related managed-side follow-up is support for Windows Application Packaging Projects (.wapproj). These can be scheduled independently.
Can be picked up on its own, with no hard dependency on other work.
Related variant: NativeAOT publish for managed apps also needs the MSVC toolchain (distinct from the C++ project-system case above)
This issue covers .vcxproj (the C++ project system). There's an adjacent case worth capturing on the same thread: a managed.csproj (WinUI 3 / console / WPF) with PublishAot=true. It has no C++ project, but its publish step shells out to the MSVC linker (link.exe) and needs vswhere to locate it — so on a machine without the "Desktop development with C++" workload it fails the same way, with a cryptic MSB3073 / "platform linker not found" instead of actionable guidance.
Key difference from the .vcxproj case: it''s publish/package-time, not build/run-time.PublishAot=true only engages on dotnet publish -r <rid>; dotnet build / winapp run always produce a normal JIT build. So winapp run''s inner loop is unaffected — this belongs to whatever eventually does winapp package/publish of a managed app.
Suggested handling (mirrors the detect-and-guide approach already proposed here):
When publishing/packaging a managed app with PublishAot=true (evaluate the property up front), preflight the MSVC toolchain via vswhere.
If absent, fail early with the same "install Desktop development with C++ workload" message (+ Windows SDK, + the exact winget install command for VS Build Tools with VCTools and the matching x64/ARM64 target), rather than surfacing the raw linker error.
Non-goal (same as here): don''t bundle or silently download the toolchain.
Prior art for the requirement: NativeAOT publish of the winapp CLI itself needs both a VS2022 dev env (vcvars64) andvswhere.exe on PATH; a missing vswhere corrupts the native link step (MSB3073 / link exit 123).
Context: surfaced while reviewing PR #612 (.csproj project mode for winapp run). run itself needs no change — flagging so the AOT-publish variant is captured alongside the C++ toolchain work.
Note for whoever picks this up: once winapp run resolves C++ projects, WinUI DevTools (#943) can use the project as a source root. That enables XAML source mapping and source-anchored comments for C++/WinRT apps, which are refused today when an app is launched from build output. Please expose the resolved project/configuration/platform/output through the existing run resolution model so DevTools can build on it. No DevTools code is needed in this change.
Starting on this. Plan (scope: .vcxproj as the entry project; the "native dependency of a managed app" case is a follow-up):
Input: winapp run App.vcxproj, winapp run . in a folder with one application .vcxproj (and no .csproj), and a .sln/.slnx whose only runnable app is a .vcxproj resolve to project mode. No dotnet needed for C++-only inputs.
Toolchain: locate MSBuild.exe with vswhere -requires <VC tools for the target arch>. Missing VS/Build Tools or C++ tools → one actionable error (what to install + winget command). MSB8020 (toolset) / MSB8036 (Windows SDK) build failures get a hint.
Build: MSBuild <vcxproj> -restore -p:RestorePackagesConfig=true -p:Configuration=Debug -p:Platform=x64 [-p:SolutionDir=…] [user -p], then an evaluate pass (-getProperty) for OutDir/TargetPath/AppxPackageRecipe/FinalAppxManifestName/AppxPackage/WindowsPackageType. Defaults and -c/--arch/--no-build/--no-restore/-p/--detach/--json behave as for .csproj.
Launch: same ProjectRunResolution → existing packaged (recipe + loose-layout register) or unpackaged (TargetPath) paths. Windows App SDK version for runtime provisioning comes from packages.config.
Sample: new samples/cpp-winui-app (VS "WinUI Blank App (Packaged)" C++/WinRT template, XAML UI) + Pester test + CI matrix entry. Docs: usage.md run section, guides/cpp.md, skills.
Early finding: folder mode already works on a C++ WinUI build output (winapp run x64\Debug\App) because the pipeline consumes the MSBuild .appxrecipe; the gap is building + resolving the project.
Status: #984 implements .vcxproj as the entry project for winapp run, plus a clear error when a C# app references a C++ project. Still open from this issue:
Building a C# app whose project references include a .vcxproj with Visual Studio's MSBuild (today winapp stops early and tells the user to build with MSBuild and re-run with --no-build).
The NativeAOT-publish MSVC preflight from the comment above.
Activity
nmetulev commentedon Jul 23, 2026
Related variant: NativeAOT publish for managed apps also needs the MSVC toolchain (distinct from the C++ project-system case above)
This issue covers
.vcxproj(the C++ project system). There's an adjacent case worth capturing on the same thread: a managed.csproj(WinUI 3 / console / WPF) withPublishAot=true. It has no C++ project, but its publish step shells out to the MSVC linker (link.exe) and needsvswhereto locate it — so on a machine without the "Desktop development with C++" workload it fails the same way, with a crypticMSB3073/ "platform linker not found" instead of actionable guidance.Key difference from the
.vcxprojcase: it''s publish/package-time, not build/run-time.PublishAot=trueonly engages ondotnet publish -r <rid>;dotnet build/winapp runalways produce a normal JIT build. Sowinapp run''s inner loop is unaffected — this belongs to whatever eventually doeswinapp package/publish of a managed app.Suggested handling (mirrors the detect-and-guide approach already proposed here):
PublishAot=true(evaluate the property up front), preflight the MSVC toolchain viavswhere.winget installcommand for VS Build Tools with VCTools and the matching x64/ARM64 target), rather than surfacing the raw linker error.Prior art for the requirement: NativeAOT publish of the winapp CLI itself needs both a VS2022 dev env (
vcvars64) andvswhere.exeon PATH; a missingvswherecorrupts the native link step (MSB3073/ link exit 123).Context: surfaced while reviewing PR #612 (
.csprojproject mode forwinapp run).runitself needs no change — flagging so the AOT-publish variant is captured alongside the C++ toolchain work.nmetulev commentedon Oct 4, 2026
Note for whoever picks this up: once
winapp runresolves C++ projects, WinUI DevTools (#943) can use the project as a source root. That enables XAML source mapping and source-anchored comments for C++/WinRT apps, which are refused today when an app is launched from build output. Please expose the resolved project/configuration/platform/output through the existing run resolution model so DevTools can build on it. No DevTools code is needed in this change.nmetulev commentedon Oct 4, 2026
Starting on this. Plan (scope:
.vcxprojas the entry project; the "native dependency of a managed app" case is a follow-up):winapp run App.vcxproj,winapp run .in a folder with one application.vcxproj(and no.csproj), and a.sln/.slnxwhose only runnable app is a.vcxprojresolve to project mode. Nodotnetneeded for C++-only inputs.MSBuild.exewithvswhere -requires <VC tools for the target arch>. Missing VS/Build Tools or C++ tools → one actionable error (what to install +wingetcommand).MSB8020(toolset) /MSB8036(Windows SDK) build failures get a hint.MSBuild <vcxproj> -restore -p:RestorePackagesConfig=true -p:Configuration=Debug -p:Platform=x64 [-p:SolutionDir=…] [user -p], then an evaluate pass (-getProperty) forOutDir/TargetPath/AppxPackageRecipe/FinalAppxManifestName/AppxPackage/WindowsPackageType. Defaults and-c/--arch/--no-build/--no-restore/-p/--detach/--jsonbehave as for.csproj.ProjectRunResolution→ existing packaged (recipe + loose-layout register) or unpackaged (TargetPath) paths. Windows App SDK version for runtime provisioning comes frompackages.config.samples/cpp-winui-app(VS "WinUI Blank App (Packaged)" C++/WinRT template, XAML UI) + Pester test + CI matrix entry. Docs:usage.mdrun section,guides/cpp.md, skills.Early finding: folder mode already works on a C++ WinUI build output (
winapp run x64\Debug\App) because the pipeline consumes the MSBuild.appxrecipe; the gap is building + resolving the project.nmetulev commentedon Oct 8, 2026
Status: #984 implements
.vcxprojas the entry project forwinapp run, plus a clear error when a C# app references a C++ project. Still open from this issue:.vcxprojwith Visual Studio's MSBuild (today winapp stops early and tells the user to build with MSBuild and re-run with--no-build).Support C++ (.vcxproj) projects in winapp run (#984)
winapp run: fix packaged C++ Debug apps failing on the debug CRT path (…