Resgen al.exe generated resources do not work within .net library

Posted by Raj G on Stack Overflow See other posts from Stack Overflow or by Raj G
Published on 2008-12-23T08:29:39Z Indexed on 2010/04/04 23:43 UTC
Read the original article Hit count: 664

Hi, I am currently working on a library in .Net and I planned to make the strings that are used within the library into culture specific resource files. I made Resources.resx, Resources.en-US.resx and Resources.ja-JP.resx file. I also deleted the Resources.designer.cs file autogenerated by visual studio 2008. I am loading Resources through my custom ResourceManager object [using GetString method]. The problem that I am facing is that when I compile the library within visual studio and set the culture from the calling application, everything is working fine.

But if I manually go to the directory and change a string for a culture and regenerate the satellite assembly with resgen and al.exe, the string displayed, falls back to the invariant culture. I have attached the ildasm view of both the dlls

  1. en-US generated from within visual studio

    
    //Metadata version: v2.0.50727
    .assembly extern mscorlib
    {
      .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
      .hash = (71 05 4D 54 C4 8D C2 90 7D 8B CF 57 2E B5 98 22   // q.MT....}..W..."
               F5 5B 2E 06 )                                     // .[..
      .ver 2:0:0:0
    }
    .assembly EmailEngine.resources
    {
      .custom instance void [mscorlib]System.Reflection.AssemblyTitleAttribute::.ctor(string) = ( 01 00 0B 45 6D 61 69 6C 45 6E 67 69 6E 65 00 00 ) // ...EmailEngine..
      .custom instance void [mscorlib]System.Reflection.AssemblyDescriptionAttribute::.ctor(string) = ( 01 00 FF 00 00 ) 
      .custom instance void [mscorlib]System.Reflection.AssemblyCompanyAttribute::.ctor(string) = ( 01 00 FF 00 00 ) 
      .custom instance void [mscorlib]System.Reflection.AssemblyProductAttribute::.ctor(string) = ( 01 00 0B 45 6D 61 69 6C 45 6E 67 69 6E 65 00 00 ) // ...EmailEngine..
      .custom instance void [mscorlib]System.Reflection.AssemblyCopyrightAttribute::.ctor(string) = ( 01 00 12 43 6F 70 79 72 69 67 68 74 20 C2 A9 20   // ...Copyright .. 
                                                                                                      20 32 30 30 38 00 00 )                            //  2008..
      .custom instance void [mscorlib]System.Reflection.AssemblyTrademarkAttribute::.ctor(string) = ( 01 00 FF 00 00 ) 
      .custom instance void [mscorlib]System.Reflection.AssemblyFileVersionAttribute::.ctor(string) = ( 01 00 07 31 2E 30 2E 30 2E 30 00 00 )             // ...1.0.0.0..
      .hash algorithm 0x00008004
      .ver 1:0:0:0
      .locale = (65 00 6E 00 2D 00 55 00 53 00 00 00 )             // e.n.-.U.S...
    }
    .mresource public 'EmailEngine.Properties.Resources.en-US.resources'
    {
      // Offset: 0x00000000 Length: 0x00000111
    }
    .module EmailEngine.resources.dll
    // MVID: {D030D620-4E59-46F4-94F4-5EA0F9554E67}
    .imagebase 0x00400000
    .file alignment 0x00000200
    .stackreserve 0x00100000
    .subsystem 0x0003       // WINDOWS_CUI
    .corflags 0x00000001    //  ILONLY
    // Image base: 0x008B0000

  1. ja-JP generated by me using resgen and al.exe
    
    // Metadata version: v2.0.50727
    .assembly EmailEngine.resources
    {
    .hash algorithm 0x00008004
    .ver 0:0:0:0
    .locale = (6A 00 61 00 00 00 )                               // j.a...
    }
    .mresource public 'EmailEngine.Properties.Resources.ja-JP.resources'
    {
    // Offset: 0x00000000 Length: 0x0000012F
    }
    .module EmailEngine.resources.dll
    // MVID: {0F470BCD-C36D-4B9F-A8ED-205A0E5A9F6F}
    .imagebase 0x00400000
    .file alignment 0x00000200
    .stackreserve 0x00100000
    .subsystem 0x0003       // WINDOWS_CUI
    .corflags 0x00000001    //  ILONLY
    // Image base: 0x007F0000
    

Can anyone help me as to why these two files are different and what is going on here? Why would the same Japanese resource file work when generated from within visual studio and not when generated using tools.

TIA Raj

© Stack Overflow or respective owner

Related posts about satellite-assembly

Related posts about globalization