How to package a UWP app with a Win32 background process using Desktop App Converter

1.2k views Asked by At

Following the guidance presented in this video and this tutorial, I have successfully created a UWP app that is able to connect to a USB-attached POS printer via a Win32 background process, using Desktop Bridge.

My app runs fine and prints correctly while debugging in Visual Studio, but I am unable to create a package to deploy it. My end goal is a Windows Store package, but I am initially happy with a package that can be sideloaded onto another local computer.

Here's what I have tried:

  1. I used the Store > Create App Packages option within Visual Studio to create an app package in the usual manner. This package installs correctly, but does not run, reporting that is does not contain the background process executable. The build process for my main UWP app includes a build event that copies the executable files of the Win32 background process project into a subdirectory of the AppX directory, but they seem to be ignored during packaging.

  2. I understand from the this tutorial (specifically the author's reply to a reader's question) that this packaging process needs to be performed using Desktop App Converter, which I have installed and provisioned with a base image, as described here. So I tried creating a package from the Visual Studio output in the AppX directory, directly referencing the UWP executable as the entry point of the packaged application. Unfortunately, Desktop App Converter refuses this, with the error E_APP_EXECUTABLE_NOT_FOUND. It seems that a UWP .EXE file is not really an executable.

I understand from this article that what I am trying to achieve entails both processes running inside the same UWP container. This seems to be what is happening when I debug my UWP app, but it's not clear how to package that scenario.

Can anyone please explain or point me to a resource that explains how to do this?

Many thanks, in advance.

1

There are 1 answers

1
Stefan Wick  MSFT On BEST ANSWER

Desktop App Converter is not the right tool for this scenario. You will need to update the appxmanifest and the VS project settings to make this work correctly.

There are a couple of samples published here that you can follow: https://github.com/Microsoft/DesktopBridgeToUWP-Samples/tree/master/Samples/UWP%20Systray

https://github.com/Microsoft/DesktopBridgeToUWP-Samples/tree/master/Samples/UWP%20Office%20Interop

If you are building your app with .NET, there are some additional steps to be aware of, in terms of create the package for Store submission: https://learn.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-packaging-dot-net

Happy to help if more questions come up in the process.