BlockLeftTop, PRELOAD BlockLeftBottom, PRELOAD BlockLeftStretch, PRELOAD BlockTop, PRELOAD BlockBottom, PRELOAD BlockStretch, PRELOAD BlockRightTop, PRELOAD BlockRightBottom, PRELOAD BlockRightStretch, PRELOAD
DeltaEngine

Quick Tip: Getting rid of the "Unable to copy file" error in Visual Studio

by Benjamin Nitschke 21. June 2007 18:59

I had often the problem that after a while of using Visual Studio 2005 (especially in beta) and now with Visual Studio Orcas that when the solution grows and grows to many projects you encounter the following error quite often:

Unable to copy file "obj\Debug\<projectname>.dll" to "bin\Debug\<projectname>.dll".

The process cannot access the file 'bin\Debug\<projectname>.dll' because it is being used by another process.

This can be caused if you have not closed the app yet or use the dll/exe somewhere or even if a unit test is still running and does not quit. But these cases are not the problem, that is easily fixed by killing the process. More often this is caused by some bug in Visual Studio. Some designer locked the file, some resource was not released, etc.
The usual "solution" to this problem was to close Visual Studio and start it up again, then it worked for a while until you end up with the same issue. Just having 2-3 projects in a solution is not very problematic because this error just occurs once in a while. With 5+ projects and using a lot of unit testing, starting tests all over the place, and compiling every couple of minutes (or seconds) this is really an annoying problem that can slow you down.

The easy fix is to delete the <projectname>.dll.locked file in the bin\Debug\ directory, after that compiling works again and it can copy the file now.
A better and more clever solution is to add the following lines to each Pre-Build-Events texbox in each project:

if exist "$(TargetPath).locked" del "$(TargetPath).locked"
if exist "$(TargetPath)" if not exist "$(TargetPath).locked" move "$(TargetPath)" "$(TargetPath).locked"

After doing that no more "Unable to copy file" errors anymore :)

BTW: My last attempt to polynap recently (1.5 hours sleep every 6 hours) failed after doing it for about a week, have to find a better schedule, maybe every 4 hours was a better idea because it was more strict.

Comments


3/25/2010 11:07:40 PM #

Questions provide the key to unlocking our unlimited potential.

teeth whitening free kit | Reply



4/1/2010 8:32:13 AM #

Various people in all countries take the <a href="lowest-rate-loans.com/.../mortgage-loans">mortgage loans</a> from different creditors, because that's fast and easy.

LORRAINEEspinoza30 | Reply



4/15/2010 5:12:45 PM #

I would like to thank you for the efforts you have made in writing this post. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own BlogEngine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it.

Rapidshare Search | Reply



4/20/2010 12:26:54 PM #

Although I don\\\'t see eye to eye with all you staded, I must admit I do love your way of writing.

visual | Reply



4/20/2010 10:35:25 PM #

I admit, I have not been on this webpage in a long time... however it was another joy to see It is such an important topic and ignored by so many, even professionals.

Rapidshare Search Engine | Reply



4/21/2010 8:33:05 PM #

I recently came across your article and have been reading along. I want to express my admiration of your writing skill and ability to make readers read from the beginning to the end. I would like to read newer posts and to share my thoughts with you.  элитные проститутки Москвы

Проститутки | Reply



4/21/2010 10:58:24 PM #

Just want to say your article is striking. The clearness in your post is simply spectacular and i can take for granted you are an expert on this field. Well with your permission allow me to grab your rss feed to keep up to date with forthcoming post. Thanks a million and please keep up the effective work. Лучшие проститутки Москвы

Prostitutki Moskwa | Reply



4/23/2010 3:33:06 PM #

Just want to say your article is striking. The clearness in your post is simply spectacular and i can take for granted you are an expert on this field. Well with your permission allow me to grab your rss feed to keep up to date with forthcoming post. Thanks a million and please keep up the effective work. незабываемые проститутки Москвы

Prostitutki Moskwa | Reply



4/23/2010 7:33:38 PM #

You will never find time for anything. If you want the time, you must make it.

online cash loans | Reply



4/24/2010 9:35:22 PM #

Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with more information? It is extremely helpful for me. Rapidshare search services

Rapidshare search engine | Reply



4/25/2010 1:42:56 PM #

Thank you for submitting this issue. I'm passing it to the feature team to take a look.

fix exe error | Reply



4/25/2010 9:05:45 PM #

A thoughtful insight and ideas I will use on my website. You\'ve obviously spent a lot of time on this. Thank you! Texas Holdem poker

Texas Holdem site | Reply



4/27/2010 10:38:14 PM #

I\'m happy I found this blog, I couldnt discover any info on this subject matter prior to. I also run a site and if you want to ever serious in a little bit of guest writing for me if possible feel free to let me know, i\'m always look for people to check out my site. Please stop by and leave a comment sometime!

Rapidshare | Reply



5/4/2010 3:11:46 PM #

What I liked about her, she didn't give you a lot of horse manure about what a great guy her father was.

Links of London Jewellery | Reply



5/4/2010 4:56:50 PM #

Top Rapidshare Search engine

Rapidshare Search engine | Reply


Add comment




biuquote
  • Comment
  • Preview
Loading



Disclaimer: The opinions expressed in this blog are own personal opinions and do not represent the companies view.
© 2000-2011 exDream GmbH & MobileBits GmbH. All rights reserved. Legal/Impressum

Poll

Which platform should Soulcraft be released on next?











Show Results Poll Archive

Recent Games

Soulcraft

Fireburst

Jobs @ exDream

Calendar

<<  February 2012  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
2728291234
567891011