I've created a .Net 6.0 project that uses resx files for localization. In a Properties folder a Resources.resx file was added (Build action: EmbeddedResource CustomTool: ResxFileCodeGenerator) I was able to publish this to arm-64. Here is the pubxml file:
<Project>
<PropertyGroup>
<Configuration>Debug</Configuration>
<Platform>Any CPU</Platform>
<PublishDir>bin\\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net6.0</TargetFramework>
<RuntimeIdentifier>linux-arm64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishSingleFile>false</PublishSingleFile>
<PublishTrimmed>false</PublishTrimmed>
</PropertyGroup>
</Project>
Then I add a Resources.nl.resx file into the properties folder (Build action: EmbeddedResource) When I try to publish now it fails saying that 'arm64' is not a valid setting for option 'platform' These are the last lines from the output:
2>C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\al.exe /culture:nl /out:obj\Debug\net6.0\linux-arm64\nl\LocalizationResx.resources.dll /platform:arm64 /template:obj\Debug\net6.0\linux-arm64\LocalizationResx.dll /embed:obj\Debug\net6.0\linux-arm64\LocalizationResx.Properties.Resources.nl.resources
2>'arm64' is not a valid setting for option 'platform'
The publish works if I set linux-arm as target runtime.
Is this a bug in visual studio? (2022 v17.1.0)
Is there a way to make the publish succesfull?
Is there a better way to do localization for .net 6.0 projects that need to run on an arm64?
What fixed the issue for me was opening the csproj file of the executable project and add <GenerateSatelliteAssembliesForCore>true</GenerateSatelliteAssembliesForCore>
to the PropertyGroup that contains the targetFramework.
The csProj file of the dummy project looks like this now:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateSatelliteAssembliesForCore>true</GenerateSatelliteAssembliesForCore>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.nl.resx">
<Generator></Generator>
</EmbeddedResource>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>
The publishing to linux-arm64 is working now