Forum Visual Studio


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

MissingManifestResourceException - could not find any resources appropriate for the specified ...

BillFultonBillFulton AUMember ✭✭

In a Xamarin Forms iOS/Android app I've been using a single .resx file for some time. Now, I'm getting 'MissingManifestResourceException', 'Could not find any resources appropriate for the specified culture or the neutral culture'. This seemed to coincide with installing XS 5.91 but can't be sure on that.

Reverting to XS 5.9 and retrieving a backup copy of my app from before the problem started, I found curiously that the app would run but as soon as I made any edit however trivial to my .resx file, the error would return. Experimenting further, I built a minimal app having a .resx file, and it had the same problem. Next, I downloaded the .resx sample app at . It too ran correctly first up. Interestingly, it includes reflection code to check that the resource file is indeed embedded, and output a message showing that it was. However, as soon as I made a trivial edit to its default .resx file, it got the same error when next run.

Getting somewhat desperate now, I (completely) uninstalled Xamarin iOS, Xamarin Android and XS, following the guide at . Then I went back a couple of versions and installed iOS8.9.1, Android 4.20.2 and XS 5.8.3. I re-downloaded the sample .resx app just to be sure, and tried it out. Same result -- it runs first time but gets the error after any trivial edit is made to the default .resx file.

I believe I've checked all the usual things like build action of the .resx being Embedded Resource. Xcode is V6.3. My tests were with the iOS side.

