views:

44

answers:

1

I have a solution made up of multiple projects which have various dependencies on each other. When I build the project/solution, it creates the DLL assembly files in the Project\bin folder(s) as it should. But when I run the program, it copies everything to the temporary files folder and runs it from there:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\ApplicationName

So now there are identical DLL files for each project in the bin folders and in the temporary files folder, where it's being run from. The problem is that I have references to the bin directory(s) hardcoded into my projects in a couple places, so when it looks there, it comes back with a DLL mix-up and errors out. How can I get Visual Studio to run the assembly files from the original bin directory(s) instead of duplicating them and running them from the temporary files?

P.S. Please don't tell me to change the hardcoding - there are reasons why it has to stay as it is; that's why I'm trying to figure out how to run from the bin.

Thanks

+2  A: 

This is known as Shadow Copying, and its a design feature. Particularly for ASP.NET sites, it enables domain assemblies to be updated without unloading the application domain, which is important for ASP.NET sites which are designed to run continuously. I would really recommend leaving it on, and re-assessing the requirement for use of the \bin directory.

If you really want to disable shadow copying, add the following to your web.config file:

<hostingEnvironment shadowCopyBinAssemblies="false" />

The side-effect of doing the above, is that your assemblies in your \bin directory will be locked during the lifetime of the application.

Matthew Abbott