I have an Enterprise LOB scenario, where I need to communicate between my Sideloaded UWP app and multiple console applications which are developed by third parties. Internally, these console apps will be interfacing with COM ports and hardware devices.
Can I use App Service to communicate between UWP and out-of-package Console App?
Further more, the communication must be two way and asynchronous, expected flow:
- UWP -start-console-app-expect-no-response-> Console App (How to achieve this step without desktop-bridge?)
- UWP <-send-data-expect-no-response- Console App
- UWP -send-data-expect-no-response-> Console App
I have already referred the links below but according to them "Windows Application Packaging Project" is a must.
- https://stefanwick.com/2018/04/06/uwp-with-desktop-extension-part-1/
- Communication between UWP and Non UWP app
Please do suggest if there are any other alternatives too.
EDIT:
It is possible to start out-of-package Console Apps from UWP using 2 methods:
- Create a package with a Console App which can launch any other Console app(s). Refer: https://stackoverflow.com/a/49340814/10224384
- Launch Console App via protocol URI. Create a URI protocol to Console App: https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa767914%28v%3dvs.85%29 OR https://www.meziantou.net/registering-an-application-to-a-uri-scheme-using-net.htm
However, it is not possible to communicate between the out-of-package Console App and the UWP via the App Service. Even though, the Console app has reference to Microsoft.Windows.SDK.Contracts nuget package and can access AppServiceConnection API since AppServiceConnection class has the DualApiPartitionAttribute. The connection cannot be established with the AppServiceUnavailable Error.
Hence, Now I'm trying a new solution with option 1 from above as mentioned here: https://learn.microsoft.com/answers/questions/1166/how-uwp-can-communicate-with-windows-service.html?childToView=1211#answer-1211
Fallback options that need investigation:
- WCF Http/NamedPipes
- UWP starts Console App, Console App responds by invoking a Launch by URI protocol (Of course the UWP needs to register the Protocol)