3

I have a couple MAUI projects that include references to other projects which provide access to an API. The referenced projects generate dll's. When I compile the MAUI app in release mode and target my physical iPhone, the compile fails stating "Asset file '../project.Domain.Shared/obj/project.assets.json' doesn't have a target for 'net6.0-ios'. The referenced project is the .dll generating project that shouldn't (and cannot) contain a net6.0-ios property. This error only occurs if I attach my phone and target it during the compile. I can attach an Android device and compile in release mode without errors and even create an archive. Any help in resolving this issue is appreciated.

I tried adding the net6.0-ios property in the project that was referenced in the error, but doing so caused the whole solution to fail to compile. I am using Xcode 14.x and have seen other posts that suggested using version 13.x may resolve the problem. I tried that and still was unable to get the project to compile correctly.

ToolmakerSteve
  • 18,547
  • 14
  • 94
  • 196
  • The error occurs primarily when trying to create an archive. I am using VS 2022 preview 4.0 for Mac. – David Rutter Oct 25 '22 at 16:43
  • 1
    What frameworks does the dll target? AFAIK, should be able to link `.net6.0-ios` app with a dll that is either `net6.0` or `netstandard2.1` (or supports both). – ToolmakerSteve Oct 25 '22 at 20:01
  • I just noticed the `Asset file` message. Multi-target builder doesn't know where to put dll's assets for iOS. You may need to change how those resources are included and referenced. I don't know the details, but given that you say "shouldn't and cannot contain a net6.0-ios property", they need to stay part of the cross-platform bundle. The ios asset builder shouldn't see them at all. – ToolmakerSteve Oct 25 '22 at 20:05
  • The dll targets netstandard2.1. – David Rutter Oct 26 '22 at 18:34
  • *"This error only occurs if I attach my phone and target it during the compile."* With Configuration (Release | iPhone) selected, what is current value of project properties / iOS Build / Linker? Try different settings. [Don't Link | Framework Only | Link All] – ToolmakerSteve Oct 26 '22 at 19:00
  • I've tried all of the linking settings with the same results. The error ONLY occurs when I try to create the Archive. I can compile now in release mode, but when it attempts to create the archive I get the error, and it occurs immediately before attempting to do a build. I can archive the Android version without problem. – David Rutter Oct 27 '22 at 12:31
  • To be sure, delete .bin and .obj folders and repeat the process. If still happens, open an issue at `github maui issues`. – ToolmakerSteve Oct 27 '22 at 18:38
  • Can you show some of the relevant debug output as well as parts of the csproj file(s)? Maybe there is an issue with the TargetFrameworks configuration. – Julian Oct 27 '22 at 18:49
  • There is no debug output. The error occurs immediately after the archive process starts. This solution is built on the commercial abp.io framework and the MAUI project references the http.client project, which references the application.contracts project, that finally references the domain.shared project. Here is the relevant contents of the domain.shared csproj file: netstandard2.1 MyProject true – David Rutter Nov 01 '22 at 12:37

2 Answers2

1

For iOS, MAUI currently only supports publishing on the .NET command line. You need to use the command dotnet publish -f:net6.0-ios -c:Release... to create the .ipa file. For more details, please refer to this official document: Publish a .NET MAUI app for iOS - .NET MAUI

Zack
  • 1,255
  • 1
  • 2
  • 5
  • @David Rutter You can mark this answer or your answer as answer to help more people. – Zack Nov 04 '22 at 06:40
1

Using the Publish information in the link provided resolved the problem.

  • Thanks to share the solution with the community. Please, close the question. If you could detail more the solution, it will be appreciated. Welcome! – Luciana Oliveira Nov 08 '22 at 13:33