question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue when trying to build Xamarin.iOS project that includes Extension project

See original GitHub issue

Required Information

Entering this information will route you directly to the right team and expedite traction.

Question, Bug, or Feature?
Type: BUG

Enter Task Name: InstallAppleProvisioningProfile

list here (V# not needed):
https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/InstallAppleProvisioningProfileV1/installprovprofile.ts

Environment

  • Server - Azure Pipelines or TFS on-premises?

    -Azure Pipelines

  • Agent - Hosted or Private:

    • Hosted

Issue Description

Hi,

I’m trying to set up my first Azure Pipelines project. This is for a Xamarin.Forms project. To make things simpler, since I know they have very different build steps, I’m splitting this into two different pipelines, one for the iOS project and one for the Android project.

The iOS project contains a Today Extension. On an iPhone, if you swipe to the right from the main home screen, you get a bunch of widgets that can be configured. These provide on-demand information without having to launch the related app. Although they are a separate project within your VS solution, behind the scenes (this is my understanding), the extension projects, since they are bundled with the iOS application, are automatically built when the iOS project is built.

My YAML configuration is attached. I uploaded the provisioning profiles for the iOS application as well as the Today extension (each one has their own separate provisioning profile). I added two separate InstallAppleProvisioningProfile tasks to the YAML, however, during the build step it errored out saying that it couldn’t find the provisioning profile for the extension project. It actually depended on which profile install step was “last.” I read in the comments for the source code for that step:

// If there are multiple InstallAppleCertificate tasks, the last one wins. tl.setVariable('APPLE_PROV_PROFILE_UUID', info.provProfileUUID);

Given the above, I’m not sure how you would go about referencing a second provisioning profile. Additionally, in the Xamarin.IOS build step, I don’t know (or they don’t exist) how to set the configuration options to tell the compiler which provisioning profile to use when building which project. This may be something that has to be gleaned from the Xamarin tools team.

So, to sum up, I’m looking for a way to use Azure Pipelines to build a Xamarin.iOS project which includes a related App Extensions project (in my case, a Today Extension).

Here’s a link about Extensions in Xamarin if helpful: https://docs.microsoft.com/en-us/xamarin/ios/platform/extensions

Task logs

"/Users/vsts/agent/2.153.2/work/1/s/iOS/org.iOS.csproj" (default target) (1) -> "/Users/vsts/agent/2.153.2/work/1/s/HospitalStatus/HospitalStatus.csproj" (default target) (3) -> (_DetectSigningIdentity target) -> Info.plist : error : Project bundle identifier 'com.org.HospitalStatus' does not match specified provisioning profile '3e3246e6-8de4-43bd-b15d-e7a6cfa41e7d' [/Users/vsts/agent/2.153.2/work/1/s/HospitalStatus/HospitalStatus.csproj]

Troubleshooting

Checkout how to troubleshoot failures and collect debug logs: https://docs.microsoft.com/en-us/vsts/build-release/actions/troubleshooting

Error logs

(included in task log above)

BuildYAML.txt BuildLog.txt

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
alexander-smolyakovcommented, Jul 15, 2020

Hello, @Osmosis311!

At the moment the current implementation of the XamariniOS task doesn’t support builds where several provisioning profiles needed. We already created a ticket regarding this XamariniOS task enhancement.

As a workaround, you can specify names of provisioning profiles in settings of your projects (Project Settings -> iOS Bundle Signing -> Provisioning Profile) instead of using the automatic option. That’s must be done for app and extension as well. After that you could leave signingIdentity and signingProvisioningProfileID fields empty for XamariniOS@2 task in YAML file. Since names of provisioning profiles were already specified in projects, the XamariniOS task is able to sign in an app with the extension using specified provisioning profiles.

I assume the correct YAML file will be looking like this:

# Xamarin.iOS
# Build a Xamarin.iOS project.
# Add steps that install certificates, test, sign, and distribute an app, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/xamarin

trigger:
- master

pool:
  vmImage: 'macos-latest'

steps:
# To manually select a Xamarin SDK version on the Microsoft-hosted macOS agent,
# configure this task with the *Mono* version that is associated with the
# Xamarin SDK version that you need, and set the "enabled" property to true.
# See https://go.microsoft.com/fwlink/?linkid=871629
- script: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh 5_12_0
  displayName: 'Select the Xamarin SDK version'
  enabled: false

- task: NuGetToolInstaller@1

- task: NuGetCommand@2
  inputs:
    restoreSolution: '**/*.sln'

- task: InstallAppleCertificate@2
  inputs:
    certSecureFile: 'Certificates.p12'
    certPwd: '$(P12password)'
    keychain: 'temp'

- task: InstallAppleProvisioningProfile@1
  inputs:
    provisioningProfileLocation: 'secureFiles'
    provProfileSecureFile: 'Hospital_Status_Distribution_2021 (3).mobileprovision'

- task: InstallAppleProvisioningProfile@1
  inputs:
    provisioningProfileLocation: 'secureFiles'
    provProfileSecureFile: 'MyApp_In_House_Distribution_Primary (1).mobileprovision'

- task: XamariniOS@2
  inputs:
    solutionFile: '**/*iOS.csproj'
    configuration: 'Release'
    packageApp: true
    runNugetRestore: false
0reactions
Reisclefcommented, Dec 13, 2021

The workaround recommended by @alexander-smolyakov for removing the optional Signing Identity and Provisioning Profile from the DevOps task configuration worked for me. As these were identified in the .csproj for both the iOS app and the extension, the build correctly picked up the installed profile accordingly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Xamarin.iOS errors - Microsoft Learn
MT0077: WatchOS projects must be extensions. This usually indicates a bug in Xamarin.iOS; please file a new issue on github with a test...
Read more >
Xamarin.iOS MT1001 error when using device specific builds
After the update I started getting this error saying that it can't find application in folder …/device-builds/iphone7.2-12.4/ but the actual folder is called ......
Read more >
Issue with Xamarin.iOS : app extension not loading
I tried updating solution start-up to extension project, but I then can not deploy it on my iPhone (Error: choose a valid local...
Read more >
How do I fix code sign code 1 & unable to build chain?
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin. ... iOS.app': Warning: unable to build chain to self-signed root for signer "Apple ...
Read more >
The Good and The Bad of Xamarin Mobile Development
When considering iOS or Android app development, most of us think ... Xamarin uses a single language, C#, to create apps for all...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found