Hi Steve,
Thanks for your suggestion, but the problem is bit different.
Actually problem is, the application using the merged dll is not able to find the resources inside merged DLLs.
Let me explain the problem with the help of a demo project.
Here is what I have done in demo project
Inside one solution, I have 4 projects.
Project 1: DLL with name A.B.C.Resources1.dll and namespace A.B.C Project 2: DLL with name A.B.C.Resources2.dll and namespace A.B.C Project 3: DLL with name A.B.D.Resources3.dll and namespace A.B.D Project 4: EXE with name X.Y.Z.ResourcesTest.exe and namespace X.Y.Z . This project has the above three projects added as references.
Each of the first three projects contains : A. Image resource (The resources are added the way you told). B. One form and one button added to it.
I am simply setting the image for the button inside constructor of each project, as :
Button_Name.Image = Properties.Resources.Image_Name;
The fourth project has three buttons, each for one DLL and I am calling appropriate constructor on button click event.
Now, if i use three DLLs separately : everything works fine.
If I merge three dlls with command :
ILMerge /log:A.B.C.Resources.log /t:library /copyattrs /allowdup /out:A.B.C.Resources.dll A.B.C.Resources1.dll A.B.C.Resources2.dll A.B.D.Resources3.dll
and
use the merged DLL in the 4th project : The image for button of the 2nd DLL is not visible (Resources not found).
Observations and Findings :
1. After merging, the Resource class is getting renamed by the ILMerge for the 2nd DLL. This happens because the namespace of the first and second DLL is the same.
Ex : I saw the merged DLL inside Reflector, It shows, inside namespace A.B.C.Properties, Class Resources for the A.B.C.Resources1.dll DLL is as it is : Resources Class Resources for the A.B.C.Resources2.dll DLL is renamed to A.B.C.Resources23043.Resources
2. For the 3rd DLL everything works fine, as it has different namespace.
3. If I change the namespace for the 3rd DLL to A.B.C and merge the DLLs, the image for buttons of the 2nd as well as 3rd DLLs are missing.
4. If I use the different namespace for each DLL and merge them and use, everything works fine.
5. So, basically I think this is due to renaming of the Resource class in the A.B.C.Properties namespace.
Is there any way to solve this, without changing the namespaces?? Because I want all the dlls to have the same namespace.
Is there any way to stop renaming by ILMerge?
Regards Abhishek |