1

I have a web service which supplies me with a generated .resx (XML only) which I then convert to binary a .resources file. I am currently generating an assembly file with that using al.exe. Here are my arguments:

/t:lib /c:{culture} /embed:"{.resource input}" /out:"{.dll output}"

Loading this assembly in via Assembly.LoadFrom(file) works fine, but I believe that my assembly is not properly generated. It has no type, namespace, or methods to invoke and therefor no ResourceManager apparently.

Essentially I am just wondering if it is at all possible to generate, load, and utilize resources that have no class or namespace which my project knows about at compile time. Thanks.

erodewald
  • 1,815
  • 20
  • 45
  • Not answering your concern, too involved for me unfortunately. But if you have a clue about my issue, maybe it's related: [my SO post](http://stackoverflow.com/questions/14929590/resource-localization-use-of-xuid-refering-to-another-assemblys-resource). – Qortex Mar 07 '13 at 22:16
  • I have not yet delved into that rabbit hole, but I gave you an upvote & favorite; it's actually something I am interested in so I hope you figure it out. – erodewald Mar 08 '13 at 01:41

1 Answers1

4

Your assembly is a satellite assembly. From MSDN:

By definition, satellite assemblies can only contain resources. They cannot contain any executable code.

If you want to access the resources of this assembly - similar code should work:

ResourceManager rm = new ResourceManager(
    "ResourceTest.Properties.Resources", 
     Assembly.LoadAssembly(file));
MessageBox.Show(rm.GetString("helloWorldString"));

Also, the article from MSDN: Walkthrough: Loading Resources from a Satellite Assembly shows an alternative way of how to load a resource string from a satellite assembly.

Dzienny
  • 3,295
  • 1
  • 20
  • 30
  • Good call, can't believe I missed that in the docs. I'm still not entirely sure if this will work out for me but I will make some modifications based on your suggestion. – erodewald Mar 08 '13 at 14:29
  • Ended up getting it to work just fine with your method. Marked as the answer. – erodewald Mar 08 '13 at 18:02