tags:

views:

112

answers:

4

Hello, Something strange happened -at least for me - , as I know in a 3 tier model you make DLLs and let your UI make a reference to them , right now I'm working like this: ClassLibrary project for the DAL, another one for the BLL with reference to the DAL DLL located on the DAL bin/debug directory so that the BLL ClassLibrary project implements the DAL changes immediately , then a Windows Application project with references to both BLL and DAL DLLs located on their respective bin/debug directories . Then I wanted to test and to examine the exceptions generated when the aplication can't find the DLLs it's referencing , I cutted the DLLs and putted them in another location , the Application is still working fine !!? , thats was strange enough but I guessed maybe when running the Windows application it recreates those DLLs again so I put those DLLs on another folder in the Desktop and I delete the old references from the Windows application and recreated them pointing this time to the ones on the Desktop folder and tested it , after that I delete the Desktop folder and the application still working fine and connecting to the database and every thing ??? Environment: XP SP2 VisualStudio 2008 C#

+1  A: 

The compiler copies the dll's in it's own bin folder and uses those. So you have to clean your project to see a difference.

chrissie1
Thanks for the answer , right I found my DLLs on the application bin folder but when I tried to move them It fails to compile , and what happens if I make changes to the DLL not in it's bin folder which one it will use ? , please provide help I'm so confused.
So compile first then move them?
+1  A: 

Run the fusion log viewer "fuslogvw" and configure it to log assembly binds. This will show you what assemblies are being loaded and from what location.

1800 INFORMATION
A: 

Dlls are generally loaded the following way:

1)Local directory

2)Global Assembly Cache

3)Windows/system32 directory

The last two might be swapped. I don't remember.

Also Process Explorer is great for looking at what DLLs are loaded + where they are loaded. Just make sure it's set to show the DLLs loaded when you click on an executable.

mcauthorn
A: 

You can't test this within Visual Studio as the build / debug / run will rebuild the references. Removing the references will break your code as the compiler will balk and refuse to compile the app as you have noted.

You will need to compile the app, then remove the DLLs from the bin folder using windows explorer and then run the application by double clicking the app. not using Visual Studio.

This will throw an exception of some descrioption which will pop up in a little box. The JIT Debugger might also catch it (maybe??) and let you attach to the process using VS but I'm not sure.

Greg B