Unable to build projects due to Xcode mismatch
See original GitHub issueDescribe the bug
A clear and concise description of what the bug is.
To Reproduce
Running on macOS 12 with Xcode 14.2, having Visual Studio Mac 17.5.4 installed, and a handful of .NET SDK 7.0.1xx and 7.0.2xx installed (including 7.0.203 which appears to be required by this version of VS Mac). If I try to build a project targeted to either net6.0-ios or net6.0-ios14.2 (if this doesn’t say to use Xcode 14.2, then what in the world is it meant for?) I cannot for the life of me get an ios project to build because of a complaint that “this version of microsoft.ios needs the headers from Xcode 14.3” during the IL trimming phase. First of all… what version is this referring to? I’m guessing that it is talking about the ios workload?
Ok so experimentation time. I first tried to roll back to the packages (is there a source that says which version of the workloads requires what Xcode?) and set up a global.json to push me back to 7.0.103 for building. This fails even sooner, as it complains that Microsoft.Maui is linked with Microsoft.iOS 16.4, while I am only linking with 16.2. I can’t figure out how to downgrade Maui here either…
The message suggests a workaround, though I have found reason to believe that the workaround is bogus and does nothing. That is, it suggests that I change the linking settings to “Link Framework SDKs only”. Brilliant…except that’s already what it was set to. So no dice here either.
Furthermore, it suggests that I can disable trimming by setting PublishTrimmed
to false. Ok cool…now it complains that iOS must have PublishTrimmed set to true. Now it almost feels like intentional trolling.
Is the only remedy at this point to find out which version of vs mac uses 7.0.1xx, downgrade to that somehow, and remove the 7.0.2xx SDks all together? Or upgrade to macOS 13 so that I have the privilege of using Xcode 14.3 (and it’s terrible new iron fist when it comes to pedantic compiler warnings)?
Exceptions (if any)
- With PublishTrimmed unset
"/Users/jim.borden/Development/couchbase-lite-net-ee-helium/src/Couchbase.Lite.Tests.Maui/Couchbase.Lite.Tests.Maui.csproj" (default target) (1) ->
(_RunILLink target) ->
ILLink : unknown error IL7000: An error occured while executing the custom linker steps. Please review the build log for more information. [/Users/jim.borden/Development/couchbase-lite-net-ee-helium/src/Couchbase.Lite.Tests.Maui/Couchbase.Lite.Tests.Maui.csproj::TargetFramework=net6.0-ios]
ILLINK : error MT0180: This version of Microsoft.iOS requires the iOS 16.4 SDK (shipped with Xcode 14.3). Either upgrade Xcode to get the required header files or set the managed linker behaviour to Link Framework SDKs Only in your project's iOS Build Options > Linker Behavior (to try to avoid the new APIs). [/Users/jim.borden/Development/couchbase-lite-net-ee-helium/src/Couchbase.Lite.Tests.Maui/Couchbase.Lite.Tests.Maui.csproj::TargetFramework=net6.0-ios]
ILLINK : error MT2301: The linker step 'Setup' failed during processing: This version of Microsoft.iOS requires the iOS 16.4 SDK (shipped with Xcode 14.3). Either upgrade Xcode to get the required header files or set the managed linker behaviour to Link Framework SDKs Only in your project's iOS Build Options > Linker Behavior (to try to avoid the new APIs). [/Users/jim.borden/Development/couchbase-lite-net-ee-helium/src/Couchbase.Lite.Tests.Maui/Couchbase.Lite.Tests.Maui.csproj::TargetFramework=net6.0-ios]
"/Users/jim.borden/Development/couchbase-lite-net-ee-helium/src/Couchbase.Lite.Tests.Maui/Couchbase.Lite.Tests.Maui.csproj" (default target) (1) ->
(ILLink target) ->
/usr/local/share/dotnet/sdk/7.0.203/Sdks/Microsoft.NET.ILLink.Tasks/build/Microsoft.NET.ILLink.targets(86,5): error NETSDK1144: Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false. [/Users/jim.borden/Development/couchbase-lite-net-ee-helium/src/Couchbase.Lite.Tests.Maui/Couchbase.Lite.Tests.Maui.csproj::TargetFramework=net6.0-ios]
- Rolled back to workload 16.2.2054 and sdk 7.0.103
CSC : error CS1705: Assembly 'Microsoft.Maui' with identity 'Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'Microsoft.iOS, Version=16.4.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' which has a higher version than referenced assembly 'Microsoft.iOS' with identity 'Microsoft.iOS, Version=16.2.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' [/Users/jim.borden/Development/couchbase-lite-net-ee-helium/src/Couchbase.Lite.Tests.Maui/Couchbase.Lite.Tests.Maui.csproj::TargetFramework=net6.0-ios]
- With PublishTrimmed set to false
"/Users/jim.borden/Development/couchbase-lite-net-ee-helium/src/Couchbase.Lite.Tests.Maui/Couchbase.Lite.Tests.Maui.csproj" (default target) (1) ->
(_ComputePublishTrimmed target) ->
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.47/targets/Xamarin.Shared.Sdk.targets(269,3): error : iOS projects must build with PublishTrimmed=true. Current value: False. [/Users/jim.borden/Development/couchbase-lite-net-ee-helium/src/Couchbase.Lite.Tests.Maui/Couchbase.Lite.Tests.Maui.csproj::TargetFramework=net6.0-ios]
Further technical details
.NET SDK:
Version: 7.0.203
Commit: 5b005c19f5
Runtime Environment:
OS Name: Mac OS X
OS Version: 12.6
OS Platform: Darwin
RID: osx.12-x64
Base Path: /usr/local/share/dotnet/sdk/7.0.203/
Host:
Version: 7.0.5
Architecture: x64
Commit: 8042d61b17
.NET SDKs installed:
6.0.405 [/usr/local/share/dotnet/sdk]
6.0.406 [/usr/local/share/dotnet/sdk]
6.0.407 [/usr/local/share/dotnet/sdk]
6.0.408 [/usr/local/share/dotnet/sdk]
7.0.102 [/usr/local/share/dotnet/sdk]
7.0.103 [/usr/local/share/dotnet/sdk]
7.0.200 [/usr/local/share/dotnet/sdk]
7.0.201 [/usr/local/share/dotnet/sdk]
7.0.202 [/usr/local/share/dotnet/sdk]
7.0.203 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.13 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.14 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.15 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.16 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.31 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.13 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.14 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.15 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.16 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
Not found <-- note this is after I deleted the global.json
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
VS4MAC 17.5.4 on macOS 12.6.3
Issue Analytics
- State:
- Created 3 months ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
First:
.NET 6 is out of support, you should use net7.0-* instead.
Kind of, but it’s all rather complicated unfortunately. A workload is comprised of several other packages, and “this version” refers to the version of those packages.
Can you attach your csproj? Changing the linker setting may or may not work, but it shouldn’t suggest doing that if you’ve changed it.
Yes, this is unfortunate, and we have an issue to fix this for .NET 8 (by not suggesting to set PublishTrimmed to false - that’s a general advice for all types of projects, but does not work for iOS projects in particular).
The easiest by far is to use Xcode 14.3. Note that Apple will eventually force you to upgrade anyways, because the App Store will require you to build using a new(er) version of Xcode, otherwise you won’t be able to publish your app.
If you want to downgrade, you’ll have to do something like this:
dotnet workload update --print-rollback
. Save the results to a file (sayrollback.json
).dotnet workload update --from-rollback-file rollback.json
We’re aware this is a rather cumbersome process, and we’re working on making this better for .NET 8.
I believe @mattleibow can answer that.
@ivanpovazan could you please add the right people to look into this? iOS/XCode/MAUI targeting/versioning problem.