CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2015
    Posts
    2

    Why is my Hello World C# application not running through the command prompt?

    I'm working through Pluralsight's C# Fundamentals with C# 5.0 using Visual Studio Community and for some reason my Hello World application does not run through the command prompt, yet it runs properly through the VS debugger.

    I built the application in VS, opened the command prompt, cd'd to the proper folder and entered "Hello.exe". The command prompt "cursor" just blinks.

    I'm using Windows 10 and have included my code below. Any thoughts?

    Code:
    using System;
        
        namespace Hello
        {
            class Program
            {
                static void Main(string[] args)
                {
                    Console.WriteLine("Hello, World.");
                }
            }
        }

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Why is my Hello World C# application not running through the command prompt?

    Is the program named hello.exe? Does the folder you are navigating to (usually that's <project>\bin\debug) contain hello.exe? Are you building a release build? If so, are you navigating to <project>\bin\release?

    Note: <project>\bin\debug or <project>\bin\release are the default output folders for a project. Have you changed these settings? Right click on the project in the solution explorer inside Visual Studio and choose "Properties", then select "build" to check. If you are opening a sample project from the book, it is possible that these defaults have been changed.

    Also check the name of the output exe. Maybe it is called something other than hello.exe (check that in the project's properties).
    Last edited by Arjay; November 22nd, 2015 at 06:43 PM.

  3. #3
    Join Date
    Nov 2015
    Posts
    2

    Re: Why is my Hello World C# application not running through the command prompt?

    Thank you for your reply, Arjay. It turns out that Avast's File System Protection was blocking the commands. I turned of the protection temporarily and the application ran as desired.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured