MAUI App launches fine in iOS Simulator, refuses to build for device

Alexei Vinidiktov 1 Reputation point
2022-05-24T04:28:28.427+00:00

When I start building a default MAUI project for a physical iOS device on Visual Studio for Mac Preview 17.3 (build 191) on Macbook Air M1 with macOS 12.2.1 I get this error message:

/usr/local/share/dotnet/sdk/6.0.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(5,5): Error NETSDK1047: Assets file '/Users/<username>/VisualStudioProjects/MauiApp2/MauiApp2/obj/project.assets.json' doesn't have a target for 'net6.0-ios/ios-arm64'. Ensure that restore has run and that you have included 'net6.0-ios' in the TargetFrameworks for your project. You may also need to include 'ios-arm64' in your project's RuntimeIdentifiers. (NETSDK1047) (MauiApp2)

I can build and launch the app in the simulator without problems.

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,976 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 27,106 Reputation points Microsoft Vendor
    2022-06-16T08:45:19.023+00:00

    Hello @Alexei Vinidiktov ,

    There is a new preview release version (Jun 14th, 2022), please try to download and install the new VS, and check if this issue still exists.

    In addition, you could have a try to add RuntimeIdentifier in your .csproj file:

    <PropertyGroup Condition="$(TargetFramework.Contains('-ios'))">  
            <RuntimeIdentifier>ios-arm64</RuntimeIdentifier>  
        </PropertyGroup>  
    

    Best Regards,
    Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.