I’ve been working on a BizTalk Server 2004 project that had (not any more) between 6 or 8 visual studio solutions each one with a BizTalk Project inside. After a few minutes swapping from a solution to another I decided to add all the project in a single solution.
I notice that all the solution are configure to build the assemblies to a common reference folder shared by all projects:
And the other project are referring the assemblies from that folder.
However when trying to compile the project I was getting the following error:
The file ‘MyDLLProject.dll’ cannot be copied to the run directory. The process cannot access the file because it is being used by another process.
But when I open that project isolated from the others projects I could successfully compile.
The cause is easy… the Visual Studio has a lock on the file.
Note: That this lock could be from the Visual Studio instance that you are working on or another Visual Studio instance in another session.
The easy solution to avoid further problems is to change the “Output path” to another location for example the default “bin\Development\”
And then instead of referring the assembly from a folder, chose Add reference from Projects
Work like a charm!
Close all the Visual Studio solution that reference this assembly or assemblies and build the project.