Home > database >  Error in publishing maui ios app because Code signing must be enabled to create an Xcode archive
Error in publishing maui ios app because Code signing must be enabled to create an Xcode archive

Time:12-28

I am trying to publish an ios app using a remote mac. Unfortunately I encountered this issue and not sure how to enable the code signing as per requested. How to solve for it? Thank you in advance. The references to publish the app is referred from microsoft website. I also already delete the csproj.user.

C:\Users\salazar\source\repos\OcrSolution\OcrSolution>dotnet publish -f:net6.0-ios -c:Release
MSBuild version 17.4.0 18d5aef85 for .NET
  Determining projects to restore...
  All projects are up-to-date for restore.
  OcrSolution -> C:\Users\salazar\source\repos\OcrSolution\OcrSolution\bin\Release\net6.0-ios\ios-arm64\OcrSolution.dll
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.1.228\tools\msbuild\iOS\Xamarin.Shared.targets(2684,3): error : Code
 signing must be enabled to create an Xcode archive. [C:\Users\salazar\source\repos\OcrSolution\OcrSolution\OcrSolution
.csproj::TargetFramework=net6.0-ios]

This is my .csproj file. I set everything including host and password in my csproj file

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

    <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>OcrSolution</RootNamespace>
        <UseMaui>true</UseMaui>
        <SingleProject>true</SingleProject>
        <ImplicitUsings>enable</ImplicitUsings>
        <EnableDefaultCssItems>false</EnableDefaultCssItems>

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

        <!-- App Identifier -->
        <ApplicationId>com.lingkail.ocrapp</ApplicationId>
        <ApplicationIdGuid>0D27B311-4E99-4232-AC66-A3EEE002C601</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'">24.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>
        <GenerateAppInstallerFile>False</GenerateAppInstallerFile>
        <AppxPackageSigningEnabled>True</AppxPackageSigningEnabled>
        <PackageCertificateThumbprint>EC67BEEBA1E0AF6E0B024FB9F2122BFE7A7FDA3D</PackageCertificateThumbprint>
        <AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
        <AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
        <AppxSymbolPackageEnabled>False</AppxSymbolPackageEnabled>
        <GenerateTestArtifacts>True</GenerateTestArtifacts>
        <AppInstallerUri>https://asr</AppInstallerUri>
        <HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
    </PropertyGroup>

    <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0-android|AnyCPU'">
      <AndroidPackageFormat>apk</AndroidPackageFormat>
    </PropertyGroup>

    <PropertyGroup Condition="$(TargetFramework.Contains('-ios')) and '$(Configuration)' == 'Release'">
        <RuntimeIdentifier>ios-arm64</RuntimeIdentifier>
        <CodesignKey>iPhone Distribution: xxxx (xxx)</CodesignKey>
        <CodesignProvision>LingkailOcrApp</CodesignProvision>
        <ArchiveOnBuild>true</ArchiveOnBuild>
        <TcpPort>58181</TcpPort>
        <ServerAddres>xxx</ServerAddres>
        <ServerUser>xxxx</ServerUser>
        <ServerPassword>xxx</ServerPassword>
        <_DotNetRootRemoteDirectory>/Users/{macOS username}/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>

</Project>

CodePudding user response:

There is a typo in server address that causes the issue. No wonder a brand new project work flawlessly. For further reference if anyone encountered the same issues, you may check for any typo in your .csproj file

 <ServerAddress>xxx</ServerAddress>

Thank you

  • Related