Open Closed

MAUI project will not compile for iOS #4976


User avatar
0
darutter created

ABP Framework 5.3.3 MAUI .NET 6.0 .NET MVC backend (API)

I have a project that was created last year with 5.3.3 that I'm trying to get published to Apple's store. I have had several issues with getting this done. I was able to get the Android version created and published without a problem, but the iOS version has been a real problem. Currently, when I try to compile the app I get the following error:

error NETSDK1005: Assets file 'Z:\Projects\xxxx\aspnet-core\src\xxxx.Application.Contracts\obj\project.assets.json' doesn't have a target for 'net6.0-ios'. Ensure that restore has run and that you have included 'net6.0-ios' in the TargetFrameworks for your project.

One time I got past this error by not referencing the non-MAUI projects directly but referencing the .dll's. However, when I did this and got a build, the generated app failed to include the MauiProgram.cs file and would crash immediately after showing the splash screen.

I need help!

I have just updated my subscription and can try to rebuild the app with the latest version of ABP commercial, but would rather get the current version working.


17 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Can you provide the full steps to reproduce? thanks.

  • User Avatar
    0
    darutter created

    I just created a new solution using ABP.IO version 7.1.1 that includes a MAUI project and tried to build the iOS version using Visual Studio Mac 17.5.4. I did not make any changes to the solution after creating it with SUITE 7.1.1. When I attempt build the app to run the new solution on my iPhone I get the same error as I get on my old app, except that the error says :

    /usr/local/share/dotnet/sdk/7.0.203/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(5,5): Error NETSDK1047: Assets file '/Users/davidrutter/Projects/BaseSolution/aspnet-core/src/BaseSolution.Maui/obj/project.assets.json' doesn't have a target for 'net7.0-ios/ios-arm64'. 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 'ios-arm64' in your project's RuntimeIdentifiers. (NETSDK1047) (BaseSolution.Maui)

    This is the pertinent section from the .csproj file:

    <PropertyGroup>
    	<TargetFrameworks>net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
    	<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
    	<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
    	<!-- <TargetFrameworks>$(TargetFrameworks);net7.0-tizen</TargetFrameworks> -->
    	<Nullable>enable</Nullable>
    	<OutputType>Exe</OutputType>
    	<RootNamespace>BaseSolution.Maui</RootNamespace>
    	<UseMaui>true</UseMaui>
    	<SingleProject>true</SingleProject>
    	<ImplicitUsings>enable</ImplicitUsings>
    
    	<!-- Display name -->
    	<ApplicationTitle>BaseSolution.Maui</ApplicationTitle>
    
    	<!-- App Identifier -->
    	<ApplicationId>com.companyname.basesolution.maui</ApplicationId>
    	<ApplicationIdGuid>e5c5d420-6b4b-4a4b-9ee5-cc98e5ea2e97</ApplicationIdGuid>
    
    	<!-- Versions -->
    	<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
    	<ApplicationVersion>1</ApplicationVersion>
    
    	<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
    	<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
    	<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
    	<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
    	<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
    	<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
    </PropertyGroup>
    

    I have to be able to build a MAUI project for iOS.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    I will check it

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    After my check, this is not related to ABP.

    Even if you create an empty MAUI app using VisualStudio MAC you get the same error.

    You can check this:

    • https://github.com/dotnet/docs-maui/issues/681
    • https://learn.microsoft.com/en-us/dotnet/maui/ios/deployment/publish-cli?view=net-maui-7.0
    • https://www.youtube.com/watch?v=COMB1QsbB1M
  • User Avatar
    0
    darutter created

    Thank you for the links. I am finally able to get my real project to compile. I can create an .ipa to deploy to the Apple store, however the app crashes immediately after the splash screen. This is happening in both the release and debug versions. In the debug version it is failing when it tries to instantiate the webauthenticatorbrowser because it can't load the Volo.Abp.Identity.Pro.HttpCient

    There were a couple other Volo packages that it said it couldn't load before this one and I was able to include those packages into the MAUI project. However, the Volo.Abp.Identity.Pro modules don't show up as options to load in the MAUI project. Any help is appreciated.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Does this error also happen if you run locally?

  • User Avatar
    0
    darutter created

    Yes, running the app on my iPhone in debug mode is when it happens.

    More information on the situation:

    By default the solution includes the xxx.Application.Contracts, xxx.Domain.Shared and xxx.HttpApi.Client projects as part of the solution. The only way I can even get the project to successfully compile is to not include these projects in the compilation process and instead include their .dll's. By including the .dll's it appears that all of the references to the Volo.Abp HttpApi related elements are not compiled into the executable.

    If I begin including references to the Volo.Abp dll's, I get a cascading affect of needing more and more of the Volo .dll's and including some of them results in other errors like ambiguous calls to various methods.

    Do you have any suggestions for how to configure the MAUI app to build either with or without including the required projects as part of the build process? This has been going on for 9 months.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    This sounds weird, it works fine in the emulator, but it's wrong on the real machine. I'll check it out

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    I can't reproduce the problem.

    Can you use the new project to reproduce the problem and share it with me? shiwei.liang@volosoft.com thanks.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    OK, I will check it.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    I checked the project and email it to you.

    You can compare the changes.

  • User Avatar
    0
    darutter created

    I looked at the changes you made and the only significant one was to comment out one line in the RadixDealerPortalMauiClientModule.cs file. I did the same and still get the following error.

  • User Avatar
    0
    darutter created

    What version of Xcode are you running? Are you building on a Mac?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I'm using the XCode version 14.3

    I looked at the changes you made and the only significant one was to comment out one line in the RadixDealerPortalMauiClientModule.cs file. I did the same and still get the following error.

    Actually, I made a lot of changes, you can use some comparison tools to compare.

    BTW, Can you successfully run the project I sent you?

  • User Avatar
    0
    darutter created

    Yes I can successfully run the modified program you sent me in debug mode. However, when I compile it in release mode and deploy it to my iPhone it crashes like before.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    I will check it

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi, It's a problem with MAUI, we need to wait for Microsoft to fix this

    This error happens even if you create an empty MAUI app to config the configuration:

    Currently, you can try to publish in debug mode.

    dotnet publish -f net6.0-ios -c Debug -p:ArchiveOnBuild=true -p:RuntimeIdentifier=ios-arm64.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09