1

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.

3 Answers3

2

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.

0

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.

Nick
  • 71
  • 1
  • 7
0

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.

Arif
  • 11
  • 2
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/34851336) – Chris Catignani Aug 20 '23 at 15:34