Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Xamarin bundle symlinks in macos-13 image #8045

Closed
2 of 10 tasks
jahmai-ca opened this issue Aug 4, 2023 · 32 comments
Closed
2 of 10 tasks

No Xamarin bundle symlinks in macos-13 image #8045

jahmai-ca opened this issue Aug 4, 2023 · 32 comments

Comments

@jahmai-ca
Copy link

Description

On the macos-12 (and earlier) images, it was possible to use select-xamarin-sdk.sh with a version label to select which Xamarin SDK version to use (see https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md).

This doesn't seem to be possible on the macos-13 image. Not only is there none listed in the docs (https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md), but attempting to use the select-xamarin-sdk.sh results in an error.

Platforms affected

  • Azure DevOps
  • GitHub Actions - Standard Runners
  • GitHub Actions - Larger Runners

Runner images affected

  • Ubuntu 20.04
  • Ubuntu 22.04
  • macOS 11
  • macOS 12
  • macOS 13
  • Windows Server 2019
  • Windows Server 2022

Image version and build link

20230801.2

Is it regression?

20230709.1

Expected behavior

The macos-13 docs list Xamarin version bundle symlinks, and using select-xamarin-sdk.sh succeeds in the build.

Actual behavior

The macos-13 docs do not contain any symlinks and the select-xamarin-sdk.sh fails with:

Starting: Selecting Xamarin version
==============================================================================
Task         : Bash
Description  : Run a Bash script on macOS, Linux, or Windows
Version      : 3.225.1
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/bash
==============================================================================
Generating script.
Script contents:
sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh 6_12_21
========================== Starting Command Output ===========================
/bin/bash /Users/runner/work/_temp/4fd70082-8701-4413-8c23-30c8605ba04e.sh
Set Xamarin SDK to 6_12_21
Set Current folder for /Library/Frameworks/Mono.framework/Versions
ln: /Library/Frameworks/Mono.framework/Versions/Current: No such file or directory
##[error]Bash exited with code '1'.
Finishing: Selecting Xamarin version

Repro steps

Include the following in your YAML:

# This task selects a specific Xamarin.Mono and Xamarin.iOS combination
- task: Bash@3
  displayName: 'Selecting Xamarin version'
  inputs:
    targetType: 'inline'
    script: 'sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh 6_12_24'
@erik-bershel
Copy link
Contributor

Hey @jahmai-ca!
We'll think about adding this feature back.

@mikhailkoliada
Copy link
Contributor

Duplicate of 7635, tamarin is not yet added to macOS 13

@jahmai-ca
Copy link
Author

@mikhailkoliada #7635 is about nuget, did you mean to reference another issue?

@erik-bershel
Copy link
Contributor

@jahmai-ca issues are connected to each other. Both require Xamarin for macOS 13. Briefly, in case we find an opportunity to install Xamarin without negative side effects, we will solve both your and the specified by @mikhailkoliada issues.

@jahmai-ca
Copy link
Author

jahmai-ca commented Aug 9, 2023

@erik-bershel Ok. But you said "if". Isn't this required to be able to build MAUI / net7-ios / net7-android applications?

@nbevans
Copy link

nbevans commented Sep 4, 2023

Xamarin is still supported until May 2024.

Why has the MacOS-13 image had all traces of Mono, Xamarin, MSBuild etc removed from it?

@jahmai-ca
Copy link
Author

Not only that but net7-ios and net7-android are supposed to be supported beyond May 2024, unless we missed the memo?

@nbevans
Copy link

nbevans commented Oct 12, 2023

When is this going to be fixed?

https://devblogs.microsoft.com/dotnet/announcing-dotnet-maui-in-dotnet-8-rc-2/

Xamarin officially supports iO17 via XCode15 and also AndroidAPI34 now. See above. So it should be available on the current version build agents.

@bwalpoleuk
Copy link

The announcement that Xamarin will support iOS 17 and Android 34 is very welcome news. But to be able to continue to use ADO for CI/CD pipelines for Xamarin we would need the macos-13 agents to have Xamarin tooling support since XCode 15 will be a pre-requisite .

@nbevans
Copy link

nbevans commented Oct 12, 2023

