actions / runner-images

GitHub Actions runner images
MIT License
9.17k stars 2.84k forks source link

Update/Add Visual Studio for Mac 13 image #8528

Closed thefex closed 7 months ago

thefex commented 7 months ago

Tool name

Visual studio for Mac

Tool license

https://visualstudio.microsoft.com/license-terms/visual-studio-mac-eula/

Add or update?

Desired version

Latest stable channel

Approximate size

No response

Brief description of tool

Github mac13 runners miss Visual studio for mac which prevents building Xamarin.iOS/Android apps that are still supported till April of next year.

URL for tool's homepage

No response

Provide a basic test case to validate the tool's functionality.

No response

Platforms where you need the tool

Runner images where you need the tool

Can this tool be installed during the build?

I am not sure.

Tool installation time in runtime

No response

Are you willing to submit a PR?

No response

mikhailkoliada commented 7 months ago

Hello! VS for Mac is going to be completely retired by August 31 2024, see here, we are also aware that Xamarin components will be retired next April, so it was decided that neither Xamarin nor VSMAC will be pre-installed in the runner starting with macOS 13.

thefex commented 7 months ago
  1. Many enterprises need support xamarin ios/android during migration to net8.
  2. Xcode 14.3.1 is required with latest xamarin. As far as I know mac13 is required.
  3. Microsoft annouced build support for xamarin ios / xcode 15 yesterday.

Can you at least give guide how to install vs for mac as buildstep?

JohnHDev commented 7 months ago

Hello! VS for Mac is going to be completely retired by August 31 2024, see here, we are also aware that Xamarin components will be retired next April, so it was decided that neither Xamarin nor VSMAC will be pre-installed in the runner starting with macOS 13.

Xamarin has been updated to support Xcode 15 and is a fallback position if developers have not successfully migrated from Xamarin to .NET MAUI by 1st May 2024. To build for Xcode 15 we will need macOS-13 updated with Xamarin symlinks.

We are your paying customers, please listen to us. I pay for a single pipeline for my hobby projects, the company I work for pays for 20 concurrent build hosts.

JohnHDev commented 7 months ago

@mikhailkoliada any comments on the above pls? Is there a way of manually installing the components by script at least?

janwiebe-jump commented 7 months ago

@JohnHDev See https://github.com/actions/runner-images/issues/8320#issuecomment-1736578220

I have used boots to install the latest Xamarion.iOS version on a Mac OS 13 image (in an Azure DevOps runner):

 - script: |
        dotnet tool install --global boots
        boots https://download.visualstudio.microsoft.com/download/pr/de7f727f-243c-4429-8773-eebd735eb1bb/da4a65f27ace7f805914ef63661e0efd/xamarin.ios-16.4.0.18.pkg
   displayName: Install Xamarin.iOS
mikhailkoliada commented 7 months ago

@JohnHDev as far as I am aware Xamarin components (iOS, android, Mac) are still available in home-brew so you can install them by something like brew install --cask xamarin-ios

As of VS for Mac, as it requires the machine reboot, it does not looks possible to install it in runtime.

thefex commented 7 months ago

VS for mac is not necessary, xamarin ios and android should be sufficient

v0idzz commented 5 months ago

For anyone interested in building C# 10 apps with the Visual Studio provided MSBuild, I've implemented a workaround in my project which extracts the MonoBundle from VS for Mac installer and then uses it to build the app: https://github.com/Vulcanova/Vulcanova/blob/main/.github/workflows/ios.yml#L21

      - name: Download Visual Studio for Mac
        run: curl https://download.visualstudio.microsoft.com/download/pr/ceb0ea3f-4db8-46b4-8dc3-8049d27c0107/91eb158e928097dcb6e42ece2db7ebac/visualstudioformac-17.6.7.417-arm64.dmg -o /tmp/vsformac.dmg

      - name: Mount Visual Studio for Mac dmg
        run: hdiutil attach /tmp/vsformac.dmg

      - name: Extract MSBuild
        run: cp -R /Volumes/Visual\ Studio/Visual\ Studio.app/Contents/MonoBundle/MSBuild/Current/bin /tmp/msbuild

