Skip to content

[Feature]: winapp run for apps packaged by a Windows Application Packaging Project (.wapproj) #1041

Open

Description

Is your feature request related to a problem? Please describe.

A common way to package existing desktop apps (WPF, WinForms, Win32/C++, WinUI 3) is Visual Studio's Windows Application Packaging Project (.wapproj). The app project (.csproj or .vcxproj) has no appxmanifest of its own. The .wapproj references it and owns packaging:

  • One or more Package*.appxmanifest items, sometimes picked by an MSBuild property for branding or channel.
  • EntryPointProjectUniqueName to choose the entry app.
  • Often several projects aggregated into one package: helper exes, execution aliases, COM servers, shell extensions.
  • Dependencies may come from a central/global packages.config or Central Package Management rather than one beside the app project.

#680 names .wapproj as a follow-up, and #984 added .vcxproj/.sln support but explicitly not .wapproj. Today, on WinApp CLI 0.7.2-prerelease.43 (observed on a C++/WinRT WinUI 3 app; project names shortened):

1. The .wapproj itself is rejected (for any language):

> winapp run src\App.Package\App.Package.wapproj --no-build --no-launch
🔎 Resolving project...
❌ '...\src\App.Package\App.Package.wapproj' is not a runnable input. Pass a .cs file-based app, a .csproj or C++ .vcxproj project, a .sln/.slnx solution, a directory containing one, or a build-output folder.

2. The app project it packages is treated as unpackaged. winapp finds the solution, but classifies the manifest-less project as WindowsPackageType=None and doesn't notice that a .wapproj in the same solution packages it:

> winapp run src\App\App.vcxproj --no-build --no-launch
🔎 Resolving project...
🔎 App.vcxproj  ·  Debug | x64  ·  App.slnx
❌ The option(s) --no-launch don't apply to unpackaged apps — they're only valid for packaged (MSIX) apps. 'App.vcxproj' resolves to an unpackaged WinUI app (WindowsPackageType=None). Remove them, or make the app packaged to use them.

> winapp run src\App\App.vcxproj --no-build --detach --json
{
  "ProcessId": 18692
}

For an app that only works packaged (here a framework-dependent WinUI 3 app), the process exits silently within ~6 s, with no error or hint. The same classification presumably applies to a .csproj packaged by a .wapproj (not verified). For WPF/WinForms apps it means they silently run without package identity, so identity-dependent APIs behave differently than in the shipped app.

What works today is folder mode on the wapproj build output, which #1030 fixed. Verified on prerelease.43:

winapp run src\App.Package\bin\x64\Debug --manifest ...\AppxManifest.xml --exe App.exe --output-appx-directory ... --no-launch --json

That returns the AUMID. But it needs a separate msbuild invocation and hand-picked --manifest/--exe.

Describe the solution you'd like

  • winapp run Foo.wapproj (and --project Foo inside a .sln/.slnx):
    • Build through the wapproj with VS MSBuild (the wapproj needs the DesktopBridge targets, not dotnet build), so every ProjectReference is built.
    • Stage from the generated AppxManifest.xml + .build.appxrecipe.
    • Launch the entry app from EntryPointProjectUniqueName, or --app-id for multi-<Application> manifests.
  • Pass -p properties through to pick among several AppxManifest items.
  • Framework dependencies: read the PackageDependency entries (e.g. Microsoft.WindowsAppRuntime.*) from the generated AppxManifest.xml, not just a packages.config beside the project.
  • Detect wapproj packaging for app projects: when the selected .csproj/.vcxproj has no manifest and a .wapproj in the solution references it, don't classify it as unpackaged. Route through the .wapproj, or at least warn: "App.vcxproj is packaged by App.Package.wapproj; run that project (or --project App.Package) instead."
  • Silent exit hint: if an app launched as unpackaged exits within a few seconds with no output, suggest --debug-output and mention the packaging-project possibility.

Additional context

Related: #680, #984, #1030. --no-build plus wapproj staging would also give fast inner-loop runs for large solutions built elsewhere (full builds can take 20+ minutes).

Drafted with GitHub Copilot; outputs are from real runs on 0.7.2-prerelease.43 (project names shortened).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions