I’ve been working on a BizTalk Server 2004 project that had (not anymore) 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 configured to build the assemblies to a common reference folder shared by all projects:
Image may be NSFW.
Clik here to view.
And the other project is 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.
Cause
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.
Solution 1
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
Image may be NSFW.
Clik here to view.
Work like a charm!
Solution 2
Close all the Visual Studio solution that reference this assembly or assemblies and build the project.
The post The file ‘…’ cannot be copied to the run directory. The process cannot access the file because it is being used by another process. appeared first on SANDRO PEREIRA BIZTALK BLOG.