WindowsAppSDK icon indicating copy to clipboard operation
WindowsAppSDK copied to clipboard

In UWP Release version cannot run by double clicking the exe file in the folder?

Open sudharsan-narayanan opened this issue 1 year ago • 3 comments

Describe the bug

When UWP compiled into Release version, after build

Cannot run by double clicking the exe file in the folder?

Steps to reproduce the bug

  1. Create a new UWP project.
  2. Add any MS control.
  3. Run the UWP project.
  4. Now open the bin folder and try to launch the exe.

Note: exe won't launch.

Expected behavior

Need to launch the exe in double click by UWP.

Screenshots

No response

NuGet package version

Windows App SDK 1.5.3: 1.5.240428000

Packaging type

No response

Windows version

No response

IDE

No response

Additional context

No response

sudharsan-narayanan avatar May 13 '24 14:05 sudharsan-narayanan

UWP app can not be opened by exe! If you mean winui app or wasdk app you need to change your app from packaged to unpackaged so you can run your app by double clicking on exe file

ghost1372 avatar May 13 '24 15:05 ghost1372

Generally, packaged apps are designed to only run when activated - like launched from the start menu, or from a file-type/protocol-scheme invocation, etc. Windows App SDK does not support UWP (packaged, AppContainer, CoreWindow presentation, CoreApplication lifecycle) applications at this time.

As @ghost1372 says, UWP applications built with the Windows Platform SDK using one of the Visual Studio Universal Windows App projects cannot be launched by double-click. Instead, use the "Run" option in Visual Studio. Or use the "Deploy" option and then find your application in the Start Menue.

This is by design.

jonwis avatar May 13 '24 18:05 jonwis

Generally, packaged apps are designed to only run when activated

As Jon mentioned, UWP apps are run via activation via ApplicationActivationManager's ActivateApplication() or AppListEntry.LaunchAsync(). This is what Visual Studio does when you hit F5 to run you project.

But if you need to run your app by launching an executable (via CreateProcess, ShellExecute, etc) you can define an App Execution Alias for your app and run that.

Here's additional information about App Executation alias: https://blogs.windows.com/windowsdeveloper/2017/07/05/command-line-activation-universal-windows-apps/

DrusTheAxe avatar May 19 '24 04:05 DrusTheAxe

Closing as answered / By Design.

codendone avatar May 23 '24 16:05 codendone