We have developed an application which is Kvaser(Cable) hardware support application which supports only WPF applications. We have done this in Xamarin Forms by adding Windows Application project and referencing UWP application to Windows Application and we are communicating using App Service Connection the solutions we have done is working fine in Xamarin Forms. Now we are planning to migrate Xamarin Forms to .NET MAUI, Is there any work around to achieve the same solution in MAUI.
You should be able to achieve the same scenario in a MAUI app. MAUI (and Xamarin) give the app access to the underlying native platform, and what you're doing is primarily at that level. That you have MAUI (or Xamarin Forms) on top is largely irrelevant, and you will have more capabilities in the .Net 6 + WinUI platform than in UWP.
Key points:
- The UI layer (Xamarin Forms vs MAUI) is not related to connecting to hardware; the limitations (or lack thereof) are on the underlying platform.
- Your Xamarin Forms (Windows) app is a UWP app, which runs in a sandbox with restricted system access
- MAUI (Windows) apps use .Net 6 + WinUI 3 (Windows App SDK fka Reunion), which is not sandboxed.
A few options:
- From a quick glance through the WindowsAppSDK repo, I think you should be able to continue using your App Service Connection solution in the WinUI solution. The limiting factor is the app ID, which you'll have with a WinUI app packaged in an MSIX. This should work essentially the same as in your existing UWP app.
- If your dependency is just on the Kvaser SDK and not the WPF UI itself then you should be able to call it directly from your MAUI app. MAUI on Windows runs the same .Net 6 that modern WPF apps do and doesn't have the UWP sandbox limitations that would block it from talking to the Kvaser hardware. From a quick look at Kvaser's site, their SDK supports .Net Standard 2.0 and should run fine in .Net 6.
- You can use lighter weight IPC such as named pipes to communicate between your WPF app and your MAUI app.