Add satellite assembly in a pre-compiled deployed website
Asked Answered
E

2

18

In order to make use of GetGlobalResourceObject() in Visual Studio 2008 I have to copy a .resx file into the folder App_GlobalResources of Visual Studio. After the application is precompiled, the resource files are being compiled into the corresponding satellite assemblies and deployed under the \bin\ folder by culture names. This all works fine.

However, I'm unable to add new satellite assemblies after the application has been precompiled. What I've done was:

  1. Created a satellite assembly:

    resgen resources.applicationresources.es-ES.resx resources.applicationresources.es-ES.resources al /t:lib /culture:es-ES /embed:resources.applicationresources.es-ES.resources /out:App_GlobalResources.resources.dll

  2. Created folder \bin\es-ES\ and deployed the .dll file there.

Unfortunately, the newly added satellite assembly is not being recognized by the GetGlobalResourceObject(), which falls back to the default (English) resource. There seems to be nothing wrong with the resource file because if I copy the same .resx file into App_GlobalResources and then compile the application, everything works just fine.

What am I missing? BTW my project type is website and not web application project.

Elisa answered 17/11, 2009 at 6:52 Comment(4)
Did you ever find a solution to this problem?Greaves
Currently very stuck with this myself.Gilbertina
The problem in our case was, while generating the satellite assemblies through resgen, the namespace path was not correct. We dubugged the generated satellite dll using ILDASM, so we corrected it and deployed back the assembly.Elisa
Add as an answer and mark as suchCorsair
P
0

(From Comment by @ksa)

One thing that can go wrong is an incorrect namespace path in the DLL produced by resgen, you can use ILDASM or Reflector to compare the namespaces in the working DLLs and the generated not working DLLS. You can then change your resgen command line to generate with the correct namespace.

Portsalut answered 17/11, 2009 at 6:53 Comment(1)
Community wiki as I am just rephrasing what the OP said fixed it for them in a comment, to move this question off the unanswered list.Portsalut
K
0

Try hooking up to the AssemblyResolve event in AppDomain.CurrentDomain and see if it's actualy looking for the assembly. If it does look for it, all you need to do is keep a list of dynamically loaded assemblies and their paths.

One note about AssemblyResolve, if you don't have the assembly, return null. That's the default behavior.

Kibler answered 13/8, 2011 at 22:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.