AL1012: 'arm64' is not a valid setting for option 'platform'
See original GitHub issueDescribe the bug
When building a project:
- Using Visual Studio
- It has localized resources
- It targets an arm64 platform
This error happens:
AL1012: ‘arm64’ is not a valid setting for option ‘platform’
To Reproduce
https://github.com/ewerspej/dotnet-maui-bug-repro-ios-arm64
This comes from: https://github.com/xamarin/xamarin-macios/issues/16193
This is an iOS project, and it might be easier to create a sample project using this stackoverflow post with the same problem: https://stackoverflow.com/questions/71378075/publish-to-arm64-not-working-when-cultured-resx-file-added
Exceptions (if any)
AL1012: ‘arm64’ is not a valid setting for option ‘platform’
Further technical details
A binlog is available here: https://github.com/ewerspej/dotnet-maui-bug-repro-ios-arm64/blob/main/bug-ios-arm64/bug-ios-arm64_Debug_AnyCPU_net7.0-ios_Build_2022-10-10T09_34_03.0519455%2B02_00.zip
Version: .NET 7.0.100-rc.1.22431.12 (according to https://github.com/xamarin/xamarin-macios/issues/16193).
Analysis
(copied from https://github.com/xamarin/xamarin-macios/issues/16193#issuecomment-1273296180)
I think I know what’s going on.
When building using either VSMac or the command line (either from Windows or Mac), the MSBuildRuntimeType
property is set to Core
.
as a result, the default value for GenerateSatelliteAssembliesForCore
is true
:
<GenerateSatelliteAssembliesForCore Condition=" '$(GenerateSatelliteAssembliesForCore)' == '' and '$(MSBuildRuntimeType)' == 'Core' ">true</GenerateSatelliteAssembliesForCore>
Looks like this logic comes from here:
https://github.com/dotnet/sdk/commit/2506af1b3b24e53ac03bde81dbdb3f2bbead5d28
However, when building from inside Visual Studio (for Windows), the MSBuildRuntimeType
property is set to Full
, and thus GenerateSatelliteAssembliesForCore
is not set to true
, and we end up executing al.exe to generate satellite assemblies, which is wrong.
It seems to me that the problem is the logic to determine whether al.exe should be used or not, it shouldn’t depend on where MSBuild is executing, but instead what kind of project is being built.
Issue Analytics
- State:
- Created a year ago
- Reactions:3
- Comments:14 (13 by maintainers)
Top GitHub Comments
I am trying to build my project and get this error too in Visual Studio 17.4.0 Preview 5.0 Here is the sample. I just added Translator.resx, Translator.uk.resx, Translator.ru.resx to project and now unable to compile in release mode. MauiApp1.zip
All works after adding
<GenerateSatelliteAssembliesForCore>true</GenerateSatelliteAssembliesForCore>
to project file.@dsplaisted let’s chat when you’re back to understand more about this.