What am I missing? Why is "need the macos-13 agents to have Xamarin tooling support since XCode 15 will be a pre-requisite" a problem? That's the purpose of this discussion is it not?

@bwalpoleuk
Copy link

What am I missing? Why is "need the macos-13 agents to have Xamarin tooling support since XCode 15 will be a pre-requisite" a problem? That's the purpose of this discussion is it not?

Yes exactly, which I was re-enforcing the message that Xamarin supporting iOS 17 and Android API 34 only gets us so far, we can't use exiting CI/CD pipelines without the macos-13 agents being updated to include Xamarin.

@nbevans
Copy link

nbevans commented Oct 12, 2023

Yes - that is the purpose of this discussion.

The Macos-13 agent needs improving to include both XCode15 (if it doesn't already) and Xamarin (as per latest release blog post which includes support for XCode15 / iOS17)

But even before this news, Xamarin should never have been removed from the Macos-13 agent. As it was still a supported and viable platform for building things on Macos-13

@jayanthsagar
Copy link

Any timeline when Xamarin SKDs will be included in macOS13 agents?

@ranjithtech
Copy link

ranjithtech commented Dec 26, 2023

Why this is closed without a solution!!! We are still experiencing the same problem. We cannot build our Xamarin forms app with mac-OS13 azure image :(

@brunonocetti
Copy link

@jayanthsagar @ranjithtech you can use macOS-13 image if you install required dependencies during pipeline execution.

Example:

        - script: brew install --cask xamarin-ios
          displayName: 'Install Xamarin.iOS package using Homebrew'

        - script: brew install --cask xamarin-android
          displayName: 'Install Xamarin.Android package using Homebrew'

        - script: curl $(vsForMacDmgUrl) -o /tmp/vsformac.dmg
          displayName: 'Download Visual Studio for Mac'

        - script: hdiutil attach /tmp/vsformac.dmg
          displayName: 'Mount Visual Studio for Mac dmg'

        - script: cp -R /Volumes/Visual\ Studio/Visual\ Studio.app/Contents/MonoBundle/MSBuild/Current/bin /tmp/msbuild
          displayName: 'Extract MSBuild'

Then use mono "/tmp/msbuild/MSBuild.dll"

@nbevans
Copy link

nbevans commented Feb 8, 2024

I tried this today with xamarin ios and it worked on the macos13 agent. Nice 👍

@veringm
Copy link

veringm commented Feb 12, 2024

Hi @brunonocetti Thx for the update. However, I get this error on script no 3

Script contents:
curl $(vsForMacDmgUrl) -o /tmp/vsformac.dmg
========================== Starting Command Output ===========================
/bin/bash --noprofile --norc /Users/runner/work/_temp/7144a19b-cd8b-4c4c-a691-7041bad3aee7.sh
/Users/runner/work/_temp/7144a19b-cd8b-4c4c-a691-7041bad3aee7.sh: line 1: vsForMacDmgUrl: command not found
curl: (2) no URL specified
curl: try 'curl --help' for more information

Where is the $(vsForMacDmgUrl) variable defined? Where can I find that URL?

@1Siger1
Copy link

1Siger1 commented Feb 14, 2024

@Eric-EvilTwin
Copy link

The path /Volumes/Visual\ Studio/Visual\ Studio.app/Contents/MonoBundle/MSBuild/Current/bin did not work for me with this version https://download.visualstudio.microsoft.com/download/pr/3209737b-50b9-44e0-9331-9f7bdaf5fc15/57c31feafddb763141ff34353400e08a/visualstudioformacinstaller-17.6.0.73.dmg - I don't see an MSBuild folder inside of that DMG file. Was there another version that this worked on?

@Eric-EvilTwin
Copy link

Eric-EvilTwin commented Feb 15, 2024

FYI - I was able to get my builds working after changing to vmImage: 'macos-13' by just installing the casks and using my existing NuGetCommand@2 and XamariniOS@2 tasks

        - script: brew install --cask xamarin-ios
          displayName: 'Install Xamarin.iOS package using Homebrew'

        - script: brew install --cask xamarin-android
          displayName: 'Install Xamarin.Android package using Homebrew'

@damews
Copy link

damews commented Feb 21, 2024

FYI - I was able to get my builds working after changing to vmImage: 'macos-13' by just installing the casks and using my existing NuGetCommand@2 and XamariniOS@2 tasks

        - script: brew install --cask xamarin-ios
          displayName: 'Install Xamarin.iOS package using Homebrew'

        - script: brew install --cask xamarin-android
          displayName: 'Install Xamarin.Android package using Homebrew'

Added these in my workflow but can't get a build to work with the macos-13 runner. I also installed the vscode-for-mac using the example provided by @brunonocetti, but still not working. I'm getting these errors:

The type or namespace name 'Forms' does not exist in the namespace 'Xamarin'
The type or namespace name could not be found (are you missing a using directive or an assembly reference?)

@Eric-EvilTwin
Copy link

@damews - That sounds like a nuget issue to me. Xamarin.Forms is not part of Xamarin.iOS or Xamarin.Android. I'd suggest checking your nuget references to Xamarin.Forms and your nuget restore step.

@David-Sobin
Copy link

Adding my frustration to the others:
Why was Xamarin removed from MacOS-13?
We need Xamarin.iOS 16.4.0.23, the latest version, as well as the latest version of Xcode 15 on MaOS-13.
We need this well beyond end of May, when Microsoft ends support for Xamarin, because we will continue to create builds with Xamarin as we migrate to .NET iOS.

@nbevans
Copy link

nbevans commented Feb 27, 2024

Adding my frustration to the others: Why was Xamarin removed from MacOS-13? We need Xamarin.iOS 16.4.0.23, the latest version, as well as the latest version of Xcode 15 on MaOS-13. We need this well beyond end of May, when Microsoft ends support for Xamarin, because we will continue to create builds with Xamarin as we migrate to .NET iOS.

Agreed - removing Xamarin so quickly seems foolish and suggests the maintainers are naive about how the SDLC works in real companies.

But this workaround does work:

Stick the following in a Command Line Script block in your Azure DevOps pipeline:-

brew install --cask xamarin-ios
brew install --cask xamarin-android

It adds a couple minutes to your build time - but this is better than nothing.

@veringm
Copy link

veringm commented Feb 27, 2024

I also added the two lines, just "wrapped" it in a task, to align with the rest of my pipeline

  - task: PowerShell@2
    displayName: 'Install Xamarin.iOS package using Homebrew'
    inputs:
     targetType: inline
     script: brew install --cask xamarin-ios
  - task: PowerShell@2
    displayName: 'Install Xamarin.Android package using Homebrew'
    inputs:
     targetType: inline
     script: brew install --cask xamarin-android

Now the pipeline runs, and artifacts are working.

@damews
Copy link

damews commented Feb 28, 2024

FYI - I was able to get my builds working after changing to vmImage: 'macos-13' by just installing the casks and using my existing NuGetCommand@2 and XamariniOS@2 tasks

        - script: brew install --cask xamarin-ios
          displayName: 'Install Xamarin.iOS package using Homebrew'

        - script: brew install --cask xamarin-android
          displayName: 'Install Xamarin.Android package using Homebrew'

Added these in my workflow but can't get a build to work with the macos-13 runner. I also installed the vscode-for-mac using the example provided by @brunonocetti, but still not working. I'm getting these errors:

The type or namespace name 'Forms' does not exist in the namespace 'Xamarin' The type or namespace name could not be found (are you missing a using directive or an assembly reference?)

I had one step after these that was calling the select-xamarin-sdk-v2.sh script and doing another Xcode setup. After removing this step, it worked beautifully.

@hirandesai
Copy link

hirandesai commented Apr 6, 2024

Hi All,

I am facing similar error after moving to macos-13 image and I am clueless about how to fix this -
here I am attaching the pipeline as reference -

pool:
  vmImage: 'macOS-13'

steps:

- bash: 'brew install --cask xamarin-ios'
  displayName: 'Bash Install Xamarin IOS'

# Not sure if this step is required
- bash: 'curl https://download.visualstudio.microsoft.com/download/pr/3209737b-50b9-44e0-9331-9f7bdaf5fc15/57c31feafddb763141ff34353400e08a/visualstudioformacinstaller-17.6.0.73.dmg -o /tmp/vsformac.dmg'
  displayName: 'Download Visual Studio for Mac'

# Not sure if this step is required
- bash: 'hdiutil attach /tmp/vsformac.dmg'
  displayName: 'Mount Visual Studio for Mac dmg'

- task: ios-bundle-version@1
  inputs:
    sourcePath: Source/xxxx/xxxx/Info.plist
    versionCodeOption: 'buildid'
    versionName: '3.6.$(Build.BuildId)'
    versionCode: '$(Build.BuildId)'    
    printFile: true 

- task: InstallAppleCertificate@2
  inputs:
    certSecureFile: AppleCertificate.p12
    certPwd: $(P12Password)
    keychain: 'temp'
    deleteCert: false
  displayName: Install Apple Certificate

- task: InstallAppleProvisioningProfile@1
  inputs:
    provisioningProfileLocation: 'secureFiles'
    provProfileSecureFile: '$(AppleProvisioningProfile)'
  displayName: 'Install Apple Provisioning Profile'    

# added because of error of missing project.assets.json, this wasn't in previous version macos-latest (maxos-12)
- task: DotNetCoreCLI@2
  inputs:
    command: 'restore'
    projects: 'Source/MobileOnly.sln'
    feedsToUse: 'select'
 
 # added this thinking it may solve error (because the previous version worked fine with nuget)
- task: NuGetToolInstaller@1
  displayName: 'Use NuGet 5.x'
  inputs:
    versionSpec: 5.x
    
- task: NuGetCommand@2
  displayName: 'NuGet restore'
  inputs:
    restoreSolution: 'Source/MobileOnly.sln'

- task: XamariniOS@2
  displayName: 'Build Xamarin.iOS project'
  inputs:
    solutionFile: 'Source/MobileOnly.sln'
    configuration: '$(BuildConfiguration)'
    signingIdentity: '$(APPLE_CERTIFICATE_SIGNING_IDENTITY)'
    signingProvisioningProfileID: '$(APPLE_PROV_PROFILE_UUID)' 
    args: '/p:Platform=iPhone /target:Build'

- task: CopyFiles@2
  displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
  inputs:
    Contents: ' **/*.ipa'
    TargetFolder: '$(Build.ArtifactStagingDirectory)'
    CleanTargetFolder: false

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact: drop'               

I am seeing following error -

error CS0234: The type or namespace name 'Forms' does not exist in the namespace 'Xamarin' (are you missing an assembly reference?)

In the csproj file, I can see the package reference -
image

@benoit808
Copy link

Unfortunately the solutions offered with HomeBrew do not work for me because we need Xamarin.iOS SDK 17 since Apple will start rejecting app updates if not built against SDK 17 starting on April 29 but HomeBrew only has Xamarin.iOS SDK 16.4.

@nbevans
Copy link

nbevans commented Apr 11, 2024

How do we get homebrew to update their repo to the newer version?

@nbevans
Copy link

nbevans commented Apr 11, 2024

https://github.com/Homebrew/homebrew-cask/blob/701756e8aacc4cf253fa020c56716898da8235d5/Casks/x/xamarin-ios.rb

This is how the homebrew works and it looks ery simple. Could we not just download the newer .pkg file and execute it directly? Why do we even need homebrew?

@benoit808
Copy link

https://github.com/Homebrew/homebrew-cask/blob/701756e8aacc4cf253fa020c56716898da8235d5/Casks/x/xamarin-ios.rb

This is how the homebrew works and it looks ery simple. Could we not just download the newer .pkg file and execute it directly? Why do we even need homebrew?

The Xamarin.iOS does not list the download location for version 17 and looking at the releases, etc... there does not seem to be one. However, I was able to build my Xamarin.iOS solution, targeting SDK 17.2 with the Xamarin.iOS 16.4 version. It seems that the build is using the correct iOS SDK even if the Xamarin SDK is outdated.

I am still testing this build and have not submitted yet to Apple so not 100% sure it will work but I'm hopeful.

@nbevans
Copy link

nbevans commented Apr 12, 2024

https://github.com/xamarin/xamarin-macios/releases/tag/xamarin-ios-16.4.0.23

This is the latest with iOS 17 and Xcode 15 support

Indeed this is the same as the homebrew. There is no correlation between xamarin version numbers and those of iOS/Xcode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests