Mark Vermulst
Mark Vermulst

Reputation: 37

Maui project doesnt build

When building my Maui project with platform specific code i get the errors: Microsoft.Android.Sdk.RuntimeConfig.targets(61, 5): [MSB4062] The "RuntimeConfigParserTask" task could not be loaded from the assembly <path>. Could not load file or assembly 'System.Text.Json, Version=7.0.0.3, Culture=neutral, PublicKeyToken=<value>' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. And RuntimeComponentManifest.targets(14, 5): [MSB4175] The task factory "JsonToItemsTaskFactory.JsonToItemsTaskFactory" could not be loaded from the assembly <path>. Could not load file or assembly 'System.Text.Json, Version=7.0.0.3, Culture=neutral, PublicKeyToken=<value>' or one of its dependencies. The system cannot find the file specified.

I use .net 8 and my build targets of the project are net8.0-android;net8.0-ios. It looks like my project wants to access a Microsoft package (System.Text.Json) thats for .net 7. However i never specified this package and when i did with the .net 8 variant the system still threw these errors. I tried looking this up but i couldnt find anything related. Does anyone know how i can resolve these errors?

Also i do use rider as an IDE. I did verify that the workloads are installed and also that the msbuild version is the latest (17.0).

Upvotes: 0

Views: 572

Answers (1)

Mark Vermulst
Mark Vermulst

Reputation: 37

Turns out the installation source of the workloads need to be from the SDKs and not from VS. You can check this by running the command dotnet workload list. If the Installation Source of maui, maui-android and maui-ios are from vs then it doesn't work. I installed the SDKs by running the command dotnet workload install maui this downloaded the SDKs. For me, I also have a second installation source from VS now but this doesn't seem to matter.

Upvotes: 0

Related Questions