0

I'm trying to build an iOS app with .NET CLI on Azure DevOps. Originally I was trying to do so on AppCenter, with no luck. After exporting -and tweeking- the Appcenter build configuration for importing on AzureDevops, I had this issue.

So I tweeked the pipeline more to use .NET CLI instead of mono.

Here is the relevant part of the project file:

  <PropertyGroup>
    <TargetFramework>net6.0-ios16.0</TargetFramework>
    <OutputType>Exe</OutputType>
    <Nullable>enable</Nullable>
    <ImplicitUsings>true</ImplicitUsings>
    <CodesignKey>iPhone Developer</CodesignKey>
    <CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
    <CodesignProvision>iOS Team Provisioning Profile: com.xamarin.sample.TestApplication</CodesignProvision>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
    <CreatePackage>false</CreatePackage>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
    <CreatePackage>false</CreatePackage>
    <CodesignProvision></CodesignProvision>
  </PropertyGroup>

This is the .NET task configuration command line:

/p:Configuration=Release /p:Platform=iPhone /p:BuildIpa=true /t:Rebuild /p:Codesignkey="iPhone Distribution: ZZZZZZ (ABCDEFGH)" /p:CodesignProvision=XXXXXXX-YYYY-ZZZZ-AAAA-BBBBBBBBB

And the resulting log:

/Users/runner/hostedtoolcache/dotnet/dotnet build /Users/runner/work/1/s/TestApplication/TestApplication.csproj -dl:CentralLogger,"/Users/runner/work/_tasks/DotNetCoreCLI_5541a522-603c-47ad-91fc-a4b1d163081b/2.210.0/dotnet-build-helpers/Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll"*ForwardingLogger,"/Users/runner/work/_tasks/DotNetCoreCLI_5541a522-603c-47ad-91fc-a4b1d163081b/2.210.0/dotnet-build-helpers/Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /p:Configuration=Release /p:Platform=iPhone /p:BuildIpa=true /t:Rebuild /p:Codesignkey=iPhone Distribution: MATROT.TECH (XXXXXXXX) /p:CodesignProvision=d8186d97-7e3c-4745-a454-f69b8adea971
MSBuild version 17.3.2+561848881 for .NET
  Determining projects to restore...
  All projects are up-to-date for restore.
  Detected signing identity:
          
    Provisioning Profile: "NET 6 Xamarin Widget Sample" (d8146d97-7e3b-4782-a734-f69b8aead971)
    Bundle Id: com.xamarin.sample.test.net6application
    App Id: com.xamarin.sample.test.net6application
##[warning]TestApplication/AppDelegate.cs(61,32): Warning CS8604: Possible null reference argument for parameter 'path' in 'void File.WriteAllText(string path, string? contents)'.
/Users/runner/work/1/s/TestApplication/AppDelegate.cs(61,32): warning CS8604: Possible null reference argument for parameter 'path' in 'void File.WriteAllText(string path, string? contents)'. [/Users/runner/work/1/s/TestApplication/TestApplication.csproj]
##[warning]TestApplication/AppDelegate.cs(68,35): Warning CS8618: Non-nullable property 'Data' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
/Users/runner/work/1/s/TestApplication/AppDelegate.cs(68,35): warning CS8618: Non-nullable property 'Data' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/runner/work/1/s/TestApplication/TestApplication.csproj]
##[warning]TestApplication/AppDelegate.cs(73,16): Warning CS8618: Non-nullable property 'Value' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
/Users/runner/work/1/s/TestApplication/AppDelegate.cs(73,16): warning CS8618: Non-nullable property 'Value' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/runner/work/1/s/TestApplication/TestApplication.csproj]
##[warning]TestApplication/AppDelegate.cs(74,16): Warning CS8618: Non-nullable property 'Delta' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
/Users/runner/work/1/s/TestApplication/AppDelegate.cs(74,16): warning CS8618: Non-nullable property 'Delta' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/runner/work/1/s/TestApplication/TestApplication.csproj]
  TestApplication -> /Users/runner/work/1/s/TestApplication/bin/iPhone/Release/net6.0-ios16.0/iossimulator-x64/TestApplication.dll

If you take a look at the latest line of the log you'll see that the builds ends as one for a simulator and not an iPhone as I thought I requested?

Any Idea?

1 Answers1

0

I solved this probem using the following switches on the command line:

/p:Platform=arm64 /p:RuntimeIdentifier=ios-arm64