Anbu Mani
Anbu Mani

Reputation: 68

AppCenter: Xamarin Forms iOS Project Build Failed

When I tried to build Xamarin Forms iOS app in the App Center, it is checking the reference of Android and throwing exceptions/issues.

Can anyone know why is this happening ?

PS: Both Android and iOS builds are working fine in local.

Error Image: enter image description here

Thanks in advance.

Upvotes: 1

Views: 392

Answers (3)

Svenmarim
Svenmarim

Reputation: 3725

Currently, you can not edit the pipeline with yml anymore. Therefore, add a custom script file to your iOS project, called appcenter-post-clone.sh as described in the docs, that removes the Android project in the solution, so it won't bother you while restoring

The content of the file should be:

dotnet sln <path to sln (ex: ../../app.sln)> remove <path to Android csproj (ex: ../Android/Android.csproj)>

Make sure after you added the file, that you build the pipeline AGAIN manually, because when the file is added the first time, it won't be activated in the pipeline.

Upvotes: 0

Anbu Mani
Anbu Mani

Reputation: 68

Previously, I selected the build configuration is pointing to the .sln (solution) file instead of the (.iOS) project.

Solution : In the build configuration to be select (.iOS) Project

Upvotes: 1

MoRRt
MoRRt

Reputation: 301

Looks like your iOS pipeline is trying to use *.sln file of the whole solution. I guess you should try to build only *.iOS.csproj directly. Below an example of the build iOS project task from *.yml:

 - task: XamariniOS@1
        displayName: Build App.iOS
        inputs:
          solutionFile: 'App.iOS/App.iOS.csproj'
          configuration: '$(buildConfiguration)'
          packageApp: true
          runNugetRestore: false
          args: '/p:OutputPath=$(outputDirectory)/'
          buildToolOption: 'msbuild'
          clean: true

Upvotes: 2

Related Questions