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

Cannot build Maui 9 with macos-15 #11348

Open
2 of 16 tasks
sven-s opened this issue Jan 10, 2025 · 9 comments
Open
2 of 16 tasks

Cannot build Maui 9 with macos-15 #11348

sven-s opened this issue Jan 10, 2025 · 9 comments

Comments

@sven-s
Copy link

sven-s commented Jan 10, 2025

Description

I am trying to build a Maui 9 project with the following command line:

dotnet publish -f net9.0-ios -c Release -p:ArchiveOnBuild=true /p:RuntimeIdentifier=ios-arm64 cpm-app/cpm-app.csproj

I am also setting the xcode version to 16.2 via

sudo xcode-select -s /Applications/Xcode_16.2.0.app/Contents/Developer

but I get the following error i the build:

2025-01-10 14:51:35.165 xcodebuild[8338:37797] Writing error result bundle to /var/folders/sg/7ncxbtp941dd9ql29twtl6jw0000gn/T/ResultBundle_2025-10-01_14-51-0035.xcresult xcodebuild: error: SDK "/Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" cannot be located. 2025-01-10 14:51:37.449 xcodebuild[8480:38140] Writing error result bundle to /var/folders/sg/7ncxbtp941dd9ql29twtl6jw0000gn/T/ResultBundle_2025-10-01_14-51-0037.xcresult xcodebuild: error: SDK "/Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" cannot be located. xcrun: error: sh -c '/Applications/Xcode_16.2.0.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -find actool 2> /dev/null' failed with exit code 16384: (null) (errno=No such file or directory) xcrun: error: unable to find utility "actool", not a developer tool or in PATH

Platforms affected

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

Runner images affected

  • Ubuntu 20.04
  • Ubuntu 22.04
  • Ubuntu 24.04
  • macOS 12
  • macOS 13
  • macOS 13 Arm64
  • macOS 14
  • macOS 14 Arm64
  • macOS 15
  • macOS 15 Arm64
  • Windows Server 2019
  • Windows Server 2022
  • Windows Server 2025

Image version and build link

20250106.547

Is it regression?

no

Expected behavior

The build should succeed

Actual behavior

The build fails

Repro steps

  • build a maui .net 9 project
@aartis17
Copy link
Contributor

@sven-s We will investigate the issue and keep you posted on further updates.
Thank you.

@DevDachi
Copy link

@aartis17 Thanks for looking into this. We are also facing same issue.

@maroy1986
Copy link

maroy1986 commented Jan 17, 2025

Faced the same issue. Had to change XCode to version 16.1 instead of 16.2 to make it work while waiting for a fix. It's been broken for almost a week now. See #11335 #11329 also.

@aartis17
Copy link
Contributor

Hi @sven-s We are closing this issue as a duplicate of #11335. Please follow suggested item in order to be updated on the matter. Thank you.

@sven-s
Copy link
Author

sven-s commented Jan 17, 2025

@aartis17 But #11335 targets another macos version. This issue is about maco15.

@sven-s
Copy link
Author

sven-s commented Jan 17, 2025

@maroy1986 I tried Xcode 16.1, but that did not work:

The linker gives me this warning: ILLINK : warning MT0079: The recommended Xcode version for Microsoft.iOS 18.2.9170 is Xcode 16.2 or later.

And I got this error:

/Users/builder/azdo/_work/9/s/xamarin-macios/src/build/dotnet/ios/generated-sources/AVFoundation/AVAudioSession.g.cs(659): error MT4162: The type 'AVFoundation.AVAudioSessionMicrophoneInjectionMode' (used as a parameter in AVFoundation.AVAudioSession.SetPreferredMicrophoneInjectionMode) is not available in iOS 18.1 (it was introduced in iOS 18.2). Please build with a newer iOS SDK (usually done by using the most recent version of Xcode). [/Users/runner/work/1/s/cpm-app-extension-share/cpm-app-extension-share.csproj]

So to me, the version to go for .NET 9 Maui is Xcode 16.2

@aartis17
Copy link
Contributor

Hi @sven-s ,
Could you please provide additional information about the .NET project and the workflow file you are using? I'll investigate it further.
Thanks.

@aartis17 aartis17 reopened this Jan 21, 2025
@sven-s
Copy link
Author

sven-s commented Jan 21, 2025

Hi @aartis17,

