Reputation: 161
I installed .net maui through visual studio 2022 and created a new project. The template is there, it all looks fine. Until I go to build and debug the app on my windows machine. No changes were made to the project but it throws this error: NETSDK1147: To build this project, the following workloads must be installed: maui-windows.
The workload is installed though: dotnet workload list
Tried running the dotnet workload restore
in the visual studio project terminal but it failed: Failing to build and restore workload
Tried to install all maui workloads again: workload installed
Tried to repair workloads: workloads repaired
Still doesn't want to bulid the app. Not sure what else to try.
Upvotes: 9
Views: 11512
Reputation: 3595
In our csproj files, we have the android version of Maui turned off (commented out). However, after certain updates we get the Error NETSDK1147
To fix this, run:
In a terminal window: dotnet list package --outdated
Upvotes: 0
Reputation: 11
I have experienced missing platforms workload problem (android workload, ios workload or windows workload) upon failed build on MAUI projects and I found the projects are configured to the incorrect target framework. It seems Visual Studio does not help you to automatically find the configured target framework after install the updates. I have to manually change the Target Frameworks tag in project file, to the correct one. For example, from net6 to net7, then unload the project and reload will solve the problem and build as normal in my case.
I hope this help.
Upvotes: 0
Reputation: 99
I hope someone can provide more information to be honnest. This is an issue i see every time i update VS2022. I have to manually reinstall maui, ios, android maui-ios and maui-android after i updated. Then restart visual studio.
For me, the workloads are listed also.
Upvotes: 0
Reputation: 161
Ok after all these steps, all I had to do was restart the Visual Studio app and reopen the solution. Works like normal.
Most likely fix for this was the repair command; before I tried that, I already restarted the system without luck.
Sorry for bothering and hopefully I try turning it off and on again before asking a question lol.
Upvotes: 7