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

Adding resx file for additional language gives an error while trying to build iOS project #6076

Closed
trevortirrell opened this issue Apr 13, 2022 · 27 comments
Labels
area-single-project Splash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, Resizetizer platform/iOS 🍎 t/bug Something isn't working
Milestone

Comments

@trevortirrell
Copy link

trevortirrell commented Apr 13, 2022

Description

When I add a second language resource file (i.e. AppResources.es.resx) I can no longer build the iOS project. If I remove it from the project then it builds and deploys just fine.

Steps to Reproduce

  1. Create a File > New .NET MAUI App
  2. Add a resx Resource file (i.e. AppResources.resx)
  3. Add a second resx Resource file (i.e. AppResources.es.resx)
  4. Try to build iOS project.

Version with bug

Release Candidate 1 (current)

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 15

Did you find any workaround?

Remove all resx files other than the default from the project

Relevant log output

This is the error:
ALINK : error AL1012: 'arm64' is not a valid setting for option 'platform'
@trevortirrell trevortirrell added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels Apr 13, 2022
@SailDev
Copy link

SailDev commented Apr 13, 2022

This "self explaining" error message did cost me quite some time.
Add the following line to the .csproj file:

<GenerateSatelliteAssembliesForCore>true</GenerateSatelliteAssembliesForCore>

@trevortirrell
Copy link
Author

This "self explaining" error message did cost me quite some time. Add the following line to the .csproj file:

<GenerateSatelliteAssembliesForCore>true</GenerateSatelliteAssembliesForCore>

After adding that I get the following error:

ILStrip failed

@SailDev
Copy link

SailDev commented Apr 13, 2022

Same behaviour for Debug and Release build?

@Eilon Eilon added area-single-project Splash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, Resizetizer platform/iOS 🍎 labels Apr 13, 2022
@jfversluis jfversluis removed the s/needs-verification Indicates that this issue needs initial verification before further triage will happen label Apr 14, 2022
@jfversluis
Copy link
Member

Where exactly are you adding the resx file? I haven't seen this behavior in my .NET MAUI Blazor app.

Could you maybe go through the reproduction steps to create a sample project and put that on GitHub for us to look at? That would be a great help! :)

@SailDev
Copy link

SailDev commented Apr 14, 2022

Maybe i can step in and add some infos.

In the app, i am working on, i use a large domain model which currently consists of 50 projects and fast growing.

Some of them do have their own embedded translations in addition to the translations in the client (Maui) app.

Example project structure:

Domain.Services (.NET 6.0 class library)
  ...
	TheService (App folder)
   		TheService.cs
   		TheServiceTranslations.en.resx
   		TheServiceTranslations.resx
  ...
  

Having had the same error message , after quite some research and time, i found and added

<GenerateSatelliteAssembliesForCore>true</GenerateSatelliteAssembliesForCore>

to the Maui App project file. It fixed this specific problem.

Is this scenario totally unusal?

I wish, there would be a more complex (or realistic?) app public available (i.e. via Testflight), for integration testing, before each new Maui release.

Maybe with topics like (from my own experience):

  • App-Shell with deep hierarchies
  • Local Sqlite via EF
  • Pages with more complex vertical scrolling scenarios (i.e. CollectionView with rich ContentViews in Header or Footer.
  • Scrollable (editor) pages with nested picker / lookup scenarios including passing data back.
  • Inline data entry in scrollable pages while changing device orientation and/or device keyboard types (normal, emoji,...)
  • ....

I, and i think other people also, would be more than happy, to test each version and give feedback.

@trevortirrell
Copy link
Author

trevortirrell commented Apr 14, 2022

I was able to get it to build by adding <GenerateSatelliteAssembliesForCore>true</GenerateSatelliteAssembliesForCore> to the csproj. And then I had to use the command line from @jfversluis YouTube video here: https://www.youtube.com/watch?v=kpZi5xAvpZA&t=1460s with the /p:EnableAssemblyILStripping=false flag. I tried adding it to the csproj, but didn't work. I wasn't able to build from VS unless I remove any additional language resx files.

Also, localization seems to be working on Android, but not iOS. Will need to do further testing to verify.

Here's the repo:
https://github.com/trevortirrell/MauiApp2

@Redth Redth added this to the 6.0.300-servicing milestone Apr 20, 2022
@v-longmin v-longmin added s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage labels Apr 26, 2022
@v-longmin
Copy link

Verified not repro on iOS 15.4. Not repro project:
MauiApp2-master.zip

@GiselleTGomes
Copy link

hey guys ! this error happen when you put your *.resx file diferent folder from Resources

@Rabosa616
Copy link

Rabosa616 commented Jun 3, 2022

I have my resx files inside of the resources
image
and I get the same error. Also I've tried to create a folder Strings inside the Resources and I have the same issue
As soon as I remove the other language files all works fine.

Microsoft Visual Studio Enterprise 2022 (64-bit) - Preview 17.3.0 Preview 1.1
Minimum Target iOS Framework
I've tried all from 10 to 15.4

@RobertoGFilho
Copy link

if i remove *.resx files this issue will dissapear

@Rabosa616
Copy link

Any news @Redth @jfversluis?

@jfversluis jfversluis modified the milestones: 6.0-servicing, Backlog Aug 17, 2022
@ghost
Copy link

ghost commented Aug 17, 2022

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@Rabosa616

This comment was marked as off-topic.

@jfversluis
Copy link
Member

Hey everyone! I just had a quick look at this and with the latest versions I don't seem to be able to reproduce the build error anymore. It all builds find for me (also using the reproduction linked in this issue), however, unfortunately, the localization doesn't seem to work on iOS. I think that is due to a (already fixed) bug in the runtime, I'm asking around about that now.

Can someone confirm that the build error is gone?

@jfversluis jfversluis added the s/needs-info Issue needs more info from the author label Aug 17, 2022
@ghost
Copy link

ghost commented Aug 17, 2022

Hi @trevortirrell. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@jfversluis
Copy link
Member

As for the localization not working, see my write-up here: #7362 (comment)

@Rabosa616
Copy link

Hi @jfversluis Thanks so much for the quick response!
I've created a repo to reproduce the error: https://github.com/Rabosa616/MauiMultilanguageApp

The AL1012 is gone using the latest version of MAUI and by adding this into the csproj file

<GenerateSatelliteAssembliesForCore>true</GenerateSatelliteAssembliesForCore>

Now as you mention there is a issue with the localization not working

Android

Android

Windows

Windows

iPhone (Not working)

iPhone

you suggest to have the global.json to a lower version, this will make not compiling again, right?

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-info Issue needs more info from the author labels Aug 17, 2022
@jfversluis
Copy link
Member

With the global.json on a lower version it both compiled and the localization worked for me :)

I did not need the <GenerateSatelliteAssembliesForCore>true</GenerateSatelliteAssembliesForCore> as well. Let me know how that goes for you!

@jfversluis jfversluis added s/needs-info Issue needs more info from the author and removed s/needs-attention Issue has more information and needs another look labels Aug 17, 2022
@ghost
Copy link

ghost commented Aug 17, 2022

Hi @trevortirrell. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@Rabosa616
Copy link

Hi @jfversluis
I´ve installed the .net 6.0.303 sdks
image

image

then I´ve followed your instructions:

  1. Run dotnet --list-sdks
  2. Find a version that starts with 3, the version needs to be at least 6.0.303 (which is the highest at the time of writing)
  3. In your project root run dotnet new --globaljson --sdk-version=6.0.303
  4. Run dotnet workload update NOTE: this will update your entire MAUI workload for all projects
  5. Restart Visual Studio to be sure it uses 6.0.303 and aggressively rebuild your project

I still was not able to build the app without the

<GenerateSatelliteAssembliesForCore>true</GenerateSatelliteAssembliesForCore>

Still the issue with the language:

image

I´m using the repo: https://github.com/Rabosa616/MauiMultilanguageApp

To clean up my local repo I use this ps:

Get-ChildItem .\ -include bin,obj -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse }

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-info Issue needs more info from the author labels Aug 18, 2022
@jfversluis
Copy link
Member

@Rabosa616 your global.json is set to 6.0.300 not 6.0.303

@VladislavAntonyuk
Copy link
Contributor

You can read how to localize .NET MAUI application here: https://vladislavantonyuk.azurewebsites.net/articles/Localize-.NET-MAUI-application

@Rabosa616
Copy link

Rabosa616 commented Aug 29, 2022

First of all thanks @jfversluis for your correction on my test repo.
If I do not set the true I get the error of AL1012 when I press F5 without rebuilding the project.

Inspecting the output at the C:\Users\vaos\AppData\Local\Temp\Xamarin\HotRestart\Signing\MauiApp1.app\out\Payload\MauiApp1.app\MauiApp1.content I do see MauiApp1.dll, opening it with the Jetbrains dotPeek I can only see the english resource but not the spanish one

image

If I create a Xamarin app with multilingual support in the same temp folder I see the language folders:
image

Inside of the ES folder I can see:
image

The difference is that on Xamarin I can see the Language folders with the resource dll´s and on maui there is no language folder generated. May be there is something on my machine´s configuration?

@Rabosa616
Copy link

You can read how to localize .NET MAUI application here: https://vladislavantonyuk.azurewebsites.net/articles/Localize-.NET-MAUI-application

Thanks for your article, I´ve checked your source code in github and I´ve notice that your are creating a Window application. Using Maui on Windows and Android Works fine but when you build the app for iOS it´s not working.

@jfversluis jfversluis removed s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed s/needs-attention Issue has more information and needs another look labels Aug 29, 2022
@VladislavAntonyuk
Copy link
Contributor

You can read how to localize .NET MAUI application here: https://vladislavantonyuk.azurewebsites.net/articles/Localize-.NET-MAUI-application

Thanks for your article, I´ve checked your source code in github and I´ve notice that your are creating a Window application. Using Maui on Windows and Android Works fine but when you build the app for iOS it´s not working.

it works on iOS

Screen.Recording.2022-08-30.at.19.21.47.mov

@Rabosa616
Copy link

Rabosa616 commented Aug 31, 2022

After reviewing the artifacts that are produced by my repo https://github.com/Rabosa616/MauiMultilanguageApp/actions/runs/2887616872 , I do see that the iOS one has the spanish resources.
image
image
That artifact is produced by a Mac Agent.

When I try to compile on my windows developer machine does not produce it. I´m wondering if is a machine configuration or a bug in Visual Studio 2022 on windows machine not connected to any mac
image

@VladislavAntonyuk are you compiling with a Visual studio on a Windows machine paired with a Mac or without?
I´ve checked your article and your repo

@jfversluis
Copy link
Member

Duplicate of #5595

@jfversluis jfversluis marked this as a duplicate of #5595 Aug 31, 2022
@jfversluis jfversluis closed this as not planned Won't fix, can't repro, duplicate, stale Aug 31, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Sep 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-single-project Splash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, Resizetizer platform/iOS 🍎 t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants