Click here to Skip to main content
15,888,077 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello!!!

I can't execute any .exe C# file that I've made.

For example I write the most simple code:

--------------------------------------------------
C#
using System;
namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
         
                 Console.WriteLine("HELLO WORLD");
                 Console.ReadKey();
        }
    }
}

---------------------------------------------------

then I debug the file and it works.
But when i go to the .exe directly and try to execute it then it just keep "thinking" and does nothing!

I go to the Task Manager and the process is running BUT if i try to finish it it does nothing!

PLEASE HELP!

What I have tried:

I've tried to compile it with csc.exe but the problem is the same
Posted
Comments
Sergey Alexandrovich Kryukov 26-Mar-16 13:03pm    
Perhaps this is because you don't know that C# is not built in VS 2010. VS is nothing but IDE. :-)

It the application type set to "Console" in the project? If yes, something must be badly screwed up in your environment. Then reinstall things step by step: 1) VS, 2) .NET, then VS, 3) OS, then .NET and then VS...

—SA
Richard MacCutchan 26-Mar-16 13:07pm    
Most likely because it is waiting fo you to type something at the console in order to complete the Console.ReadKey(); method. I just tried the above code and it works fine.
Sergey Alexandrovich Kryukov 27-Mar-16 1:53am    
It's supposed to show "HELLO WORLD" before that moment; the inquirer's "does nothing" should mean that it doesn't happen... :-)
—SA
Richard MacCutchan 27-Mar-16 3:11am    
As I said in my reply, the code works correctly.
Sergey Alexandrovich Kryukov 27-Mar-16 11:54am    
Certainly. That's why I said the problem must be in the environment which is probably badly screwed up.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900