question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AL1012: 'arm64' is not a valid setting for option 'platform'

See original GitHub issue

Describe 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>

Ref: https://github.com/dotnet/sdk/blob/00100960bf06cb595daba647673cd0329be896f4/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets#L41

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:open
  • Created a year ago
  • Reactions:3
  • Comments:14 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
IgorKravchenko10commented, Oct 31, 2022

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.

1reaction
marcpopMSFTcommented, Oct 12, 2022

@dsplaisted let’s chat when you’re back to understand more about this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AL1012: 'arm64' is not a valid setting for option 'platform' ...
AL1012 : 'arm64' is not a valid setting for option 'platform' thrown when localized resources are available and debugging on remote iOS device...
Read more >
Publish to arm64 not working when cultured resx file added
1 Answer. What fixed the issue for me was opening the csproj file of the executable project and add <GenerateSatelliteAssembliesForCore>true</ ...
Read more >
invalid Runtime identifier ios-arm64 in publishing ios app ...
HI Unable to publish IOS app in .Net MAUI Blazor App Tried Both way , mentioned runtime identifier in .csproj file as well...
Read more >
TN3117: Resolving architecture build errors on Apple silicon
warning: None of the architectures in ARCHS (arm64) are valid. Consider setting ARCHS to $(ARCHS_STANDARD) or updating it to include at least one...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found