none
Loading assemblies from merged dll file. RRS feed

  • Question

  • Hello,

     I am implementing a scripting language (I chose IronRuby) in my application. IronRuby binaries comes with 6 DLL files, which I must add into reference section of my program.

    Anyway, I used ILMerge to merge all these 6 DLL files into one file (ironR.dll), which successes.

    C:\ILMerge>ILMerge.exe /log:log /out:ironR.dll IronRuby.dll IronRuby.Libraries.dll IronRuby.Libraries.Yaml.dll Microsoft.Dynamic.dll Microsoft.Scripting.dll  Microsoft.Scripting.Metadata.dll /targetplatform:v4

    I have checked if merging process was successfully, and I could see all merged DLLs in objects viewer successfully.

    Anyway, I am having an error:

    Failed to load language 'IronRuby': Could not load file or assembly 'IronRuby.Libraries, Version=1.1.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

    Code which I want to run:

        class Foo
        {
            public Foo() {  }
    
            public void Say(string testToSay)
            {
                Console.WriteLine("Foo said: ", testToSay);
            }
        }
    
        class Program
        {
            static void Main(string[] args)
            {
                var engine = Ruby.CreateEngine();
                engine.Runtime.Globals.SetVariable("fObject", new Foo());
                engine.Execute("fObject.Say");
                Console.ReadLine();
            }
        }

    From my common sense, I think I must each assembly from merged DLL manually. I am not sure if it is a solution - if yes, how can I do it?

    Best regards,

    szulak

    • Moved by Bob Shen Thursday, March 21, 2013 7:59 AM
    Wednesday, March 20, 2013 9:58 AM

Answers

  • Hi Aszulak,

    Welcome to the MSDN Forum.

    Thank you for providing the reference file.

    From the fuslogvw logs, it trys to load

    Calling assembly : iRuby, Version=1.1.3.0, Culture=neutral, PublicKeyToken=null.

    But the iRuby assembly is strong named, it has PublicToken. When you merge them, you didn't provide such snk file, so the file iRuby is not strong named. So CLR failed to load assembly. 

    You can verify this with several simply custom libraries.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, April 2, 2013 5:13 PM
    Moderator

All replies

  • HI Szulak,

    Welcome to the MSDN Forum.

    Please try this tool to find more about the exception: fuslogvw.exe  http://msdn.microsoft.com/en-us/library/e74a18c4(v=vs.110).aspx 

    I didn't reproduce this scenario on my side, but just two assemblies, not 6.

    If you don't get any update from the log, please post it here, we will check it.

    Thank you.


    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, March 25, 2013 12:35 PM
    Moderator
  • Hello Mike,

     I uploaded a merged dll file on my skydrive, here: http://sdrv.ms/ZqlQbP

    Could you take a look what might be wrong? I am going to check it in Fuslogvw.

    Regards,

    aszulak

    Wednesday, March 27, 2013 9:49 PM
  • Hi Aszulak,

    Welcome to the MSDN Forum.

    Thank you for providing the reference file.

    From the fuslogvw logs, it trys to load

    Calling assembly : iRuby, Version=1.1.3.0, Culture=neutral, PublicKeyToken=null.

    But the iRuby assembly is strong named, it has PublicToken. When you merge them, you didn't provide such snk file, so the file iRuby is not strong named. So CLR failed to load assembly. 

    You can verify this with several simply custom libraries.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, April 2, 2013 5:13 PM
    Moderator