Dynamically loading an assembly in ASP.NET application

  • Thread starter Thread starter Tim Mavers
  • Start date Start date
T

Tim Mavers

I have created a DLL (class library) in .NET that I need to dynamically load
from my ASP.NET application.

I am trying to use Assembly.Load(...) to load the file, which is in the /bin
directory of the web app but I am getting a failure.

The class library is just a simple DLL with just one method. It's not
strong name, versioned or installed in the GAC. I just want to load it in
(without using LoadFrom() and explictly passing
c:\inetpub\wwwroot\webapp\bin\mylibrary.dll" which is a major hack IMHO).

Is this possible? I have tried using:

Assembly.Load("MyNamespace");
Assembly.Load("MyNamespace.dll");
Assembly.Load("MyNameSpace MyNamespace.dll")

Is there a way to do this without hacking in a hard-coded path?
 
another common failure is the dll requires another dll not in the bin
folder.

-- bruce (sqlwork.com)
 
Thanks, I did mean the assembly name when I referred to using the namespace
(they are the same in my case). I got it to work, but I had to use:

Assembly.Load ("myassembly, Version=0.0.0.0, PublicKeyToken=null,
Culture=neutral")

Thanks for the help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top