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

[iOS] MAUI project won't build with the 8.0.0-rc.2.9530 version on Azure Pipeline #18632

Closed
Yokaichan opened this issue Nov 8, 2023 · 14 comments
Labels
platform/iOS 🍎 s/needs-attention Issue has more information and needs another look t/bug Something isn't working

Comments

@Yokaichan
Copy link

Yokaichan commented Nov 8, 2023

Description

The Azure Pipeline, set to use the 8.0.x version, install the Microsoft.Maui.Sdk version 8.0.0-rc.2.9530 and the microsoft.net.sdk.ios version 17.0.8477-net8-rc2.2.
But with those versions, the project won't build anymore.

I already tried to change the csproj with:

  • <PublishTrimmed>false</PublishTrimmed>
  • to change the SupportedOSPlatformVersion

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

Unknown/Other

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

8.0.0-rc.2.9511

Affected platforms

iOS

Affected platform versions

microsoft.net.sdk.ios version 17.0.8477-net8-rc2.2.

Did you find any workaround?

No

Relevant log output

ILLINK : warning MT0079: The recommended Xcode version for Microsoft.iOS 17.0.8477 is Xcode 15.0 or later. The current Xcode version (found in /Applications/Xcode_14.2.app/Contents/Developer) is 14.2. [/Users/runner/work/1/s/Enviromix.MAUI/Enviromix.MAUI/Enviromix.MAUI.csproj::TargetFramework=net8.0-ios]
  		
ILLink : iOS error IL7000: An error occured while executing the custom linker steps. Please review the build log for more information. [/Users/runner/work/1/s/Enviromix.MAUI/Enviromix.MAUI/Enviromix.MAUI.csproj::TargetFramework=net8.0-ios]
/Users/builder/azdo/_work/1/s/xamarin-macios/src/build/dotnet/ios/generated-sources/UIKit/UIApplication.g.cs(95): error MT4162: The type 'UIKit.UISceneSessionActivationRequest' (used as a parameter in UIKit.UIApplication.ActivateSceneSession) is not available in iOS 16.2 (it was introduced in iOS 17.0). Please build with a newer iOS SDK (usually done by using the most recent version of Xcode). [/Users/runner/work/1/s/Enviromix.MAUI/Enviromix.MAUI/Enviromix.MAUI.csproj::TargetFramework=net8.0-ios]
  		
ILLINK : error MT2362: The linker step 'Registrar' failed during processing: The type 'UIKit.UISceneSessionActivationRequest' (used as a parameter in UIKit.UIApplication.ActivateSceneSession) is not available in iOS 16.2 (it was introduced in iOS 17.0). Please build with a newer iOS SDK (usually done by using the most recent version of Xcode). [/Users/runner/work/1/s/Enviromix.MAUI/Enviromix.MAUI/Enviromix.MAUI.csproj::TargetFramework=net8.0-ios]
  		
/Users/runner/.nuget/packages/microsoft.net.illink.tasks/8.0.0-rc.2.23479.6/build/Microsoft.NET.ILLink.targets(87,5): error NETSDK1144: Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false. [/Users/runner/work/1/s/Enviromix.MAUI/Enviromix.MAUI/Enviromix.MAUI.csproj::TargetFramework=net8.0-ios]
@Yokaichan Yokaichan added the t/bug Something isn't working label Nov 8, 2023
@mattleibow
Copy link
Member

I think you need to install/select Xcode 15.

Try running this as part of the setup:

sudo xcode-select -s /Applications/Xcode_15.0.1.app

@mattleibow mattleibow added the s/needs-info Issue needs more info from the author label Nov 8, 2023
@ghost
Copy link

ghost commented Nov 8, 2023

Hi @Yokaichan. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@Yokaichan
Copy link
Author

Yokaichan commented Nov 8, 2023

I think you need to install/select Xcode 15.

Try running this as part of the setup:

sudo xcode-select -s /Applications/Xcode_15.0.1.app

Thank you for your response but I'm not very familiar with Azure Pipeline and when I try to add the sudo code, the error "invalid developer directory" appears.

Edited: I added the yaml file which describe the pipeline
pipeline.txt

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-info Issue needs more info from the author labels Nov 8, 2023
@GeorgeDarakchiev
Copy link

Hi @Yokaichan,

Check the use-custom-xcode-template.txt template. You can use like this in your pipelines (or you can just copy the ask inside of it).

- template: use-custom-xcode-template.yml
- task: UseDotNet@2
  displayName: 'Use .NET Core sdk 8.0.0'
  inputs:
    version: 8.0.x
    includePreviewVersions: true

Also you will need to run the pipeline on macos13 by setting

pool:
  vmImage: macOS-13

@jfversluis
Copy link
Member

Let us know if that worked!

@jfversluis jfversluis added s/needs-info Issue needs more info from the author and removed s/needs-attention Issue has more information and needs another look labels Nov 9, 2023
@ghost
Copy link

ghost commented Nov 9, 2023

Hi @Yokaichan. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@Stxtics
Copy link

Stxtics commented Nov 9, 2023

I was having the same issue and thanks to the responses here I was able to resolve it.

However, at first, I only added the Xcode script as I was already targeting macOS-latest so I thought I didn't need to specify macOS-13 but it turns out I did!

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-info Issue needs more info from the author labels Nov 9, 2023
@Yokaichan
Copy link
Author

Thank you very much !

based on your response I added those two lines before my workload install script:

sudo xcode-select -s /Applications/Xcode_15.0.1.app
xcodebuild -version

And I set the agent specification to maco-13 and it works like a charm.

I didn't try to set both xcode version and macos-13 (I thought that latest means 13 in this case).

@daryltt
Copy link

daryltt commented Nov 19, 2023

I can confirm that I had the same issue with github actions. I had to do two things to resolve:

  • Change runs-on: macos-latest to runs-on: macos-13
  • Add a step to use the latest xcode:
    - uses: maxim-lobanov/setup-xcode@v1
    with:
    xcode-version: latest

@MichaelShapiro
Copy link

MichaelShapiro commented Nov 20, 2023

@GeorgeDarakchiev Thank you for the script idea - it did fixed my pipeline that was "hoping" that the algorithm would pick up the latest and greatest as the instructions in my pipeline. I want to double-check with you great people who are smarter than myself in the area of azure deployment architecture: is my understanding correct that we need the above solution only for the time being until Microsoft adjusts it's algorithm to actually use the latest xcode by default, right? Or it is always necessary to manually instruct the pipeline about the version of xcode to use???

@GeorgeDarakchiev
Copy link

Heu @MichaelShapiro ,

Choosing the exact version of Xcode is needed until the desired version is set as default. You can check what is the default version of the Xcode in the https://github.com/actions/runner-images repo.

@MichaelShapiro
Copy link

Heu @MichaelShapiro ,

Choosing the exact version of Xcode is needed until the desired version is set as default. You can check what is the default version of the Xcode in the https://github.com/actions/runner-images repo.

Thank you very much for the info!

@stevedcc
Copy link

Are there any suggestions for Azure DevOps? The discussion here revolves around github actions, but the same problem exists with Microsoft hosted agents on Azure DevOps.

@stevedcc
Copy link

It turns out "sudo xcode-select -s /Applications/Xcode_15.0.1.app" is sufficient for AzureDevOps: the "Recent updates" documentation at https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml does not list xcode 15 as installed, but it the detailed list for macos-13 does show it as present.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform/iOS 🍎 s/needs-attention Issue has more information and needs another look t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants