.NET Maui: Project doesn’t have a target for ‘net7.0-ios/iossimulator-x64’
While working on a .NET Maui project for my job, I kept having this error pop up every time I tried to debug on the Mac.
To fix it, I added the following property group in the .csproj file:
/Users/me/Projects/project/project/Resources/Styles/MaterialDesign.xaml(5,5): Error: Assets file '/Users/me/Projects/project/project/obj/project.assets.json' doesn't have a target for 'net7.0-ios/iossimulator-x64'. Ensure that restore has run and that you have included 'net7.0-ios' in the TargetFrameworks for your project. You may also need to include 'iossimulator-x64' in your project's RuntimeIdentifiers.
<PropertyGroup Condition="$(TargetFramework.Contains('-ios'))">
<RuntimeIdentifier>ios-arm64</RuntimeIdentifier>
</PropertyGroup>
And that was that! Now I can run the project just fine.