dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.28k stars 1.76k forks source link

How to downgrade maui sdk from 7.0.58 to 7.0.52 #12998

Closed juwens closed 1 year ago

juwens commented 1 year ago

Description

We have several issues with the 7.0.58 and want to go back to 7.0.52. For example https://github.com/dotnet/maui/issues/11579 but also things like this C:\Program Files\dotnet\sdk\7.0.102\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To build this project, the following workloads must be installed: ios [D:\gitlab\builds\QFfMLjaN\0\Foo\Bar\Baz.csproj::TargetFramework=net7.0-ios] despite ios and maui-ios is already installed with maui-workload of VS.
Depending on when people installed there VS, some colleagues/build-servers have 7.0.52, others have 7.0.58.
Dotnet workload provides no obvious way to downgrade.
What is your suggested way to downgrade the installed maui-sdk from 7.0.58 to 7.0.52.

We are on .net sdk 7.0.102.

Steps to Reproduce

  1. install visual Studio

Link to public reproduction project repository

https://github.com/dotnet/maui

Version with bug

7.0 (current)

Last version that worked well

7.0 (current)

Affected platforms

iOS, Android, Windows, Other (Tizen, Linux, etc. not supported by Microsoft directly)

Affected platform versions

all

Did you find any workaround?

no

Relevant log output

No response

ghost commented 1 year ago

Thanks for the issue report @juwens! This issue appears to be a problem with Visual Studio, so we ask that you use the VS feedback tool to report the issue. That way it will get to the routed to the team that owns this experience in VS.

If you encounter a problem with Visual Studio, we want to know about it so that we can diagnose and fix it. By using the Report a Problem tool, you can collect detailed information about the problem, and send it to Microsoft with just a few button clicks.

  1. Go to the Visual Studio for Windows feedback tool or Visual Studio for Mac feedback tool to report the issue
  2. Close this bug, and consider adding a link to the VS Feedback issue so that others can follow its activity there.

This issue will be automatically closed in 3 days if there are no further comments.

juwens commented 1 year ago

Jesus, can you (the project team, not you personally) please stop playing the pingpong (report in VS) thing, i'm so tired of this attitude. Take responsibility for the maui issues, and don't frustrate customers even more. No it's not a VS issue. This is a maui architectural design issue and the way YOU choose to distribute it with dotnet workload!

So instead of saying "report to VS", can you (for the love of god) PLEASE provide the developers out there with a way, on how to downgrade maui-sdk (which is handled by dotnet workload, not VS!!).

See also: https://github.com/dotnet/maui/issues/8985

Hooterr commented 1 year ago

sudo dotnet workload update --from-rollback-file https://maui.blob.core.windows.net/metadata/rollbacks/7.0.52.json worked for me on mac, but didn't work on Windows (still installs 7.0.58).

For mac it's even worse because it asks you to upgrade to xcode 14.2 which isn't even supported by Visual Studio for Mac so basically you have a broken environment without an obvious way to roll-back...

Eilon commented 1 year ago

@mattleibow - can you confirm that this issue should move to VS Feedback?

FM1973 commented 1 year ago

Reading stuff like this will stop me from updating visual studio.... Please change the way we can update .net maui. Nuget seems to be a lot better for all of us. So anyone can decide which version of maui to use...

LennoxP90 commented 1 year ago

put this in your .csproj

<!-- Pin the MAUI version -->
<MauiVersion>7.0.52</MauiVersion>
juwens commented 1 year ago

@Hooterr thanks for the suggestion.

sudo dotnet workload update --from-rollback-file https://maui.blob.core.windows.net/metadata/rollbacks/7.0.52.json worked for me on mac, but didn't work on Windows (still installs 7.0.52).

For mac it's even worse because it asks you to upgrade to xcode 14.2 which isn't even supported by Visual Studio for Mac so basically you have a broken environment without an obvious way to roll-back...

I tried that previously and just again now after you suggested it, sadly it seems, it doesn't do any significant change.

image

dotnet workload list lists 7.0.58, as before.
Maybe i am misinterpreting the output of the tool 🤔 Does it only show the latest version of installed SDKs?
Because, if i do dir 'C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\', 7.0.52 & 7.0.58 are installed.

