Create console in C # but not launch application

I have a simple console program written in 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 the Start button, my project has been created, but it won't start. Someday, Ouput windows say:

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 a Windows Form application my project was built and started normally.

Why? and how to solve this problem?

+3


source to share


3 answers


This is most likely due to windows not opening the process. Your only option is to try and kill all processes of your application in Task Manager -> Processes.

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



Please try to fix this issue before attempting to build a release. I saw Windows moan when my debug folder opened and my exe was selected because I suspect the thumbnail is displayed, so it is "used" on windows, etc.

0


source


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



0


source


Restart yor visual studio and try again. It will work again and delete the bin / debug folder.

0


source







All Articles