none
Loading a DLL (in my AddIn) via reflection fails - can't find the assembly I'm calling from RRS feed

Answers

All replies

  • Hi,

     cli.System.Reflection.Assembly assm;
        int indexSemi = outputBuilder.indexOf(';');
        if (indexSemi != -1) {
            String dllFilename = outputBuilder.substring (0, indexSemi);
            outputBuilder = outputBuilder.substring(indexSemi + 1);
            assm = cli.System.Reflection.Assembly.LoadFile(dllFilename);
        }
        else
            assm = cli.System.Reflection.Assembly.GetExecutingAssembly();
     
        cli.System.Runtime.Remoting.ObjectHandle hdl = cli.System.Activator.CreateInstance(assm.get_FullName(), outputBuilder);
        return (IOutputBuilderEngine) hdl.Unwrap();

    What is your outputBuilder?

    How do you use the code above in your add-in?

     

    >>I'm running in WindwardReports.dll trying to load OfficeOutputBuilder.dll. But why is it searching for the DLL that I'm running in?

    According to Activator.CreateInstance Method (String, String) & ObjectHandle.Unwrap Method (), do you want to load the outputBuilder (which type is IOutputBuilderEngine) in the assm?

     

    If you are running WindwardReports.dll and trying to load OfficeOutputBuilder.dll, I think the path should be the path of OfficeOutputBuilder.dll, do you check the path?

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, November 7, 2016 8:28 AM
    Moderator
  • Hi;

    The OutputBuilder is a way to use Office to call saveAs to create PDF versions of DOCX/XLSX/PPTX.

    Yes I want to load the OutputBuilder class.

    Yes the path is to OfficeOutputBuilder.dll.

    The code all works if called in a command line app. It just fails if called in the AddIn.

    thanks - dave


    What we did for the last 6 months - Made the world's coolest reporting & docgen system even more amazing

    Monday, November 7, 2016 1:00 PM
  • Hi,

    I think the issue might cause from the project type.

    Since you are developing a COM add-in, I'm trying to involve some senior engineers into this issue and it will take some time.

    Sorry for any inconvenience and have a nice day! 

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, November 9, 2016 10:11 AM
    Moderator
  • This is now working so you can close this issue.

    I have no idea why it now works.


    What we did for the last 6 months - Made the world's coolest reporting & docgen system even more amazing

    • Marked as answer by DavidThi808 Wednesday, November 9, 2016 12:51 PM
    Wednesday, November 9, 2016 12:51 PM