locked
Load library or dll into c# page dynamically from appsettings RRS feed

  • Question

  • User-588203678 posted
    Hi
    In app setting given path to dll.like
    <configuration>
    <App name="maildll" value="c:/imap4.dll;c:/SMTP.dll">
    I need to load each library or dll in a page, instead of giving service reference.
    Wednesday, September 11, 2019 4:36 AM

All replies

  • User665608656 posted

    Hi guhananth,

    According to your description, if you want to load library or dll in page dynamically, you can follow these codes:

               var DLL = Assembly.LoadFile(@"C:\visual studio 2012\Projects\ConsoleApplication1\ConsoleApplication1\DLL.dll");
    
                foreach(Type type in DLL.GetExportedTypes())
                {
                    dynamic c = Activator.CreateInstance(type);
                    c.Output(@"Hello");
                }

    You can also refer to this link : https://stackoverflow.com/a/18362459

    Best Regards,

    YongQing.

    Thursday, September 12, 2019 9:00 AM