none
Cannot run exe found in /bin/Debug from command line

    Question

  • I have just downloaded Visual Studio and attempting to create my first C# app. I have a simple program:

    static void Main(string[] args) {    
        Console.WriteLine("Hi");
    }

    When I click the start button in Visual Studio, the program runs as expected. However, when I open a command prompt and navigate to the /bin/Debug directory manually and try to run the program, it hangs indefinitely with no output.

    Anyone have any idea what could be going wrong?



    • Edited by Joel amos Monday, December 14, 2015 2:52 AM
    Monday, December 14, 2015 2:51 AM

Answers

  • Just to exclude: There are reports about problems with anti-virus lately (Avast).

    With kind regards

    • Marked as answer by Joel amos Monday, December 14, 2015 4:42 AM
    Monday, December 14, 2015 4:30 AM

All replies

  • I certainly cannot reproduce that.  Those steps work fine for me.

    Some experiments for you to try:

    What happens when you run your program by using Ctrl+F5? (...which is the shortcut for Debug > Start Without Debugging)

    What is the full name of the executable?  You aren't trying to run the ConsoleApplication1.vshost.exe are you?  You should run your ConsoleApplication1.exe.  (Or whatever your project is called)

    Also, go to your project properties and double-check your Build > Output Path for your project and make sure it is the same as the folder you are running.

    Also, double-check the platform.  Are you running the Any CPU build?

    Also try in Release configuration to see if you get the same weirdness.

    It's possible that maybe you aren't running the same executable you are building.  Delete it and see if your build re-creates it.  Make sure you do a clean / rebuild.

    It's also possible that you are not building the code you think you are.  Sometimes we wind up looking at the wrong file in our editor thinking that's the code we're building.

    If it runs but hangs, then launch visual studio and do "attach to process..." and attach to the hung process.  Click break in the debugger and see what your call stack looks like.

    Also, try to reproduce this on another machine if you have access to one.

    Monday, December 14, 2015 3:19 AM
  • When I try to use Ctrl+F5, a command prompt entitled "C:\\Windows\system32\cmd.exe" opens, but nothing appears to happen. In order to see the console output, I've added Console.Read() to the end of my program. I then terminate it by pressing Enter.

    I'm definitely building the correct project and running the correct executable. I am using Any CPU. I've now tried building it as "Release," and it has the exact same behavior. Clean + build doesn't seem to make a difference.

    When I try to run the exe manually, I can't find the process in task manager. It seems as though it's running, however, because I can't type anything else after my command.

    Here's the command I'm using: "C:\Users\Joel Christophel\Documents\visual studio 2015\Projects\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.exe".







    • Edited by Joel amos Monday, December 14, 2015 3:48 AM
    Monday, December 14, 2015 3:38 AM
  • Just to exclude: There are reports about problems with anti-virus lately (Avast).

    With kind regards

    • Marked as answer by Joel amos Monday, December 14, 2015 4:42 AM
    Monday, December 14, 2015 4:30 AM
  • Gosh darnit, avast was to blame!
    Monday, December 14, 2015 4:42 AM