Search code examples
.netmauiresx

How to solve the problem about loading resx resources dll on iOS (.NET MAUI)


Background:

I want to do the localizations feature on my .NET MAUI app. I follow this video (https://youtu.be/cf4sXULR7os) to do that.

enter image description here

In the iOS simulator, the localization feature and loading the resources.dll is running preferably. (like the following)

enter image description here

But once I deploy it to my physical iPhone device, the feature does not work and outputs the following message when I change the language.

Language is Traditional Chinese 2023-07-12 01:10:01.410 Xamarin.PreBuilt.iOS[645:115119] Could not resolve assembly TestApp.resources, Version=1.0.0.0, Culture=zh-TW, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/1F073A32-D7F4-4009-81C6-D12526416BC2/Documents/TestApp.content/TestApp.resources.dll' or one of its dependencies. 2023-07-12 01:10:01.411 Xamarin.PreBuilt.iOS[645:115119] Could not resolve assembly TestApp.resources, Version=1.0.0.0, Culture=zh-Hant, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/1F073A32-D7F4-4009-81C6-D12526416BC2/Documents/TestApp.content/TestApp.resources.dll' or one of its dependencies. 2023-07-12 01:10:01.413 Xamarin.PreBuilt.iOS[645:115119] Could not resolve assembly TestApp.resources, Version=1.0.0.0, Culture=zh, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/1F073A32-D7F4-4009-81C6-D12526416BC2/Documents/TestApp.content/TestApp.resources.dll' or one of its dependencies. 2023-07-12 01:10:01.415 Xamarin.PreBuilt.iOS[645:115119] Could not resolve assembly TestApp.resources, Version=1.0.0.0, Culture=zh-TW, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/1F073A32-D7F4-4009-81C6-D12526416BC2/Documents/TestApp.content/TestApp.resources.dll' or one of its dependencies. 2023-07-12 01:10:01.416 Xamarin.PreBuilt.iOS[645:115119] Could not resolve assembly TestApp.resources, Version=1.0.0.0, Culture=zh-Hant, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/1F073A32-D7F4-4009-81C6-D12526416BC2/Documents/TestApp.content/TestApp.resources.dll' or one of its dependencies. 2023-07-12 01:10:01.417 Xamarin.PreBuilt.iOS[645:115119] Could not resolve assembly TestApp.resources, Version=1.0.0.0, Culture=zh, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/1F073A32-D7F4-4009-81C6-D12526416BC2/Documents/TestApp.content/TestApp.resources.dll' or one of its dependencies. Language is English 2023-07-12 01:10:02.041 Xamarin.PreBuilt.iOS[645:115119] Could not resolve assembly TestApp.resources, Version=1.0.0.0, Culture=en-US, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/1F073A32-D7F4-4009-81C6-D12526416BC2/Documents/TestApp.content/TestApp.resources.dll' or one of its dependencies. 2023-07-12 01:10:02.042 Xamarin.PreBuilt.iOS[645:115119] Could not resolve assembly TestApp.resources, Version=1.0.0.0, Culture=en, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/1F073A32-D7F4-4009-81C6-D12526416BC2/Documents/TestApp.content/TestApp.resources.dll' or one of its dependencies. 2023-07-12 01:10:02.044 Xamarin.PreBuilt.iOS[645:115119] Could not resolve assembly TestApp.resources, Version=1.0.0.0, Culture=en-US, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/1F073A32-D7F4-4009-81C6-D12526416BC2/Documents/TestApp.content/TestApp.resources.dll' or one of its dependencies. 2023-07-12 01:10:02.046 Xamarin.PreBuilt.iOS[645:115119] Could not resolve assembly TestApp.resources, Version=1.0.0.0, Culture=en, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/1F073A32-D7F4-4009-81C6-D12526416BC2/Documents/TestApp.content/TestApp.resources.dll' or one of its dependencies.

So, I checked the app folder on the "Files" app and confirmed there is no ".resources.dll" in it.

enter image description here enter image description here

Why are there no ".resources.dll" output and deployed when installed, and how can I solve them? Because as I know, language resources (resx->dll) should place in a sub-folder like this:

enter image description here


Solution

  • Update .NET 8.0 will fix the issue.