Running out of ideas here, and of course can't progress with my app. Would be so grateful for any suggestions.



  • BillFultonBillFulton AUMember ✭✭

    To be clear, the .resx is in the PCL and the startup project is iOS.

  • BillFultonBillFulton AUMember ✭✭

    My Bugzilla bug report posted here:

  • BillFultonBillFulton AUMember ✭✭

    (Very) temporary workaround:

    1. Replace the .resx file and its code-behind file with older versions from before the problem occurred.
    2. Don't touch the replacement .resx file after that. (And keep a backup copy of it.)
  • mattwardmattward GBMember Xamurai

    I think you are seeing bug 30044 in Xamarin Studio 5.9. In Xamarin Studio 5.8 you should be able to fix the problem by configuring the .NET naming policy, more on this below.

    The problem in Xamarin Studio 5.9 is that it is generating a different resource name in the AppResources.Designer.cs file. The unmodified code on GitHub is:

    System.Resources.ResourceManager temp = new System.Resources.ResourceManager("UsingResxLocalization.Resx.AppResources", typeof(AppResources).GetTypeInfo().Assembly);

    The "UsingResxLocalization.Resx.AppResources" string being passed to the resource manager is the important part.

    I suspect when you edit the .resx file and save it the string is being changed to "UsingResxLocalization.AppResources" which is the problem reported in bug 30044.

    In Xamarin Studio 5.9 you should be able to workaround this by changing the Resource Id in the properties for each .resx file so it is the correct string. Another slightly hacky way is to change the default namespace of the project to be "UsingResxLocalization.Resx". Another workaround would be to move the resource files into the root directory of the project.

    In Xamarin Studio 5.8 I believe you will need to configure the .NET Naming policy in the project options so the correct resource name string is generated. If you check both Associate namespaces with directory names and Use default namespace as root then re-save the .resx file it should generate the correct string in the designer file. By default it generates the resource name without the directory name.

  • BillFultonBillFulton AUMember ✭✭

    Thanks @mattward. Excising ".resx" from the .resx file's ResourceId property fixed my problem.

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    I have the same problem...

  • AhmedAlejoAhmedAlejo USMember ✭✭

    I had the same desperate problem @BillFulton, then i hit this page at 4 AM :smiley:

  • JasonGowthorpeJasonGowthorpe GBMember ✭✭

    I am getting the error just launching an unmodified copy of UseResxLocalization demo on android on the latest version of Xamarin & Xamarin Studio.
    Any suggestions?

  • KimNieblingKimNiebling DKMember ✭✭
    edited October 2015

    My issue was, that I had previously been changing the namespace for my entire solution by first changing the Default Namespace in the project properties and thereafter using ReSharper to adjust the namespaces automatically.

    I personally solved the issue I had by opening ./Resources/AppResources.rex/AppResources.Designer.cs where I found that the namespace hadn't been changed for the ResourceManager automatically.

    I simply changed the ´OLD.NAMESPACE` (see code below) to my new namespace which fixed the issue:

    internal static global::System.Resources.ResourceManager ResourceManager {
                get {
                    if (object.ReferenceEquals(resourceMan, null)) {
                        global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OLD.NAMESPACE.Resources.AppResources", typeof(AppResources).GetTypeInfo().Assembly);
                        resourceMan = temp;
                    return resourceMan;
  • BillFultonBillFulton AUMember ✭✭

    Hmm. This problem re-emerged, seemingly coincident with installing Xamarin 4.

    In my case I solved it by restoring the ".resx" that I had previously excised to get things working in an earlier version - see my comment above dated May 21, 2015. Sounds like the bug has been fully addressed now ...

  • I'm getting a similar error and I've tried all of the above steps
    {System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "MobileGateApp.AppResources.resources" was correctly embedded or linked into assembly "PatrolLiveApp" at compile time, or that all the satellite assemblies required are loadable and fully signed.

    I did rename namespaces all over my solution using resharper , from MobileGateApp to PatrolLiveApp
    The above error would indicate it is still looking for a resource file named MobileGateApp:
    Make sure "MobileGateApp.AppResources.resources" was correctly embedded

    Where is this MobileGateApp.AppResources.resources ?

  • emysa341emysa341 USMember

    Same here, tried all above fixes, still the problem persists.

  • CarlosSilva.6280CarlosSilva.6280 USMember ✭✭

    Same here by error. Changed Resource to public and forgeted to change the custom tool to PublicResXFileCodeGenerator :wink:

  • NickKovalskyNickKovalsky USMember ✭✭✭
    edited May 2017

    Had same problem, was hard to fix, after getting the code from the xamarin forms resx localization article and sample code.. The point was the mismatch between namespaces. I hope that was your case, so we could fix it. When you make all namespaces dependencies match in different places everything will suddenly work :)

    When you create a ResX resource table you gave it a name like YourResXTablename (mine was name just "Res").
    ResX custom tools auto-generate namespace for your brand new resource tables as Yourappnamespace.ResX. It will reside inside YourResXTablename.Designer.cs and must not be changed as the compiler will overwrite it.

    In the Shared project:

    • ILocalize.cs, with the ILocalizeinterface has to have same namespace as the auto-generated for resources (Yourappnamespace.ResX).
    • Translate.cs, the one with XAML translation class TranslateExtension same, set namespace to Yourappnamespace.ResX.
    • Inside you have a line to edit: const string ResourceId = "Yourappnamespace.ResX.YourResXTablename";

    In Android project:

    • Localize.cs with public class Localize : ILocalize Set namespace same as your main android project namespace (Yourappnamespace.Droid or Yourappnamespace.Android)
    • Inside edit the line [assembly: Xamarin.Forms.Dependency(typeof(Yourappnamespace.Droid.Localize))] to match your Android project namespace.

    In iOS etc - proceed like for Android.

    The usage in XAML can be cleaner than proposed in xamarin article:
    Every page include xmlns:resX="clr-namespace:Yourappnamespace.ResX;assembly=Yourappnamespace" and the string goes as Text="{resX:Translate StringName}".
    Or.. dunno how but Text="{x:Static resX:Res.StringName}" translates fine too..

  • KerMatKerMat Member

    @NickKovalsky thanks a lot, your post helped me out of my problems!
    In my Xamarin version the autogenerated namespace of YourResXTablename.Designer.cs was no longer Yourappnamespace.ResX. My version generated only Yourappnamespace.
    So had to leave out the ".ResX".
    At the end my problem was that I also got the code from the xamarin forms resx localization article - and I had to change the line you mentioned above to:
    const string ResourceId = "Yourappnamespace.YourResXTablename";**

  • MichelangeloFrancoMichelangeloFranco ITUniversity ✭✭✭

    Try also looking in your Pro file. I've had same problem and in my Proj file remain old name

Sign In or Register to comment.