then, to build the app:

      - name: Build
        run: mono '/tmp/msbuild/MSBuild.dll' <your_csproj>
softlion commented 1 month ago

For anyone interested in building C# 10 apps with the Visual Studio provided MSBuild, I've implemented a workaround in my project which extracts the MonoBundle from VS for Mac installer and then uses it to build the app: https://github.com/Vulcanova/Vulcanova/blob/main/.github/workflows/ios.yml#L21

      - name: Download Visual Studio for Mac
        run: curl https://download.visualstudio.microsoft.com/download/pr/ceb0ea3f-4db8-46b4-8dc3-8049d27c0107/91eb158e928097dcb6e42ece2db7ebac/visualstudioformac-17.6.7.417-arm64.dmg -o /tmp/vsformac.dmg

      - name: Mount Visual Studio for Mac dmg
        run: hdiutil attach /tmp/vsformac.dmg

      - name: Extract MSBuild
        run: cp -R /Volumes/Visual\ Studio/Visual\ Studio.app/Contents/MonoBundle/MSBuild/Current/bin /tmp/msbuild

then, to build the app:

      - name: Build
        run: mono '/tmp/msbuild/MSBuild.dll' <your_csproj>

Where did you get the dl link I would like to update it ?

v0idzz commented 1 month ago

I believe I set up a proxy to monitor the installer’s network traffic.On 25 Mar 2024, at 15:34, ZeBen @.***> wrote:

For anyone interested in building C# 10 apps with the Visual Studio provided MSBuild, I've implemented a workaround in my project which extracts the MonoBundle from VS for Mac installer and then uses it to build the app: https://github.com/Vulcanova/Vulcanova/blob/main/.github/workflows/ios.yml#L21

Where did you get the dl link I would like to update it ?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

softlion commented 1 month ago

@v0idzz I fixed your version, as this issue will never be resolved. The path you used is incorrect.
This is what has worked for me.

So the whole idea is to use the macos13 image in order to get xcode 15 and get rid of the appstore warning.
(The "latest" image is macos12 with xcode 14 only).

The macos13 image does not have VS Mac pre-installed. And does not contain any xamarin sdk.
So we install the xamarin sdk via boots.

But that is insufficient. We also need msbuild from VsMac. That is because msbuild from mono is too old and don't understand xcode 15.

pool:
  vmImage: 'macos-13'

- task: Bash@3
  displayName: Install VS Mac 2022 MsBuild
  inputs:
    targetType: 'inline'
    failOnStderr: true
    script: |
      echo "downloading"
      curl -L "https://download.visualstudio.microsoft.com/download/pr/ceb0ea3f-4db8-46b4-8dc3-8049d27c0107/91eb158e928097dcb6e42ece2db7ebac/visualstudioformac-17.6.7.417-arm64.dmg" -o "/tmp/vsformac.dmg" 2>/dev/null
      echo "attaching"
      hdiutil attach "/tmp/vsformac.dmg" -noverify 2>/dev/null
      echo "copying"
      mkdir "/tmp/msbuild"
      cp -R "/Volumes/Visual Studio/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin" "/tmp/msbuild"
      ls -alF "/tmp/msbuild/bin"
      echo "done"

- task: Bash@3
  displayName: Install Xamarin.iOS
  inputs:
    targetType: 'inline'
    failOnStderr: true
    script: |
      dotnet tool install --global boots
      boots --stable Xamarin.Android
      boots --stable Xamarin.iOS

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

- task: InstallAppleProvisioningProfile@1
  displayName: 'InstallAppleProvisioningProfile'
  condition: eq(variables['Build.SourceBranch'], 'refs/heads/release/pro/store')
  inputs:
    provisioningProfileLocation: 'secureFiles'
    provProfileSecureFile: 'AppStore.mobileprovision'

- task: NuGetToolInstaller@1
  inputs:
    versionSpec: ">=6.7.0"

- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(Build.SourcesDirectory)/YourSolution.sln'
    feedsToUse: config