.
|--= 7.0.52
| \--- Sdk
|   |--= AutoImport.props
|   |--= BundledVersions.targets
|   |--= maui-blazor.aotprofile
|   |--= maui.aotprofile
|   |--= Microsoft.Maui.Controls.Build.Tasks.dll
|   |--= Microsoft.Maui.Controls.Build.Tasks.pdb
|   |--= Microsoft.Maui.Controls.DefaultItems.targets
|   |--= Microsoft.Maui.Controls.dll
|   |--= Microsoft.Maui.Controls.pdb
|   |--= Microsoft.Maui.Controls.props
|   |--= Microsoft.Maui.Controls.Sdk.After.targets
|   |--= Microsoft.Maui.Controls.Sdk.targets
|   |--= Microsoft.Maui.Controls.SingleProject.props
|   |--= Microsoft.Maui.Controls.SingleProject.targets
|   |--= Microsoft.Maui.Controls.SourceGen.dll
|   |--= Microsoft.Maui.Controls.SourceGen.pdb
|   |--= Microsoft.Maui.Controls.targets
|   |--= Microsoft.Maui.Controls.Xaml.dll
|   |--= Microsoft.Maui.Controls.Xaml.pdb
|   |--= Microsoft.Maui.Core.props
|   |--= Microsoft.Maui.Core.Sdk.After.targets
|   |--= Microsoft.Maui.Core.Sdk.targets
|   |--= Microsoft.Maui.Core.targets
|   |--= Microsoft.Maui.dll
|   |--= Microsoft.Maui.Essentials.dll
|   |--= Microsoft.Maui.Essentials.pdb
|   |--= Microsoft.Maui.Graphics.dll
|   |--= Microsoft.Maui.Graphics.pdb
|   |--= Microsoft.Maui.pdb
|   |--= Microsoft.Maui.Sdk.After.targets
|   |--= Microsoft.Maui.Sdk.targets
|   |--= Mono.Cecil.dll
|   |--= Mono.Cecil.Mdb.dll
|   |--= Mono.Cecil.Mdb.pdb
|   |--= Mono.Cecil.pdb
|   |--= Mono.Cecil.Pdb.dll
|   |--= Mono.Cecil.Pdb.pdb
|   |--= Mono.Cecil.Rocks.dll
|   |--= Mono.Cecil.Rocks.pdb
|   |--= Sdk.targets
|   |--= System.CodeDom.dll
|   |--= WinUI.targets
|   \--- WinUI.Unpackaged.targets
\--- 7.0.58
  \--- Sdk
    |--= AutoImport.props
    |--= BundledVersions.targets
    |--= maui-blazor.aotprofile
    |--= maui.aotprofile
    |--= Microsoft.Maui.Controls.Build.Tasks.dll
    |--= Microsoft.Maui.Controls.Build.Tasks.pdb
    |--= Microsoft.Maui.Controls.DefaultItems.targets
    |--= Microsoft.Maui.Controls.dll
    |--= Microsoft.Maui.Controls.pdb
    |--= Microsoft.Maui.Controls.props
    |--= Microsoft.Maui.Controls.Sdk.After.targets
    |--= Microsoft.Maui.Controls.Sdk.targets
    |--= Microsoft.Maui.Controls.SingleProject.props
    |--= Microsoft.Maui.Controls.SingleProject.targets
    |--= Microsoft.Maui.Controls.SourceGen.dll
    |--= Microsoft.Maui.Controls.SourceGen.pdb
    |--= Microsoft.Maui.Controls.targets
    |--= Microsoft.Maui.Controls.Xaml.dll
    |--= Microsoft.Maui.Controls.Xaml.pdb
    |--= Microsoft.Maui.Core.props
    |--= Microsoft.Maui.Core.Sdk.After.targets
    |--= Microsoft.Maui.Core.Sdk.targets
    |--= Microsoft.Maui.Core.targets
    |--= Microsoft.Maui.dll
    |--= Microsoft.Maui.Essentials.dll
    |--= Microsoft.Maui.Essentials.pdb
    |--= Microsoft.Maui.Graphics.dll
    |--= Microsoft.Maui.Graphics.pdb
    |--= Microsoft.Maui.NuGets.Sdk.targets
    |--= Microsoft.Maui.pdb
    |--= Microsoft.Maui.Sdk.After.targets
    |--= Microsoft.Maui.Sdk.targets
    |--= Mono.Cecil.dll
    |--= Mono.Cecil.Mdb.dll
    |--= Mono.Cecil.Mdb.pdb
    |--= Mono.Cecil.pdb
    |--= Mono.Cecil.Pdb.dll
    |--= Mono.Cecil.Pdb.pdb
    |--= Mono.Cecil.Rocks.dll
    |--= Mono.Cecil.Rocks.pdb
    |--= Sdk.targets
    |--= System.CodeDom.dll
    |--= WinUI.targets
    \--- WinUI.Unpackaged.targets
juwens commented 1 year ago

@LennoxP90

put this in your .csproj

<!-- Pin the MAUI version -->
<MauiVersion>7.0.52</MauiVersion>

How sure are you, that this suggestion works?

Please do not use MauiVersion property going forward, it is no longer supported. https://github.com/dotnet/maui/issues/4812#issuecomment-1075583594

LennoxP90 commented 1 year ago

nothing broke haha, I guess you can never know but in all honesty there should be a way to pin the version outside of Visual studio that can be directly sourced with the application, just blanketly saying don't use x feature without an alternative is pure insanity

juwens commented 1 year ago

@LennoxP90

nothing broke haha, I guess you can never know but in all honesty there should be a way to pin the version outside of Visual studio that can be directly sourced with the application, just blanketly saying don't use x feature without an alternative is pure insanity

There definitely should be a way to pin a version, like with nugets.

I'm really eager to get to the bottom of this MauiVersion thing, but apparently with .Net 7 "MauiVersion" does nothing. At least i cannot find any code in the Maui-Repo with this phrase.

image

if it is used, it should appear be at least in some files (props, targets, cs, ...), right? Like it did in the .Net 6 times.

LennoxP90 commented 1 year ago

@Redth, is there a reason MauiVersion was removed? is there alternative we should be using?

Hooterr commented 1 year ago

I tried that previously and just again now after you suggested it, sadly it seems, it doesn't do any significant change.

Didn't work for me on Windows either, but worked on my Mac. Go figure.

I remember during the recent MAUI standup someone from MS said that the thing with workloads is that they're 'Trying to build a bus while driving it' , which probably means we'll all end up in a ditch by the side of the road, wheels up lol (don't ban me, please, I'm just trying to bring attention to the issue)

juwens commented 1 year ago

@LennoxP90 i did some further research concerning MauiVersion.
It's still there, github's search engine is just garbage.

I found it at several places:

And i can confirm, that it still kinda work's despite the comment https://github.com/dotnet/maui/issues/4812#issuecomment-1075583594 (from march 2022) that it is not supported anymore.

It uses the assemblies from the specified Version for running the app, so your App has loaded 7.0.52 maui assemblies, when you set MauiVersion=7.0.52
BUT it uses the latest installed maui SDK to BUILD the app. (which would be 7.0.58). <- confirmed that with binlog
I can only guess, that this discrepancy is the reason, why it is not recommended.

image

LennoxP90 commented 1 year ago

that could explain when i removed the <MauiVersion> that my app behaved differently as in regressions from latest Maui

mattleibow commented 1 year ago

@juwens is right on every point! Exactly.

ghost commented 1 year ago

This issue is being closed due to inactivity. If this issue is still affecting you, please follow the steps above to use the VS Feedback Tool to report the issue.

juwens commented 1 year ago

And again, the Maui team closes an unfixed issue as “completed”.
I’m speechless.
Despite you call the property MauiVersion, which was deprecated a long time ago and solves only half of the problem, a “solution”.

LennoxP90 commented 1 year ago

This is disappointing 😞

Hooterr commented 1 year ago

How is this considered resolved??

FM1973 commented 1 year ago

@mattleibow said @juwens is right.... hmmm ok. I say @juwens is right again on every point! I don´t understand as well, how this issue can be closed as "completed".

Eilon commented 1 year ago

Hi, this issue was closed perhaps by mistake. We initially thought it should move to VS Feedback, but that is perhaps not true. I re-opened this for further consideration.

There are some upcoming changes in .NET 8 / MAUI that I think could help this, via to some MAUI workload changes here: https://github.com/dotnet/maui/pull/11206

FM1973 commented 1 year ago

@Eilon This is great. But one question: Am I supposed to not upgrade VS until .net 8 is available? We are about to release a bigger app for a customer. It has happened in the past, that a new maui release brought back old bugs. On the other hand new releases may contain needed fixes. I´m not sure how to handle this, Any suggestions?

Eilon commented 1 year ago

Upgrading VS should be fine, especially to non-preview releases. Right now I don't think there's any good way to downgrade the SDK version, but at least theoretically, it also shouldn't be necessary. It's possible that some versions introduce regressions, but those regressions are themselves considered bugs, and should be fixed.

LennoxP90 commented 1 year ago

the regression is pretty much constant, I have been developing my app with MAUI since its first GA and Microsoft basically abandoned Xamarin and forced my hand but as anything collectionview, listview issues are a constant broke fix broke state every release.

Eilon commented 1 year ago

Starting with .NET 8 / MAUI I think the MAUI workload change in https://github.com/dotnet/maui/pull/11206 would help resolve this type of issue because you'll have more control over which version of MAUI each project/app uses.

LennoxP90 commented 1 year ago

so we have to wait another 8 months, got it

mattleibow commented 1 year ago

<MauiVersion> is deprecated because we don't want people to use it - because it is not perfect/satisfactory, however I am loosely un-deprecating it until we get the nugets PR merged and released.

@juwens is correct in that in order to load maui, we need a starting point. And that starting point is the version that came with VS. Then, <MauiVersion> goes ahead and replaces the maui that your apps uses. In the comment by @juwens he explains exactly why we deprecated the <MauiVersion> - it causes this very confusion. If you are to look further in the binlog, you can see that the only place we use the on-disk version is to load the <MauiVersion> version of the assemblies - and some build tasks used to get things going.

This issue is closed in that there are 2 ways to downgrade a maui app:

  1. Use MauiVersion
  2. Use the nugets PR fix that is not yet merged as it is undergoing review to ensure that we do not break everyone

If there is an issue with MauiVersion (besides the label of deprecated), then please open an issue specifically on that. It should work - deprecation at this point is just a label. However, maybe in net8 it will really be deprecated, so that is why I am working hard to get the PR merged and tested and released so that none of this version mismatch happens.