Replies: 3 comments
-
No anwser more then a year later. I have started converting a big solution (Android and iOS using Xamarin.Forms and Mac and windows pure native). All shared code is in multiple shared projects. (one shared project for Xamarin.Forms code). Not being able to use xaml in a shared project mean major refactoring and restructuring of all projects. |
Beta Was this translation helpful? Give feedback.
-
Ridiculous isn't it? I get the impression there are about four employees working on MAUI/WinUI3 in their lunch breaks. In the end we couldn't wait around for a non-answer so we just had to have different MAUI projects for each of our apps and manually share common views between them. If you just have common code (no views) in the shared project you might be ok, although I found it was more trouble than it was worth, sometimes certain assemblies just couldn't see each other. Other than that it has been fairly smooth sailing, however I've spent the last two weeks wrestling with the iOS side of things as we had neglected to try deployment up to this point, and absolutely nothing works as it should (and did with Xamarin). The iOS simulator no longer launches on Windows or the Mac (brand new installs of Venture/Xcode), a release build hangs for hours when initiated from Windows, when built directly on the Mac it shows a black screen upon deployment, no errors in the console, doesn't crash - just nothing. All the usual causes (fullscreen mode unchecked, multiple window checked in info.plist etc) have been ruled out. The simulator build won't even deploy, giving some vague error message. Hot reload deployment of a blank MAUI project straight to a local iPad hangs on the splash screen before iOS terminates it. So my main advice would be test on all platforms at all times, I had naively assumed things would just work as they did with Xamarin, now I'm faced with the prospect of porting everything across one feature at a time into a blank project until it breaks on iOS to find out what the issue is. |
Beta Was this translation helpful? Give feedback.
-
I've spent some time looking into the SDK project system and found a workaround that 'appears' to solve this issue. Remove the shared project reference and add the external files manually in the project file with globbing. It took some experimenting to get everything to work and show up:
The files from the 'SharedProject' will now show up in the subfolder 'SharedProject' inside the main project. And the errors about
But update does not work and Include does in this scenario. It is very frustrating that I cannot find any documentation on the MauiXaml element or the Update attribute |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am just investigating what will be required to migrate our large-scale commercial POS software from Forms to MAUI.
We have a suite of apps that share some common models, functionality, views and assets - for instance login handling, accessing 3rd party APIs, button icons, sounds and also platform specific code for stuff like receipt printing and iOS barcode devices.
This means there is one App.xaml.cs file in the 'Common' shared project, one LoginPage.xaml file etc. and each Xamarin Forms App references this shared project. After login etc. we use Activator.CreateInstance() within the common login ViewModel to create and navigate to the start page for each app.
However in a MAUI template app, moving the App.xaml.cs and MainPage.xaml files to the common project means that the magic 'MauiXaml' build action that is applied to the Xaml file is not available, therefore the App.xaml.cs.g file is not auto generated. In Xamarin this is done differently with the build action being 'Embedded Resource' with a Custom Tool of MSBuild:UpdateDesignTimeXaml to handle the code generation.
Is there any way we can continue using this project structure that really works perfectly for our use case?
Beta Was this translation helpful? Give feedback.
All reactions