- task: Bash@3
  displayName: 'Build iOS IPA'
  inputs:
    targetType: 'inline'
    failOnStderr: true
    script: |
      signIdentityEscaped=$(echo "$APPLE_CERTIFICATE_SIGNING_IDENTITY" | sed 's/,/%2C/g')

      cmd='
      /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono
        "/tmp/msbuild/bin/MSBuild.dll"
        "'"$(Build.SourcesDirectory)"'/YourSolution.sln"
        /t:Build
        /p:Configuration=Release
        /p:Platform=iPhone
        /p:buildForSimulator=false
        /p:BuildIpa=true
        /p:Codesignkey="'"$signIdentityEscaped"'"
        /p:CodesignProvision='"$APPLE_PROV_PROFILE_UUID"'
      '

      echo $cmd
      eval $cmd

- task: AppCenterDistribute@3
  displayName: 'Post IPA and Symbols to appcenter distribute'
  condition: eq(variables['Build.SourceBranch'], 'refs/heads/release/pro/store')
  inputs:
    serverEndpoint: 'Your AppCenter Endpoint See Task Doc'
    destinationType: 'store'
    destinationStoreId: '$(APPCENTER_STOREID)'
    appSlug: 'YourCompany/$(APPCENTER_SLUG)'
    app: 'YourApp/YourApp.iOS/bin/iPhone/Release/YourAPpiOS.ipa'
    symbolsType: Apple
    dsymPath: 'YourApp/WYourApp.iOS/bin/iPhone/Release/YourAppiOS.app.dSYM'
    releaseNotesSelection: 'input'
    releaseNotesInput: 'Updates to our mobile app'
v0idzz commented 1 month ago

@softlion It's strange that it didn't work for you because I've been using this pipeline in my projects without any issue. Last time it ran was 5 days ago https://github.com/Vulcanova/Vulcanova/actions/runs/8379671635/job/22947155813

AlexProskura commented 2 weeks ago

@v0idzz does it work fine? I have an issues with the Roslyn references in my projects, when I'm trying to build Xamarin.Forms application for iOS

kristianpinke commented 1 week ago

@JohnHDev as far as I am aware Xamarin components (iOS, android, Mac) are still available in home-brew so you can install them by something like brew install --cask xamarin-ios

As of VS for Mac, as it requires the machine reboot, it does not looks possible to install it in runtime.

This is the most easiest way how to fix your current pipeline⬆️

My setup is like:

  1. Change vmImagefrom macOS-latest to at least macOS-13
  2. Add to job steps:
    - script: |
        brew install --cask xamarin-ios
  3. Use XamariniOS@2 task to build your Xamarin project

Just to note, these are needed to build Xamarin projects with latest iPhone SDK in order to be able to push them into Apple Store. With macOS-latest you will compile against old SDK which leads to rejection at IPA package upload to the store.

ranjithtech commented 1 week ago

@v0idzz I fixed your version, as this issue will never be resolved. The path you used is incorrect. This is what has worked for me.

So the whole idea is to use the macos13 image in order to get xcode 15 and get rid of the appstore warning. (The "latest" image is macos12 with xcode 14 only).

The macos13 image does not have VS Mac pre-installed. And does not contain any xamarin sdk. So we install the xamarin sdk via boots.

But that is insufficient. We also need msbuild from VsMac. That is because msbuild from mono is too old and don't understand xcode 15.

pool:
  vmImage: 'macos-13'

- task: Bash@3
  displayName: Install VS Mac 2022 MsBuild
  inputs:
    targetType: 'inline'
    failOnStderr: true
    script: |
      echo "downloading"
      curl -L "https://download.visualstudio.microsoft.com/download/pr/ceb0ea3f-4db8-46b4-8dc3-8049d27c0107/91eb158e928097dcb6e42ece2db7ebac/visualstudioformac-17.6.7.417-arm64.dmg" -o "/tmp/vsformac.dmg" 2>/dev/null
      echo "attaching"
      hdiutil attach "/tmp/vsformac.dmg" -noverify 2>/dev/null
      echo "copying"
      mkdir "/tmp/msbuild"
      cp -R "/Volumes/Visual Studio/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin" "/tmp/msbuild"
      ls -alF "/tmp/msbuild/bin"
      echo "done"

