Search code examples
.netvisual-studioblazormauimaui-blazor

Why is my new Blazor Maui app install build failing?


I have a brand new blazor maui template install and I'm getting these build errors.

The target platform identifier android was not recognized. This is because MSBuildEnableWorkloadResolver is set to false which disables .NET SDK Workloads which is required for this identifer. Unset this environment variable or MSBuild property to enable workloads.

The target platform identifier ios was not recognized. This is because MSBuildEnableWorkloadResolver is set to false which disables .NET SDK Workloads which is required for this identifer. Unset this environment variable or MSBuild property to enable workloads.

The target platform identifier maccatalyst was not recognized. This is because MSBuildEnableWorkloadResolver is set to false which disables .NET SDK Workloads which is required for this identifer. Unset this environment variable or MSBuild property to enable workloads.

Platform version is not present for one or more target frameworks, even though they have specified a platform: net7.0-android, net7.0-ios, net7.0-maccatalyst

Screenshot

But I here is everything that is showing I have on my machine as far as sdks, and workloads.

WORKLOADS maui 8.0.0-rc.2.9373/8.0.100-rc.2 SDK 8.0.100-rc.2 maui-windows 8.0.0-rc.2.9373/8.0.100-rc.2 VS 17.7.34221.43 maui-maccatalyst 8.0.0-rc.2.9373/8.0.100-rc.2 VS 17.7.34221.43 maccatalyst 16.4.8968-net8-rc2/8.0.100-rc.2 VS 17.7.34221.43 maui-ios 8.0.0-rc.2.9373/8.0.100-rc.2 VS 17.7.34221.43 ios 16.4.8968-net8-rc2/8.0.100-rc.2 VS 17.7.34221.43 maui-android 8.0.0-rc.2.9373/8.0.100-rc.2 VS 17.7.34221.43 android 34.0.0-rc.2.468/8.0.100-rc.2 VS 17.7.34221.43

SDKS 8.0.100 x64 [Cannot uninstall version 8.0.0 and above] 7.0.403 x64 [Used by Visual Studio. Specify individually or use --force to remove]

RUNTIMES 8.0.0 x64 [Cannot uninstall version 8.0.0 and above]

Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.7.6

Microsoft .NET Framework Version 4.8.09032

I have tried to delete visual studio and reinstall. I have tried to remove any old versions of runtimes and sdks. I have tried to reorder the environment variables. Image below. But nothing has resolved it.

Screenshot


Solution

  • Ok so I resolved my issue. Here is a combination of things I had to do to resolve my problem after I deleted all sdks, runtimes, and VS instances on my machine.

    1. I installed a clean version of visual studios.

    2. I then had to fix my "Path" Environment Variable order to place: C:\Program Files\dotnet
      ABOVE C:\Program Files (x86)\dotnet\

    3. I then had to set the User Variable "MSBuildEnableWorkloadResolver" to true

    4. I then deleted the entire packs folder located at C:\Program Files\dotnet\packs

    5. I then manually installed the .net 7 sdk and runtime (this is the framework i chose to use, this whole process MAY still work equally with .net 6 but I'm not sure)

    6. I then manually install all 3 workloads with: dotnet workload install maui-android dotnet workload install maui-ios dotnet workload install maui-maccatylst

    I was then able to successfully build and run a new maui OR maui blazor application.