Could not write the output file



I have a solution with 4 C# projects (P1, P2, P3, P4). The P2 and P3
projects have a reference to P1 project and the P3 project has a reference to
P2 project too.
P1 and P2 are class libraries and their output path is bin\Debug. P3 is
class library and his output path is to local web, in this case a local full
path (C:\inetpub\wwwroot\...). P4 is a Windows application project which
loads the assemblies from local web (http://localhost/...).
The reference in P2 to P1 is whit copy local false, and the references
from P3 to P1 and P2 are with copy local true.
P2 and P3 contains inherrited forms from a form from P1.
Q: When I build my solution, the builder shows the error message: "Could
not write the uotput file ...\obj\Debug\P1.dll -- The process cannot access
the file because it is being used by another process."
Please help me, what is the solution.

Thank you!

W.G. Ryan eMVP

Try closing the solution and restarting it again - but once you close it -
restart IIS before reopening the solution.


I tried it, but is not working. The error message says than tha P1.dll
could not be writen in obj\Debug folder and not to local web.
I supose than the builder use P1.dll from obj\Debug because P2 and P3 has
inharrited forms from a form from P1 project.
I must create 2 separat solutions for projects P1 and P2, P3, P4?



I've had this problem, too, on more than one solution I've built. What
usually works is to remove references of the offending project from the other
projects that rely upon in, build the problem project, and then re-add the
references back to the ones that need it. This normally works, but if it
doesn't, I close down Visual Studio, and proceed to delete the /obj and /bin
files for all of my projects, restart Visual Studio and go on my merry way.

The first version of Visual Studio .NET had this problem, and I had hoped
that Microsoft had fixed it with the 2003 release, but it appears to not be a
significant enough problem for them. I only hope it gets corrected in



Finally the solution was to move the P1 project into a new solution. This
is working, but in case to make changes in P1 project I neet to close the
current solution, open the other solution, make the changes, compile, close
solution and reopen the initial solution.
I think MS can correct this bug in VS.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question