Documentation for Multi-Project setup.
See original GitHub issueDescription
In the MAUI GA blog entry, there is a section stating that MAUI supports being used in a “multi-project” (Multiple Projects with single target platforms, as opposed to a “Single-Project” which contains multiple target frameworks). However, I can’t set it up. There’s no template, nor samples in the MAUI repos for how to pull this off.
I’ve tried creating my own project (https://github.com/drasticactions/MauiMultiProject) to show this. While I was able to get Android to launch from a MAUI app based in a class project, I’ve been unable to get the others set up successfully. WinUI will throw an exception that Application.Current
is null.
I’m not sure how to set this up properly. Since we say this is a supported usecase, I think there should be documentation (either a sample or a template) with it setup. That will make it easier for anyone to integrate MAUI into a “single” application project.
Steps to Reproduce
Try and run https://github.com/drasticactions/MauiMultiProject on various platforms.
Version with bug
Release Candidate 3 (current)
Last version that worked well
Release Candidate 3 (current)
Affected platforms
iOS, Android, Windows, macOS
Affected platform versions
All
Did you find any workaround?
No response
Relevant log output
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:14
- Comments:19 (9 by maintainers)
Top GitHub Comments
@jfversluis You comment your own comment. Pretty awesome 😉 Ok, let’s get more serious.
I had success with the AndroidResources in a Multi-Project Solution. But it’s not fully as you explained.
AndroidResource
.AndroidReosurce
.After some investigation I found @mattleibow reported an issue Not easy to add a “AndroidResource” to a maui project and Resource is ambiguous.
So the trick is to fully qualify your Resource in the Android Project, because one is the MAUI Resource and one is the Android Platform Resource. So you end up with to different created
Resource.designer.cs.
+1 on this. Would really appreciate some documentation. It is very difficult to maintain in a single project and most of us migrating from xamarin with an existing CI/CD environment would prefer to achieve the same project structure in MAUI as well.
Although I am able to build and run the given repo sample (with slight changes) successfully for
iOS
andDroid
with .net7, there are still build configuration and plaform related issues especially in iOS.As soon as I set
<UseMaui>
flag as true in anet7.0-ios
target project, I am unable to create platformsiPhone
andiPhoneSimulator
under the build configuration. Explicitly setting platforms doesn’t work either.<Platforms>iPhone;iPhoneSimulator;AnyCPU</Platforms>
Shared project containing xaml views:
iOS project:
Droid project: