I had high hopes for exploring XAML GUI development with legacy MFC code based on this Microsoft link: Microsoft using XAML with MFC.
I'm working trying to build and run the MFCApp.exe from https://github.com/microsoft/Xaml-Islands-Samples.git
However after spending a half day with it I'm not sure it will be as good as I hoped. I was able to get this to build... but not to run. So there is no "hello world" working example to lead me on the green path here. I realize working with GUI development is difficult.. but I do expect working examples from Microsoft when they say "Here are some examples" they should work out of the box.
Issues remain registering the application which are beyond my current knowledge base.
One discovery is that using Visual Studio 2019 newer than 16.5.4 causes issues. Apparently there is a .NET SDK change between 16.5.4 and after 16.8. Trying to build this sample code from GITHUB fails on the latest Visual Studio due to a missing .NET SDK. This problem vanishes if you go down to earlier 16.5.4. See Microsoft Side by side installs of VisualStudio for information on how to have multiple versions of VS2019 installed at one time.
We also had to do some admin installs of two packages using a Elevated PowerShell.
Add-AppxPackage -Path "C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs\Microsoft.VCLibs\14.0\Appx\Debug\x64\Microsoft.VCLibs.x64.Debug.14.00.Desktop.appx"
and
Add-AppxPackage -Path "C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs\Microsoft.VCLibs\14.0\Appx\Debug\x64\Microsoft.VCLibs.x64.Debug.14.00.appx"
So at the moment, Application Registration issues fail, and the app crashes. The assumption is that the Registration is causing the crash.. not sure.
In VS2019 16.11.x we can bypass the deployment error but get a crash. The MFCApp.exe also crashes when we try executing it manually. In VS2019 16.5.4 we get a "you can't debug due to deployment failure" which makes sense.
At this point I'd like to know how the deployment triggers registration, what we need to do to get the application to register... (is this really required?) If registration is required then deployment of an XAML islands solution will be problematic as old MFC legacy apps and the community of users is not familiar with the care and feeding of registration. Hence my problem.
Just posting this in case others were thinking of using the XAML islands and had difficulties. It takes about half a day to upgrade VS2019 for the workflows required and even then the example fails to deploy although it builds.