Help with solving error

vcharles
vcharles used Ask the Experts™
on
Hi,

When attempting to run my application I receive the following 2 errors. How do I fix those two errors?

1. Could not copy "obj\x86\Debug\AP29_XMLA.exe" to "bin\Debug\AP29_XMLA.exe". Exceeded retry count of 10.

2. Unable to copy file "obj\x86\Debug\AP29_XMLA.exe" to "bin\Debug\AP29_XMLA.exe". The process cannot access the file 'bin\Debug\AP29_XMLA.exe' because it is being used by another process.      AP29_XML

thanks,

Victor
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
AndyAinscowFreelance programmer / Consultant
Commented:
Sounds like the file AP29_XMLA.exe is executing (or opened by another app) so you can't overwrite it.  Check the task manager and close the exe down then try again.
AndyAinscowFreelance programmer / Consultant

Commented:
ps.  A reboot should also cure it.
Fernando SotoRetired
Distinguished Expert 2017

Commented:
Hi Victor;

This could also happen if in your code you open a file then you quit the application in the middle of debugging and that leaves the file in use. So when you run your application again you can't access the file because it is being held by another process. Every time you run your app it starts a new process and the cause of the error.

By the way if you terminate Visual Studio and restart it, it will work again until you hit the problem again. Place code like that in a using statement and make sure you are not in that block when you terminate the debug session.
Expert Spotlight: Joe Anderson (DatabaseMX)

We’ve posted a new Expert Spotlight!  Joe Anderson (DatabaseMX) has been on Experts Exchange since 2006. Learn more about this database architect, guitar aficionado, and Microsoft MVP.

Author

Commented:
Hi Fernando,

I will try it, noticed if zi rename the assembly and rootname thr the error fors noy occur. According to task manager there are no other instances running.

Victor
Fernando SotoRetired
Distinguished Expert 2017

Commented:
According to task manager there are no other instances running.
And yet the OS see one.

Author

Commented:
Yes, that is very strange.
AndyAinscowFreelance programmer / Consultant

Commented:
Leave the names the same.  Reboot.  Does the error still happen?

Author

Commented:
I will try it later and get back to you.
AndyAinscowFreelance programmer / Consultant
Commented:
I've also remembered something from many years ago.  For a few weeks I experienced intermittantly a similar problem.  Turning the AntiVirus off temporarily and the problem disappeared.  Turn it back on and occasionally I would see this sort of error.  A couple of weeks later everything worked perfectly again.  
That certainly looked like a buggy update to the anti virus app was causing it.
Retired
Distinguished Expert 2017
Commented:
Hi Victor;

It has been my experience that this issue can be corrected by saving and closing the project closing down Visual Studios and then starting Visual Studios back up and reopening your project. Having this issue I have never needed to reboot the machine to get the project working again.

Author

Commented:
Thank you for all the comments.

Victor

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial