C# Console App

C# is an elegant and type-safe object-oriented language that enables developers to build a variety of secure and robust applications that run on the .NET Framework. C# syntax is highly expressive, yet it is also simple and easy to learn. The curly-brace syntax of C# will be instantly recognizable to anyone familiar with C, C++ or Java.

Here I am going to demonstrate how to create simple .net project without Visual Studio


  • .Net Framework has been install to your PC or laptop, and the version of .Net Framework on your PC is 2.0+ or later
  • Assume the path of .Net Frameowork is c:\Windows\Microsfot.Net\Frameowork\v2.0.50727

Create a project

  • Create a project named csharp-project

    md csharp-project
    cd csharp-project 
    md bin src

Update config file

  • Update config file csharp-project.proj as below

    <Project DefaultTargets = "Compile"
    xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
    <!-- Set the application name as a property -->
    <!-- Specify the inputs by type and file name -->
        <CSFile Include = "src\helloworld.cs"/>
    <Target Name = "Compile">
        <!-- Run the Visual C# compilation using input files of type CSFile -->
            Sources = "@(CSFile)"
            OutputAssembly = "bin\$(appname).exe">
            <!-- Set the OutputAssembly attribute of the CSC task
            to the name of the executable file that is created -->
                TaskParameter = "OutputAssembly"
                ItemName = "EXEFile" />
        <!-- Log the file name of the output file -->
        <Message Text="The output file is @(EXEFile)"/>

Create the main program

  • Create a new file named HelloWorld.cs and copy following coding to the new file

    public class Hello
        public static void Main()
            System.Console.WriteLine("Hello, World!");

Run the console app

  • Compile with MSBuild & Run