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

Can't build Xamarin.ios with Xcode 15.1 and SDK 17 #2621

Open
victorbeltranpinol opened this issue Mar 11, 2024 · 20 comments
Open

Can't build Xamarin.ios with Xcode 15.1 and SDK 17 #2621

victorbeltranpinol opened this issue Mar 11, 2024 · 20 comments
Labels
build Related to App Center's Build service feature request New feature request

Comments

@victorbeltranpinol
Copy link

Describe the solution you'd like
I would like to build the iOS Xamarin Forms using Xamarin.iOS 16.4 and Xcode 15.0.1 Preview

Additional context
When I try to build my app in the App Center using:
SDK version: Xamarin.iOS 16.4
Xcode version: 15.0.1 Preview

I have many errors like this:

/Users/runner/work/1/s/MyProject/obj/iPhone/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs(4,20): error CS0400: The type or namespace name 'System' could not be found in the global namespace (are you missing an assembly reference?) [/Users/runner/work/1/s/MyProject/MyProject.csproj]
/Users/runner/work/1/s/MyProject/obj/iPhone/Release/netstandard2.0/MyProject.AssemblyInfo.cs(14,55): error CS0518: Predefined type 'System.String' is not defined or imported [/Users/runner/work/1/s/MyProject/MyProject.csproj]

However, if I run the build using:
SDK version: Xamarin.iOS 16.2
Xcode version: 14.2

It works like a charm

I received this email from Apple, therefore I must build the APP using SDK iOS 17 and Xcode 15

ITMS-90725: SDK version issue - This app was built with the iOS 16.2 SDK. Starting April 29, 2024, all iOS and iPadOS apps must be built with the iOS 17 SDK or later, included in Xcode 15 or later, in order to be uploaded to App Store Connect or submitted for distribution.

Is there something not ready in the ios build machines of the App Center? Does somebody have success using xcode 15?

Thanks in advance

@victorbeltranpinol victorbeltranpinol added the feature request New feature request label Mar 11, 2024
@victorbeltranpinol victorbeltranpinol changed the title Can't build Xamarion.ios with Xcode 15.1 Can't build Xamarion.ios with Xcode 15.1 and SDK 17 Mar 11, 2024
@victorbeltranpinol victorbeltranpinol changed the title Can't build Xamarion.ios with Xcode 15.1 and SDK 17 Can't build Xamarin.ios with Xcode 15.1 and SDK 17 Mar 11, 2024
@follesoe
Copy link

As a bare minimum, Microsoft should ensure AppCenter stays alive and supports the last Xamarin releases, preventing developers from having to waste time on yet a migration (from AppCenter to another build service), and rather can focus on migrating from Xamarin to MAUI.

@AngelAndresM
Copy link

Is there any update on this incident?

I also have this problem.

@victorbeltranpinol
Copy link
Author

@AngelAndresM not yet. As a workaround I published the app building with a local mac

@follesoe
Copy link

One possible solution is to use pre-build scripts to try and install Xcode 15 and the latest Xamarin.iOS versions.

I have also submitted an issue for the macos-12 runner, which is what AppCenter uses, to get the latest Xamarin tools included: actions/runner-images#9512

@follesoe
Copy link

I used a similar work-around to install the latest version of Xamarin.Android, to build against Android 34. See comment in issue #2611 for the script.

@cjrvdev
Copy link

cjrvdev commented Mar 15, 2024

Honestly doubt there will be support in a long time. I personally raised a ticket in the past to support this and they had it planned for like 1 month later (And when I asked it was already way too late so...)

@EmmanVazz
Copy link

One possible solution is to use pre-build scripts to try and install Xcode 15 and the latest Xamarin.iOS versions.

I have also submitted an issue for the macos-12 runner, which is what AppCenter uses, to get the latest Xamarin tools included: actions/runner-images#9512

@follesoe Can you post the pre-build script you used here? I think many of us will need it. Thanks!

@follesoe
Copy link

@EmmanVazz I believe Xcode 15 is installed already. I have not done manual installs of Xamarin.iOS yet, but this is how I did it for Xamarin.Android:

#!/usr/bin/env bash
PKG_URL="https://dl.xamarin.com/MonoforAndroid/Mac/xamarin.android-13.2.2.0.pkg"
PKG_NAME=${PKG_URL##*/}
curl -4fsLo "${PKG_NAME}" "${PKG_URL}"
sudo installer -pkg "${PKG_NAME}" -target /

@noahcolvin
Copy link

Not sure the above pre-build script (modified for Xamarin.iOS) will work here. My build is already installing xamarin.ios-16.4.0.23.pkg and is using the macos-13 image, not 12 like stated above. I'm getting the same errors as OP so there might be more to it.

@AjitKRuin
Copy link

AjitKRuin commented Mar 28, 2024

@victorbeltranpinol , how do you update Xamarin.iOS to 16.4 in cs proj or code level in Xamarin iOS project? do we need to change any package as for me I kept Xamarin.IOS as reference only how can we update?

@rafageist
Copy link

rafageist commented Apr 4, 2024

@AjitKRuin You don't need to change your project. Migrate to Github Actions with:

  • Macos-14
  • XCode 15.1
  • Dotnet 6.0.x
  • Xamarin.iOS using dotnet boots
  • Download and get msbuild from visual studio for mac 17.6.x .dmg image
  • Use mono and msbuild.dll to restore Nugets and build your .ipa
  • Use your Github secrets to sign and publish with xcrun altool

happy hacking

@jdinnen
Copy link

jdinnen commented Apr 12, 2024

I was experiencing a similar issue, it was the nuget restore for solution failing as it was trying to restore things for Android also, even though I am building the iOS csproj.

##[group]Runner Image
Image: macos-13
Version: 20240405.2
Included Software: https://github.com/actions/runner-images/blob/macos-13/20240405.2/images/macos/macos-13-Readme.md
Image Release: https://github.com/actions/runner-images/releases/tag/macos-13%2F20240405.2

This is the error in the nuget restore

/Users/runner/work/1/s/JobTask/JobTask.Android/JobTask.Android.csproj(321,11): error MSB4226: The imported project "/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/xbuild/Xamarin/Android/Xamarin.Android.CSharp.targets" was not found. Also, tried to find "Xamarin/Android/Xamarin.Android.CSharp.targets" in the fallback search path(s) for $(MSBuildExtensionsPath) - "/Library/Frameworks/Mono.framework/External/xbuild/" . These search paths are defined in "/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin/MSBuild.dll.config". Confirm that the path in the <Import> declaration is correct, and that the file exists on disk in one of the search paths.

Anyway the work around was to add an appcenter-post-clone.sh to the iOS directory and add the following to it, since it seems to be missing something to do with Android...

#!/bin/bash

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

Now it installs xamarin-android... FWIW, you can just have the android install as the build scrip will install xamarin-ios later if it is missing. This works for me at least..

@noahcolvin
Copy link

Thanks @jdinnen that worked for me! I had tried adding those to the pre-build script before without luck but the post-clone did the trick. I hadn't noticed any errors in the logs related to Android but this did something. TestFlight is reporting the iOS 17 SDK and I'm not seeing any issues running the app.

@juanpgallardo
Copy link

juanpgallardo commented Apr 24, 2024

Thanks @jdinnen. I can confirm that your solution works. The issue, as you mentioned, was caused by errors during the nuget restore for the Android projects, so, installing the xamarin-android cask on the appcenter-post-clone.sh seems to workaround this issue.

I think this is probably an Appcenter bug, as it doesn't make sense that we need to worry about the android projects during the iOS build. Also, it only happens when upgrading to XCode 15.0.1 Preview, SDK version: Xamarin.iOS 16.4.

@DmitriyKirakosyan DmitriyKirakosyan added the build Related to App Center's Build service label Apr 25, 2024
@AmaluThomas
Copy link

Thanks @jdinnen that worked for me! I had tried adding those to the pre-build script before without luck but the post-clone did the trick. I hadn't noticed any errors in the logs related to Android but this did something. TestFlight is reporting the iOS 17 SDK and I'm not seeing any issues running the app.

Are you able to upload app to testflight with sdk 17 for ios?

@noahcolvin
Copy link

@AmaluThomas Yes, TestFlight is reporting the iOS 17 SDK and it was approved by Apple.

@Nikclim
Copy link

Nikclim commented May 29, 2024

@EmmanVazz I believe Xcode 15 is installed already. I have not done manual installs of Xamarin.iOS yet, but this is how I did it for Xamarin.Android:

#!/usr/bin/env bash
PKG_URL="https://dl.xamarin.com/MonoforAndroid/Mac/xamarin.android-13.2.2.0.pkg"
PKG_NAME=${PKG_URL##*/}
curl -4fsLo "${PKG_NAME}" "${PKG_URL}"
sudo installer -pkg "${PKG_NAME}" -target /

Maybe I do something wrong, but it doesn't work for me. I've tried to insert it into pre-build script for android and for ios but build is steal crashing.

@Nikclim
Copy link

Nikclim commented May 29, 2024

I was experiencing a similar issue, it was the nuget restore for solution failing as it was trying to restore things for Android also, even though I am building the iOS csproj.

##[group]Runner Image
Image: macos-13
Version: 20240405.2
Included Software: https://github.com/actions/runner-images/blob/macos-13/20240405.2/images/macos/macos-13-Readme.md
Image Release: https://github.com/actions/runner-images/releases/tag/macos-13%2F20240405.2

This is the error in the nuget restore

/Users/runner/work/1/s/JobTask/JobTask.Android/JobTask.Android.csproj(321,11): error MSB4226: The imported project "/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/xbuild/Xamarin/Android/Xamarin.Android.CSharp.targets" was not found. Also, tried to find "Xamarin/Android/Xamarin.Android.CSharp.targets" in the fallback search path(s) for $(MSBuildExtensionsPath) - "/Library/Frameworks/Mono.framework/External/xbuild/" . These search paths are defined in "/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin/MSBuild.dll.config". Confirm that the path in the <Import> declaration is correct, and that the file exists on disk in one of the search paths.

Anyway the work around was to add an appcenter-post-clone.sh to the iOS directory and add the following to it, since it seems to be missing something to do with Android...

#!/bin/bash

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

Now it installs xamarin-android... FWIW, you can just have the android install as the build scrip will install xamarin-ios later if it is missing. This works for me at least..

It's a pity, but it doesn't work for me.
Should I add something more in the post-clone script?

@BitProgress
Copy link

Thanks @jdinnen that worked for me.
A little note...
If you point to ".sln", the appcenter-post-clone.sh must be located in directory of ".sln" file.
If you point to ".prj", the appcenter-post-clone.sh must be located in directory ".prj" file.

@Rikard-sut
Copy link

I was experiencing a similar issue, it was the nuget restore for solution failing as it was trying to restore things for Android also, even though I am building the iOS csproj.

##[group]Runner Image
Image: macos-13
Version: 20240405.2
Included Software: https://github.com/actions/runner-images/blob/macos-13/20240405.2/images/macos/macos-13-Readme.md
Image Release: https://github.com/actions/runner-images/releases/tag/macos-13%2F20240405.2

This is the error in the nuget restore

/Users/runner/work/1/s/JobTask/JobTask.Android/JobTask.Android.csproj(321,11): error MSB4226: The imported project "/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/xbuild/Xamarin/Android/Xamarin.Android.CSharp.targets" was not found. Also, tried to find "Xamarin/Android/Xamarin.Android.CSharp.targets" in the fallback search path(s) for $(MSBuildExtensionsPath) - "/Library/Frameworks/Mono.framework/External/xbuild/" . These search paths are defined in "/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin/MSBuild.dll.config". Confirm that the path in the <Import> declaration is correct, and that the file exists on disk in one of the search paths.

Anyway the work around was to add an appcenter-post-clone.sh to the iOS directory and add the following to it, since it seems to be missing something to do with Android...

#!/bin/bash

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

Now it installs xamarin-android... FWIW, you can just have the android install as the build scrip will install xamarin-ios later if it is missing. This works for me at least..

Ive added the post clone script, appcenter tells me the sdk is not available on agent.

[command]/bin/bash /Users/runner/runners/3.240.1/scripts/select-xamarin-sdk.sh 6_12_25
Xamarin SDK not available on agent.
==> Downloading https://download.visualstudio.microsoft.com/download/pr/ceb0ea3f-4db8-46b4-8dc3-8049d27c0107/3960868aa9b1946a6c77668c3f3334ee/xamarin.ios-16.4.0.23.pkg
==> Installing Cask xamarin-ios
Warning: macOS's Gatekeeper has been disabled for this Cask
==> Running installer for xamarin-ios with sudo; the password may be necessary.
installer: Package name is Xamarin.iOS
installer: Installing at base path /
installer: The install was successful.
🍺 xamarin-ios was successfully installed!

Then i still receive the exact same error when it's trying to restore nugets for android...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Related to App Center's Build service feature request New feature request
Projects
None yet
Development

No branches or pull requests