Home > OS >  How to write C# code that auto generate new project (.sln) with simple 'hello world' metho
How to write C# code that auto generate new project (.sln) with simple 'hello world' metho

Time:03-28

I looked at some examples and I didn't find any example that create new .sln with one simple runnable class (simple console project with main that print hello world)

anyone know how to do it or can point on some example ?

CodePudding user response:

You can easily use CLI

    dotnet new console -n MyConsoleApp
    cd MyConsoleApp
    echo "Console.WriteLine(\"Hello, David\");" > Program.cs. //OSX
    echo 'Console.WriteLine("Hello, David");' > Program.cs;   //Windows
    dotnet run
    

enter image description here

  • Related