tags:

views:

2434

answers:

5

I need to use a dll in my asp.net application. How do I load a dll not from a bin directory?

Perhaps I should mention that the application is a mixture of asp code and asp.net code. so, when I develop it on my machine, I place a dll in the bin directory, but after I move the code to the live environment, I don't want to have a separate bin directory for every piece that's using asp.net.

All I am moving is .aspx and .aspx.cs files. Is there a way to load a dll NOT FROM /bin (specify it with "using" statement)? Looks like it automatically looks in the /bin....

+3  A: 

You can either place the DLL in the bin folder of the root of your application, or install it to the Global Assembly Cache (GAC) using gacutil (which requires the assembly to be strong-named and signed).

I would just keep it in the bin.

John Sheehan
It's worth noting that for assemblies to be loaded into the GAC they need to have a strong name and be signed.
axel_c
Good note axel, thanks...I'll add it to the answer
John Sheehan
A: 
Joel Coehoorn
A: 

.net app looks in the /bin of the project, and the GAC (Global Assembly Cache) where you put system shared DLL-s.

If your app is one .net app (configured in IIS as one app), but you have aspx files in subfolders, they should see the root /bin folder. i'd stick with keeping dlls in /bin, if that isn't several tenths of bins (which would mean that you have a problem with your app organization).

zappan
A: 

that's the thing: because it's poorly organized (its a mix of asp and asp.net) it's certainly NOT configured properly....I think it's best to have "10 thousands bins" for now.

Thanks guys!

gnomixa
try to arrange something in the IIS to configure it as one app and/or one virtual directory... play around a bit, maybe you can get it to work with only one /bin
zappan
A: 

Simply add the other dll's directories to your path environment variable. Must restart asp.net process / visual studio for the change to take effect. Worked for me.

Matt H