Side by Side MAUI possible?

Jim Borden 20 Reputation points
2023-08-25T00:26:19.8533333+00:00

I am getting increasingly aggravated and defeated by this new distribution method.  Basically from what I can tell, every release of the .NET SDK brings with it a new version of maui workloads that need to be installed via dotnet maui install / update / whatever.  These, however, appear to be global and destructive so that while you can install any number of SDKs side by side, maui workloads are always overwriting each other.  Here is where that becomes terrible:

 

My organization expresses a desire to maintain compatibility through patches on a given release line as we are developing an SDK rather than an app.  For example, say we have 3.1.x which was released before .NET 7, and then 3.2.x that was released after .NET 7.  3.1.x is deploying for .NET 6 targets (yes I know they are out of support, but the stance is that we don't want to force our users to upgrade .NET versions just to get a fix of a given line).

 

However this seems just needlessly and aggressively difficult to achieve.  Upgrading Visual Studio itself upgrades the .NET SDK, which for all intents and purposes bans you from building for a .NET 6 target with MAUI.  Errors will come with things like "Microsoft.iOS references System.Runtime 7.0.0 but the build found 6.0.0".  Is there any sane way to accomplish this or do we have to give up and force users to upgrade every year even to pick up things like a security fix?

 

What I want is a way to be able to build both (for example) net6.0-android and net7.0 android on the same machine without having to go through an enormous song and dance. I don't necessarily mean that the .NET SDK has to continue doing so, but can't I have, for example, 7.0.1xx and 7.0.4xx side by side, each with their own versions of the maui workloads?

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,141 questions
.NET CLI
.NET CLI
A cross-platform toolchain for developing, building, running, and publishing .NET applications.
326 questions
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 60,361 Reputation points
    2023-08-25T16:17:11.11+00:00

    While net6 and net7 run side by side, patches don’t. You should have no issue building and release a net6 and net7 version. .net patch releases are not supposed to have any new features, or breaking changes, only bug fixes.

    the workload is visual studio tooling to build, debug and publish. A new net version requires a new workload. this workload should have no effect on the previous version.

    now Maui is often used for mobile development. Here is where you may have issues. The native mobile sdks and tools are not on the Maui release schedule. A mobile sdk change may require a new Maui release to support. A change in mobile builds tools may require a new release of the visual studio workload.

    for example a new iOS release requires a new Xcode release. To support this a new new Maui release is required. Unlike android, iOS users update pretty quickly, so you will need a new iOS release pretty close to iOS release date.

    if you are supplying a sdk, you will probably need to support pre-releases. As users can install beats versions. Say you now have a net6 and a net7 release. You will need to retest as each sdk as new mobile o/s are released, and have a quick release cycle for fixes.

    a practical issue you will have is keeping the Maui workloads current enough to support new mobile releases.


1 additional answer

Sort by: Most helpful
  1. Jim Borden 20 Reputation points
    2023-08-26T01:22:04.4166667+00:00

    I just thought of something after typing this that goes against the way I understand .NET SDK but sort of makes sense given all these restrictions. To continue building for .NET 6 MAUI, am I required to use the .NET 6 SDK? This is a break in behavior from the routine whereby a newer SDK can build for an older runtime.