Windows Develop Bookmark and Share   
 index > Windows Forms Designer > resources embedded into satellite assemblies
 

resources embedded into satellite assemblies

Hi all,

I would like to embed some strings (SQL queries) into satellite assemblies. The reason for this is that the SQL queries might change but I don't want to recompile the entire application. So instead of creating a resx file and setting it's Build Action to "Embedded Resource" and adding the strings there I would like to place them in a satellite assembly (not compile them directly into the same dll that contains the code). This way all I need to do when a SQL query changes is replace this satellite assembly.
Is it possible to have a satellite assembly with the culture neutral? I cannot set it to a different culture because that is misleading. However, I can't get it to work anyway.

My resources (called sTest1 and sTest2) are located in a resx file called "Strings.resx"

In order to generate the satellite assembly i first compile Strings.resx to Strings.resources using resgen.exe. After this I link it into dll <same_Name_as_dll_with_code>.resources.dll:

al.exe /target:lib /culture:neutral /keyfile:<key> /out:<same_Name_as_dll_with_code>.resources.dll /version:1.0.0.0 /embed: Strings.resources

The code that should read the satellite assembly resources is as follows (called inside the dll that uses the SQL queries):

System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
System.Resources.ResourceManager satAssyReader = new System.Resources.ResourceManager("Strings", assembly);

string sTest1 = satAssyReader.GetString("test1");
string sTest2 = satAssyReader.GetString("test2");

After executing the program I get a good old MissingManifestResourceException. So my question: Is what I want to do possible at all? I'm not sure if satellite assemblies are designed for localization only. But I don't want to compile the resources into the dll with the code.

Thanks

ACKH
ACKH  Wednesday, June 06, 2007 2:49 PM
Alright, I have solved the problem. Using the following code works to load resources from the satellite assembly:

System.Resources.ResourceManager resMgr = new System.Resources.ResourceManager("resxFileName", Assembly.LoadFrom("satAssyName"));

string sTest1 = resMgr.GetString("test1");
ACKH  Wednesday, June 13, 2007 11:02 AM
Alright, I have solved the problem. Using the following code works to load resources from the satellite assembly:

System.Resources.ResourceManager resMgr = new System.Resources.ResourceManager("resxFileName", Assembly.LoadFrom("satAssyName"));

string sTest1 = resMgr.GetString("test1");
ACKH  Wednesday, June 13, 2007 11:02 AM

You can use google to search for other answers

Custom Search

More Threads

• Autoscroll issues in tabControl
• Failure to load designer due to VS2005B2 fault
• Access folder
• Cannot inherit form from inherited form
• Controls are not moving after dropped on the Designer
• How to SET the client rectangle of a windows Form?
• Lost Resource File Data
• Relating Combos on Windows Forms
• What is the name of the active tab of a TabControl?
• hot to turn on ShowFocusCues