make .exe file out of Visual Studio uwp .appx file

2020-05-28 18:36发布

问题:

I have an uwp-app, designed with Visual Studio 2015 for windows 10 (multi-touch, etc.), but it must NOT be released via Windows Store (and yes, that includes also the kind'a "private / hidden" version via Windows store) and an installation via Powershell is a little complicated for an average customer, so I would prefer some good old .exe file.

Is there any possibility to export / release the programm instead of .appx as .exe?

Thx for any support :)

回答1:

Short answer is you can't.

As explained on this article:

To sell your Universal Windows Platform (UWP) app or distribute it to other users, you need to create an appxupload package for it. When you create the appxupload, another appx package will be generated to use for testing and sideloading. You can distribute your app directly by sideloading the appx package to a device.

So you only have three options:

  1. Create the package and upload it to the store.
  2. Create the package and perform the sideloading process.
  3. Create a new WPF application reusing the view models and logic/backend layer of the UWP one.

You might be able to create a powershell script to try and automate the process (I have never tried this), or your own application in WPF to automate it, but aside from that, no other official options are available as of today.



回答2:

It is not exactly a perfect solution but you can try these out.

  1. AppxInstaller
  2. Or write your own code for an installer. Check this answer.


回答3:

It is possible to do this using a tool called Advanced Installer. Steps

 1. Create a new Installer Project Professional.
 2. Select the files and folder option under Resources on the left side menu panel.
 3. Right click on Application Folder > Add Files. Add your certificate and appx file.
 4. Scroll down to Custom Actions tab under Custom Behavior on the left side menu panel.
 5. Under Custom Actions, add a powershell inline script.
 6. Write commands for installing the certificate and the extension. In parameter, pass 
    the certificate and appx file added to resources. Powershell commands-
    certutil -addstore "TrustedPublisher" "<path>\certificate.cer"
    Add-AppxPackage <path_to_appx_package>\uwpapp.appx
  7. Under Execution time select- "When the system is being modified"
  8. Under Execution options, select- Run with Local System with full previleges.
  9. Select Builds tab in Package Definition, 
  10. Under configuration, package type, select Single Exe Setup(With Resources).
  11. Right click on DefaultBuild and select build.This will generate an EXE file.


回答4:

  1. You can sideload you app using Group Polices
  2. You can wait for Windows 10 Anniversary Update, which can double-click install appx.