-1

I am working on an operating system with Cosmos, I am wondering if there is a way to compile text from a file, for example: helloworld.cs, and then execute the file. Thanks in advance.

  • I think this is already answered [here](https://stackoverflow.com/questions/553143/compiling-executing-a-c-sharp-source-file-in-command-prompt). – bdongus Apr 15 '20 at 08:51
  • @bdongus I'm not sure Pikalover is asking within the context of how to turn helloworld.cs into helloworld.exe on a *Windows* system... – Caius Jard Apr 15 '20 at 08:58

1 Answers1

0

If you want to compile a c# file (.cs) like helloworld.cs in Windows

namespace test {
    class test {
        static void Main(string[] args) {
            System.Console.WriteLine("Hello World");
        }
    }

}

you can use csc.exe to compile the file

C:\Windows\Microsoft.NET\Framework\{version}\csc.exe pathToFile

reza moradi
  • 17
  • 1
  • 5