2

I am running this command

dotnet publish -f:net6.0-ios -c:Release

to build a .NET MAUI App and create the .ipa file for iOS (.csproj at the end)

and I get this error:

C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.4.303\targets\ Xamarin.Shared.Sdk.targets(366,3) : error : MessagingRemoteException: An error occurred on client Build while executing a reply for topic xvs/build/execute-task/OnesieMobile/ 18e8f3c002fMergeAppBundles [C:\Development_BuildPipeline\OnesieMobile\OnesieMobile\OnesieMobile.csproj]

C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.4.303\targets\ Xamarin.Shared.Sdk.targets(366,3) : error : AggregateException: One or more errors occurred. (The method or operation is not implemented.) [C:\Development_BuildPipeline\Ones ieMobile\OnesieMobile\OnesieMobile.csproj]

C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.4.303\targets\ Xamarin.Shared.Sdk.targets(366,3) : error : NotImplementedException: The method or operation is not implemented. [C:\Development_BuildPipeline\OnesieMobile\OnesieMobile\Ones ieMobile.csproj]

C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.4.303\targets\Xamarin.Shared.Sdk.targets(366,3): error : [C:\Develo pment_BuildPipeline\OnesieMobile\OnesieMobile\OnesieMobile.csproj]

I was able to successfully do the whole process of publishing an app all the way to my IPhone with the demo .NET MAUI application that comes with the template in Visual Studio 2022.

I was also able to clone and publish this project https://github.com/jfversluis/dotnet-maui-workshop/tree/main/Part%202%20-%20MVVM all the way to my IPhone.

So I thought I start working on my own project.

  • It works great when I press the play button in Visual Studio and run it as Windows App on my Windows in the debugger
  • It also works great on the remote iOS simulator in the cloud Mac through Visual Studio on my machine. (Although it takes 15 Minutes to fire it up!)

Environment:
Windows 10 Home, 21H2
VS 2022 Version 17.3.0 Preview 1.1

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <TargetFrameworks>net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
        <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net6.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);net6.0-tizen</TargetFrameworks> -->
        <OutputType>Exe</OutputType>
        <RootNamespace>OnesieMobile</RootNamespace>
        <UseMaui>true</UseMaui>
        <SingleProject>true</SingleProject>
        <ImplicitUsings>enable</ImplicitUsings>

        <!-- Display name -->
        <ApplicationTitle>OnesieMobile</ApplicationTitle>

        <!-- App Identifier -->
        <ApplicationId>com.maui.app</ApplicationId>
        <ApplicationIdGuid>447A62C6-2841-41D6-B9AE-444E6E1A908B</ApplicationIdGuid>

        <!-- Versions -->
        <ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
        <ApplicationVersion>1</ApplicationVersion>

        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</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>
    
    <PropertyGroup Condition="$(TargetFramework.Contains('-ios')) and '$(Configuration)' == 'Release'">
        <RuntimeIdentifiers>ios-arm64</RuntimeIdentifiers>
        <CodesignProvision>Maui Provisioning</CodesignProvision>
        <CodesignKey>Apple Distribution: My Name (XXXX)</CodesignKey>

        <ArchiveOnBuild>true</ArchiveOnBuild>
        <TcpPort>58181</TcpPort>
        <ServerAddress>xxxxx</ServerAddress>
        <ServerUser>xxxx</ServerUser>
        <ServerPassword>xxxx</ServerPassword>
        <_DotNetRootRemoteDirectory>/Users/xxxx/Library/Caches/Xamarin/XMA/SDKs/dotnet/</_DotNetRootRemoteDirectory>

    </PropertyGroup>

    <ItemGroup>
        <!-- App Icon -->
        <MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />

        <!-- Splash Screen -->
        <MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />

        <!-- Images -->
        <MauiImage Include="Resources\Images\*" />
        <MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" />

        <!-- Custom Fonts -->
        <MauiFont Include="Resources\Fonts\*" />

        <!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
        <MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
    </ItemGroup>

    <ItemGroup>
      <PackageReference Include="CommunityToolkit.Maui" Version="1.0.0" />
      <PackageReference Include="CommunityToolkit.Mvvm" Version="7.1.2" />
      <PackageReference Include="sqlite-net-pcl" Version="1.8.116" />
    </ItemGroup>

    <ItemGroup>
      <Compile Update="View\ActivityDetailPage.xaml.cs">
        <DependentUpon>ActivityDetailPage.xaml</DependentUpon>
      </Compile>
    </ItemGroup>

    <ItemGroup>
      <MauiXaml Update="View\ActivityDetailPage.xaml">
        <Generator>MSBuild:Compile</Generator>
      </MauiXaml>
      <MauiXaml Update="View\SettingsPage.xaml">
        <Generator>MSBuild:Compile</Generator>
      </MauiXaml>
    </ItemGroup>

</Project>
Chris
  • 305
  • 4
  • 19

2 Answers2

1

Figured it out.

I had to change

<RuntimeIdentifiers>ios-arm64</RuntimeIdentifiers>

to

<RuntimeIdentifier>ios-arm64</RuntimeIdentifier>

then it worked.

The official documentation gives the singular version https://learn.microsoft.com/en-us/dotnet/maui/ios/deployment/overview

The reason why I had changed it, was because of this Errors with dotnet publish

but then later I also went through this error NETSDK1032: The RuntimeIdentifier platform 'ios-arm64' and the PlatformTarget 'x64' must be compatible, which was probably the original reason why the plural form worked. In the *.csproj.user file the value was set to this

<RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>

and since for some reason the project settings and the command line arguments are overruled by the *.csproj.user file, the only property that would do something was the one in the plural form.

Unfortunately I can not tell anymore after all these errors, if I actually had a version that would publish with the plural settings. (I believe I did)

In short:

  • I followed the documentation
  • it was "probably" the *.csproj.user that messed up my configurations
  • which then messed up the inputs I was thinking I was entering
  • which then lead me to the latest error, which is also not a proper error I would say, since it does not describe in any way the probable cause.

To summarize, deleting the .csproj.user and setting the .csproj to something like the following should work. And then execute

dotnet publish -f:net6.0-ios -c:Release

.

<Project Sdk="Microsoft.NET.Sdk">
    
        <PropertyGroup>
            <TargetFrameworks>net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
            <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net6.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);net6.0-tizen</TargetFrameworks> -->
            <OutputType>Exe</OutputType>
            <RootNamespace>OnesieMobile</RootNamespace>
            <UseMaui>true</UseMaui>
            <SingleProject>true</SingleProject>
            <ImplicitUsings>enable</ImplicitUsings>
    
            <!-- Display name -->
            <ApplicationTitle>OnesieMobile</ApplicationTitle>
    
            <!-- App Identifier -->
            <ApplicationId>com.maui.app</ApplicationId>
            <ApplicationIdGuid>447A62C6-2841-41D6-B9AE-444E6E1A908B</ApplicationIdGuid>
    
            <!-- Versions -->
            <ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
            <ApplicationVersion>1</ApplicationVersion>
    
            <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
            <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</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>
        
        <PropertyGroup Condition="$(TargetFramework.Contains('-ios')) and '$(Configuration)' == 'Release'">
            <RuntimeIdentifier>ios-arm64</RuntimeIdentifier>
            <CodesignProvision>Maui Provisioning</CodesignProvision>
            <CodesignKey>Apple Distribution: My Name (XXXX)</CodesignKey>
    
            <ArchiveOnBuild>true</ArchiveOnBuild>
            <TcpPort>58181</TcpPort>
            <ServerAddress>xxxxx</ServerAddress>
            <ServerUser>xxxx</ServerUser>
            <ServerPassword>xxxx</ServerPassword>
            <_DotNetRootRemoteDirectory>/Users/xxxx/Library/Caches/Xamarin/XMA/SDKs/dotnet/</_DotNetRootRemoteDirectory>
    
        </PropertyGroup>
   
    
    </Project>
Chris
  • 305
  • 4
  • 19
  • I am literally following your footsteps of errors now and beginning to think if it was the better option to learn swift rather than going with MAUI :) – mcy Jun 09 '22 at 15:04
  • 1
    @mcy My hope is, that all of these errors and bugs are because of the preview version and they will get ironed out soon. Because if it does, it would be very powerful to not have to worry too much about different platforms. And I am also wondering what are the struggles with swift or other languages and IDEs? – Chris Jun 09 '22 at 17:07
  • Indeed if MAUI can get to the stage of click & build for all platforms, it will be very powerful. I have used xcode and objective c way back in the day (around iOS 3-4 days) and you're right about the struggles of new ide's . On a completely unrelated topic, have you managed to connect a physical device (say, ipad) to visual studio and debug successfully? I am trying that now but keep getting issues even though I can create an IPA file in Release using CLI. – mcy Jun 10 '22 at 12:39
  • @mcy I wouldn't say it's unrelated :D . And no, when I try to connect the physical device I am running into this issue: https://stackoverflow.com/questions/72356192/setup-hot-restart-fails, lately also my remote mac simulator stopped working. So right now, the only option for testing on iOS I have, is to create an actual build and transfer it to the phone through my webserver. – Chris Jun 12 '22 at 13:14
  • I see. Does installing IPA's manually require root? – mcy Jun 13 '22 at 11:20
  • 1
    @mcy I'm not sure what your question is. The build process on the Mac doesn't require root and an example for the *.ipa installation process you can see here: https://www.installonair.com/ – Chris Jun 13 '22 at 15:40
  • Ah I did not know such services exist for installing the IPA to the mobile devices. Thank you! – mcy Jun 14 '22 at 08:12
0

Explanation Try checking your Maui environment by installing MAUI check. MAUI Check is a tool that determines if your environment is ready for MAUI development. While you could go about installing MAUI using the dot net CLI exclusively, the tool makes sure you have all the appropriate workloads available to build towards a target environment and more. It will also install any necessary templates for MAUI apps.

STEP 1 Open your command prompt window.run the following command from your terminal:

dotnet tool install -g Redth.Net.Maui.Check

STEP 2 Once you have MAUI Check installed, run the following command from your terminal:

maui-check

The process will install the following dependencies into your environment: OpenJDK – For building Android, Android SDK and Emulator and .NET SDK Workloads for MAUI (Android, macOS, MacCatalyst, iOS, and tvOS)

STEP 3 Finally, in this step, let’s end with one more workload install of WASM tools. You need this workload because MAUI supports hosting Blazor inside a MAUI app. Run the following command from your terminal:

dotnet workload install wasm-tools

Note: In case, you already have installed the environmental dependencies of Xcode, OpenJDK, and Android SDK yourself, you can run the following command in a terminal to install the necessary workloads. Run the following command from your terminal:

I hope this will help.

Rodney Godfried
  • 219
  • 2
  • 4