- task: Bash@3
  displayName: Install Xamarin.iOS
  inputs:
    targetType: 'inline'
    failOnStderr: true
    script: |
      dotnet tool install --global boots
      boots --stable Xamarin.Android
      boots --stable Xamarin.iOS

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

- task: InstallAppleProvisioningProfile@1
  displayName: 'InstallAppleProvisioningProfile'
  condition: eq(variables['Build.SourceBranch'], 'refs/heads/release/pro/store')
  inputs:
    provisioningProfileLocation: 'secureFiles'
    provProfileSecureFile: 'AppStore.mobileprovision'

- task: NuGetToolInstaller@1
  inputs:
    versionSpec: ">=6.7.0"

- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(Build.SourcesDirectory)/YourSolution.sln'
    feedsToUse: config

- task: Bash@3
  displayName: 'Build iOS IPA'
  inputs:
    targetType: 'inline'
    failOnStderr: true
    script: |
      signIdentityEscaped=$(echo "$APPLE_CERTIFICATE_SIGNING_IDENTITY" | sed 's/,/%2C/g')

      cmd='
      /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono
        "/tmp/msbuild/bin/MSBuild.dll"
        "'"$(Build.SourcesDirectory)"'/YourSolution.sln"
        /t:Build
        /p:Configuration=Release
        /p:Platform=iPhone
        /p:buildForSimulator=false
        /p:BuildIpa=true
        /p:Codesignkey="'"$signIdentityEscaped"'"
        /p:CodesignProvision='"$APPLE_PROV_PROFILE_UUID"'
      '

      echo $cmd
      eval $cmd

- task: AppCenterDistribute@3
  displayName: 'Post IPA and Symbols to appcenter distribute'
  condition: eq(variables['Build.SourceBranch'], 'refs/heads/release/pro/store')
  inputs:
    serverEndpoint: 'Your AppCenter Endpoint See Task Doc'
    destinationType: 'store'
    destinationStoreId: '$(APPCENTER_STOREID)'
    appSlug: 'YourCompany/$(APPCENTER_SLUG)'
    app: 'YourApp/YourApp.iOS/bin/iPhone/Release/YourAPpiOS.ipa'
    symbolsType: Apple
    dsymPath: 'YourApp/WYourApp.iOS/bin/iPhone/Release/YourAppiOS.app.dSYM'
    releaseNotesSelection: 'input'
    releaseNotesInput: 'Updates to our mobile app'

Thank you. For me, I have to update the Install Xamarin.iOS with below

- script: | brew install --cask xamarin-ios

unamed000 commented 1 week ago

Tried all above suggestions, not working for my projects due to my project has more complicated references (Roslyn references). It's not able to restore the sub project

softlion commented 1 week ago

Tried all above suggestions, not working for my projects due to my project has more complicated references (Roslyn references). It's not able to restore the sub project

Time to switch to maui.
Xamarin github's repository is archived. Noone can even contribute to it. And noone will publish any nuget for it anymore.
Visual Studio Mac is also stopped, and all download links will be retired the 1st of June.
So it won't be possible to install it anymore, even from Azure Pipeline.

In a few months (September), when the next iOS and the next Android are launched, you won't be able to publish a Xamarin app for those anyway.

unamed000 commented 1 week ago

Tried all above suggestions, not working for my projects due to my project has more complicated references (Roslyn references). It's not able to restore the sub project

Time to switch to maui. Xamarin github's repository is archived. Noone can even contribute to it. And noone will publish any nuget for it anymore. Visual Studio Mac is also stopped, and all download links will be retired the 1st of June. So it won't be possible to install it anymore, even from Azure Pipeline.

In a few months (September), when the next iOS and the next Android are launched, you won't be able to publish a Xamarin app for those anyway.

Tried to move to MAUI but failed due to many issues.

So ... no thanks, we would rather stick with this for awhile, release a final version (do it manually for now) and decide if we should migrate to MAUI or switch to another framework instead of migrating to the buggy state of MAUI at the moment

When next iOS or next Android is launched, we still have couples month ,so at least it should be April next year

softlion commented 1 week ago

Not sure what you are doing, but: