Open rmarinho opened 1 year ago
From the binlog, there are two packs identified as missing: Microsoft.Maui.Sdk.net7 and Microsoft.Maui.Resizetizer.Sdk. Our logic here tries to map the pack onto the first workload it finds that requires these packs which happens to be maui-tizen. @jonathanpeppers can the workloads be reordered in the workload manifest so that a different one ends up being the one reported or should we try to have a more limited list of which we'd report (which would be a bit hacky)
@marcpopMSFT I believe maui-tizen
is listed somewhere in the middle:
If you have a suggestion like "put it first" or "put it last", @rmarinho should give it a try. You can edit the file locally at:
C:\Program Files\dotnet\sdk-manifests\7.0.100\microsoft.net.sdk.maui\WorkloadManifest.json
@dsplaisted should we have more predictable code in the sdk or just rely on the order? @jonathanpeppers , I think putting it last should mean it's not the one listed if this particular issue is hit. I'd put them in the order you'd want them to be listed in the case of an error like this. Of course, I'm assuming that the order in the manifest impacts this.
We try to suggest the "best" workload to install that will satisfy the packs that are needed to build the project. We define "best" as "requiring the fewest additional workload packs to be installed". So probably in this case installing the Tizen workload would result in installing fewer additional packs than the maui workload, and both would satisfy the requirements.
Or there could be a bug in the code. The code is here: https://github.com/dotnet/sdk/blob/main/src/Resolvers/Microsoft.NET.Sdk.WorkloadManifestReader/WorkloadSuggestionFinder.cs
What i don't understand is that if i m not building for that workload, why would it throw?! if i just need Microsoft.Maui.Sdk.net7 and Microsoft.Maui.Resizetizer.Sdk for the other workloads that i specify on my csproj.
The SDK doesn't know which workload you need, just which workload packs are missing. There can be multiple workloads that would supply those packs. In this case it looks like either the Tizen or Maui workloads would install the packs that are needed, but the Tizen workload would overall install fewer additional packs, so it suggests that one.
I have resolved the same tizen error after many hours thanks to this tidbit: "To use Visual Studio for Mac with .NET 8, enable the Visual Studio > Preferences > Other > Preview Features > Use the .NET 8 SDK if installed (requires restart) checkbox." To double check, once I turn this feature off again, maui-tizen missing workload error is back. Hope this helps somebody else as well!
Is there a fix planned for this ? This error is unfriendly and confusing and the suggested "fix" in the error message does not always work.
I am surprised installing MAUI workload from VS 2022 does not install maui-tizen
, if it is really required, Why is it so ? The builds from Visual Studio still do not work even if you install maui-tizen like the error message asks you to, i.e. via dotnet workload restore
. This makes it very ugly to have MAUI enabled in managed environments where the developers may not necessarily have access to a privileged shell.
Why is barrier to entry so high 😞
@avin3sh Hey, if you’re on Mac, this fixed it for me: "To use Visual Studio for Mac with .NET 8, enable the Visual Studio > Preferences > Other > Preview Features > Use the .NET 8 SDK if installed (requires restart) checkbox."
Thanks @SilenceCZ -- I did see your earlier suggestion, unfortunately in my case we are using Windows platform and toggling preview features did not help. We already have .NET 8 SDK in our environment, btw.
What concerns me more
(1) Enabling MAUI Workload through Visual Studio "repair" option is not enough -- shouldn't it install all the necessary workloads needed to build a MAUI app ? It installs maui-windows
, maccatalyst
, ios
and android
and looks like these are not sufficient to build the app on Windows -- even if you are not targeting Tizen
(2) The fix in the error message does not work - dotnet workload restore
was not sufficient. I had to explicitly install dotnet workload install maui-tizen
, dotnet workload install maui
and then finally dotnet workload restore
and then exit and re-launch Visual Studio Window.
It could be that the issue lingers somewhere in VS/MSBUILD integration, therefore not quite relevant as dotnet SDK issue, but the message could have been more helpful.
Describe the bug
When trying to build a project without any workloads for .NET Multi-platform App UI (MAUI) , the build process fails with an error related to "maui-tizen" even though it is not required for the current project.
To Reproduce
repo: https://github.com/rmarinho/DotNetTestTizen
Exceptions (if any)
binlog : test-2.binlog.zip
Expected Result: The build process should throw a error saying maui workload needs to be installed.
Further technical details