the solution is a .NET Maui project template which looks like this:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFrameworks>net9.0-android;net9.0-ios</TargetFrameworks>

    <OutputType>Exe</OutputType>
    <RootNamespace>Cpm.App</RootNamespace>
    <UseMaui>true</UseMaui>
    <SingleProject>true</SingleProject>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>

    <!-- Display name -->
    <ApplicationTitle>CPM 2</ApplicationTitle>

    <!-- App Identifier -->
    <ApplicationId>myapp</ApplicationId>

    <!-- Versions -->
    <ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
    <ApplicationVersion>1</ApplicationVersion>

    <NeutralLanguage>en-US</NeutralLanguage>
    <RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
    <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">15.0</SupportedOSPlatformVersion>
    <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">23.0</SupportedOSPlatformVersion>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net9.0-ios|AnyCPU'">
    <CodesignProvision>Automatic</CodesignProvision>
    <CodesignKey>iPhone Developer</CodesignKey>
    <CodesignEntitlements>Platforms\iOS\Entitlements.plist</CodesignEntitlements>
    <CreatePackage>false</CreatePackage>
  </PropertyGroup>

  <PropertyGroup Condition="'$(TargetFramework)' == 'net9.0-ios'">
    <RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net9.0-ios|AnyCPU'">
    <CreatePackage>false</CreatePackage>
    <CodesignKey>Apple Distribution: xxxx</CodesignKey>
    <CodesignProvision>CPM-App</CodesignProvision>
    <BuildIpa>true</BuildIpa>
    <IpaPackageName>cpm.ipa</IpaPackageName>
    <MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net9.0-android|AnyCPU'">
    <AndroidPackageFormat>apk</AndroidPackageFormat>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net9.0-android|AnyCPU'">
    <AndroidDexTool>d8</AndroidDexTool>
  </PropertyGroup>

  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <LangVersion>preview</LangVersion>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <WarningLevel>4</WarningLevel>
    <LangVersion>preview</LangVersion>
  </PropertyGroup>
  <ItemGroup>
    <!-- App Icon -->
    <MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />

    <MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
    <MauiSplashScreen Include="Resources\Splash\mysplash.svg" Color="#02137A" BaseSize="411,411" Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'ios'" />

    <!-- Images -->
    <MauiImage Include="Resources\Images\*" />

    <!-- Custom Fonts -->
    <MauiFont Include="Resources\Fonts\*" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference ..  />
  </ItemGroup>

  <ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
    <BundleResource Include="Platforms\iOS\PrivacyInfo.xcprivacy" LogicalName="PrivacyInfo.xcprivacy" />
    <MauiAsset Include="Platforms\iOS\Resources\de.lproj\InfoPlist.strings" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
    <MauiAsset Include="Platforms\iOS\Resources\en.lproj\InfoPlist.strings" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
    <BundleResource Include="Platforms\iOS\GoogleService-Info.plist" Link="GoogleService-Info.plist" />
    <MauiImage Include="Platforms\iOS\Resources\Images\splash_screen.jpg" />
    <InterfaceDefinition Include="Resources\LaunchScreen.storyboard" />
  </ItemGroup>

  ... other elements

</Project>

i use this workflow:

steps:

  - checkout: self
    displayName: 'git checkout'
    fetchDepth: 1
    fetchTags: false
    clean: true
    submodules: true

  - task: UseDotNet@2
    displayName: 'Use .NET SDK 9.0'
    inputs:
      packageType: 'sdk'
      version: '9.x'
      includePreviewVersions: false

  - task: Bash@3
    displayName: 'Restore workload used'
    inputs:
      targetType: 'inline'
      script: |
        dotnet workload install ios android maui
        dotnet workload restore cpm-app.sln
        dotnet restore --locked-mode cpm-app.sln
        dotnet --info

  - task: Bash@3
    displayName: 'Build iOS App'
    inputs:
      targetType: 'inline'
      script: |
        dotnet publish -f net9.0-ios -c Release -p:ArchiveOnBuild=true /p:RuntimeIdentifier=ios-arm64 cpm-app/cpm-app.csproj

Is that enough info?

@joshbartley
Copy link

@sven-s

This uses .net 9 with xcode 16.2 and publishes fine for our app. It's a bit truncated because of other steps to shuffle files around.

jobs: 
  build-ios:
      runs-on: macos-15
      #runs-on:      
      ##  group: cd_mac_runners
      name: iOS Build
      steps:
        - uses: maxim-lobanov/setup-xcode@v1
          name: Set XCode version
          with:
            xcode-version: latest-stable
      
        - name: Checkout
          uses: actions/checkout@v3
  
        - name: Setup .NET 9
          uses: actions/setup-dotnet@v2
          with:
            dotnet-version: 9.0.x  


        # a lot of other setup stuff


        - name: Publish MAUI iOS
          env: 
            ENTITLEMENTS: 'src/Maui/Platforms/iOS/Entitlements.Production.plist'
          run: |            
            dotnet publish src/Maui/MyProject.csproj -f net9.0-ios -c Release --property WarningLevel=0 -p:ArchiveOnBuild=true -p:RuntimeIdentifier=ios-arm64 -p:ApplicationId="com.myapp.app" -p:CodesignKey="Apple Distribution: My Key" -p:CodesignProvision="Distribution com.myapp.app"









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

6 participants