question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Documentation for Multi-Project setup.

See original GitHub issue

Description

image

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.

image

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:open
  • Created a year ago
  • Reactions:14
  • Comments:19 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
ericbrunnercommented, Jun 28, 2023

Resources aren’t set to BuildAction AndroidResource.

@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.

  1. The mipmap/icon compiler error could be fixed by right-click on image and set to AndroidResource.
  2. My Drawable icons where not accessible dispite that I set all Drawable Android images to 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.

image

1reaction
returnZrocommented, May 29, 2023

+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 and Droid with .net7, there are still build configuration and plaform related issues especially in iOS.

As soon as I set <UseMaui> flag as true in a net7.0-ios target project, I am unable to create platforms iPhone and iPhoneSimulator under the build configuration. Explicitly setting platforms doesn’t work either.

<Platforms>iPhone;iPhoneSimulator;AnyCPU</Platforms>

Shared project containing xaml views:

<TargetFramework>net7.0</TargetFramework>
<UseMaui>true</UseMaui>
<SingleProject>false</SingleProject>

iOS project:

<TargetFramework>net7.0-ios</TargetFramework>
<OutputType>Exe</OutputType>
<UseMaui>true</UseMaui>
<SingleProject>false</SingleProject>

Droid project:

<TargetFramework>net7.0-android</TargetFramework>
<OutputType>Exe</OutputType>
<UseMaui>true</UseMaui>
<SingleProject>false</SingleProject>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Structuring and Building a Software Component with Gradle
First, this chapter describes how to structure your software project using a Gradle multi-project. In this documentation, we consider this to be a...
Read more >
Configure a multi-project setup | Binary Authorization
This tutorial describes how to use Binary Authorization in a multi-project configuration. For a simpler single-project configuration, see Get started using ...
Read more >
sphinx-multiproject - Read the Docs
Build multiple Sphinx projects from a single repository on Read the Docs. ... If you aren't using Read the Docs to build your...
Read more >
Managing multiple projects and their dependencies
Manage related projects in one place using a workspace, or configure build-time dependencies between different Xcode projects using cross-project references ...
Read more >
Create a Multi-Project
Create a multi-project by simply using the menu Project - New Multi-Project Workspace. The multi-project file has the extension .UVMPW.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found