3

I have a simple Console Application write with C-Sharp language (Visual Studio 2013):

using System;
using System.Collections.Generic;
using System.Text;

namespace HelloWorld
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World");
            Console.ReadKey();
        }
    }
}

When I press F5 or click Start button, my project was built, but not launch. Sometime, Ouput windows says:

Error   12  Could not copy "obj\Debug\HelloWorld.exe" to "bin\Debug\HelloWorld.exe". Exceeded retry count of 10. Failed.

Error   13  Unable to copy file "obj\Debug\HelloWorld.exe" to "bin\Debug\HelloWorld.exe". The process cannot access the file 'bin\Debug\HelloWorld.exe' because it is being used by another process.

but when I write Windows Form Application, my project was built and launch normally ???

Why? and How to solve this problem ?

4 Answers4

0

This is most likely due to windows keeping the process open. Your only option is to try and kill all processes of your app in task manager->processes.

The next thing to try is to simply change the build from debug to release, this should build another executable in the release folder as opposed to debug. By no means is this a silver bullet but, hopefully a sufficient workaround.

Before you try the release build, attempt to try and fix the problem. I've seen windows moan at just having my debug folder open and my exe selected because I suspect the thumbnail was being displayed thus being "used" in windows etc.

Neal
  • 573
  • 3
  • 16
  • Oh and try to delete everything in the debug folder. However, leave the files containing vshost – Neal Jul 25 '15 at 08:21
  • In debug folder, I can't do anything, but when I log off user and sign in again, i can do it. – Trần Hồng Phát Jul 25 '15 at 08:42
  • This sounds to me as if you might be having some permission trouble in the folder. Once all deleted try to right click on your project and click build. If you are not able to, try rebuild. After, that it's to try release, I did note you tried clean which sometimes solves this – Neal Jul 25 '15 at 08:43
  • When I create new project, the problem will show again, I'm trying to repair Visual Studio, but a new problem is shown, I can't delete anything in my project folder, ultil i sign out and login again, i don't know why and how to solve this :( – Trần Hồng Phát Jul 25 '15 at 08:51
  • Wow, it sounds like something really strange is going on. The last thing I can think of is simply to right click your visual studio shortcut, and run as administrator to see if it helps anything at all. Otherwise you might even need to go as far as a re-installation/repair of the installation – Neal Jul 25 '15 at 08:53
0

I found reason and solve for my problem. I tried to restart Application Experience Service and the problem was solved.

0

Please restart yor Visual Studio and then try again. It will work and delete your bin/debug folder again.

DeshDeep Singh
  • 1,817
  • 2
  • 23
  • 43
0

I have faced with this issue. That happeneds when an instance of software is running whether by visual studio or by your self

solution :

you should find your application name in the processes of task manager

your's is :

HelloWorld.exe

select that and click on the end task button

now you can start debugging and running you'r app.

at least worked for me.

Arash.Zandi
  • 1,010
  • 2
  • 13
  • 24