Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error when building in VS.Net

Status
Not open for further replies.

sajidi99

Programmer
Jun 7, 2005
53
0
0
SE
Hello,

When I try to build my solution I get following error:

Error 165 Unable to copy file "<dll name>". The process cannot access the file 'bin\Debug\"<dll name>" because it is being used by another process.

The <dll name> is a project dll of the solution that I am trying to build.

The "Copy Local" property for all the references to above "<dll name>" is set to false.

I get this error sometimes and when I get it, I have to close down VS.NET and then restart it to get rid of it. It really wastes a lot of time!

Any idea what it can be?

Thanks



Ch Saj
 
Update about this:

I see the error at build time, ONLY if I have edited a form in the problem project. In other words, if I edit a form in the project which is giving error, then build the solution, it fails to build and gives the error described in previous post.

Ch Saj
 
Have you tried removing and re-adding the reference in the project that uses the DLL? Also, if the reference dll is in the same solution, add the reference from the project tab if you hadn't previously. I don't know if any of this helps, but I hope it does.
 
Have you checked project dependencies? Make sure that the dll is a dependency of the other project so that it forces it to build it first
 
Make sure that the dll is a dependency of the other project so that it forces it to build it first

Right click on References -> Add Reference
Select the Projects Tab
Select the dll project name from the list
Click OK

Just in case it wasn't clear.

 
Thanks JurkMonkey fo clarifying my last statement,
also Right click on project -> Porject Dependencies
Check DLL box
Click Ok
 
Hello Guys,

I tried your suggestions but they do not seem to fix this problem.

Tried building the project on its own but it gives the same error too. Also I have checked the project dependencies and build order. They seem fine.

Because it says, "...cannot access the file ...", I think something in the problem project is not getting closed or freed up when I edit a form in that project. But I don't know what that 'something' is. Does anybody know how to check the items still not freed up (or open) by VS before or after build?

Thanks

Ch Saj
 
close out VS and delete the DLL then rebuild it
 
Do you have your reference to the DLL set to the DLL itself, or the DLL project in your solution?

Let me clarify...

when you set your reference to your DLL object.. did you BROWSE and select the .DLL file to reference? or did you select PROJECT and select the active project within your solution? The 1st option will cause your problem, where the latter should work perfectly.

I had the same problem when I first started C# many years ago.. then i quickly learned to reference the dll project within my solution rather than the actual DLL.

Hope this solves your issue.

G.

Oxigen - Next generation business solutions
-----------------------------
Components/Tools/Forums/Software/Web Services
 
Hello Gorkem,

I did the same mistake a long time ago when I was new to .NET but now I am ok. Its something else ....

I tried removing and re-attaching the references to this problem project but still the error comes up as soon as I edit a file in the problem project.

Cheers

Ch Saj
 
I did give a go at your suggestion in the last message .. but did not help ... as soon as you modify a file in the problem project, the error re-appears!

What I did was, unload project and re-load it. Also removed it from the solution (which removed the references to this project as well, in other other projects) and then re-added it and referenced it from other projects.

Cheers

Ch Saj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top