开发者

Add satellite assembly in a pre-compiled deployed website

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 f开发者_Go百科ine.

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


(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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