I am following this tutorial:
http://www.csharp-station.com/Tutorials/Lesson01.aspx
I pasted this into a text file, named it Welcome.cs:
// Namespace Declaration using System; // Program start class class WelcomeCSS { // Main begins program execution. static void Main() { // Write to console Console.WriteLine("Welcome to the C# Station Tutorial!"); } }
Then I went into the command prompt, and pointed to the file's directory. I typed csc.exe Welcome.cs
and got this error message:
csc.exe is not recognized as internal or external command
I am using Visual Studio 2008
I tried moving csc.exe to the Windows directory, and now I am getting this error:
fatal error cs2018: unable to find messages file 'cscompui.dll'
How can I compile my C# code from the command line?
csc.exe isn't in your path. Try fully-qualifying it:
C:\WINDOWS\Microsoft.NET\Framework\v3.5\csc.exe
(replace 3.5 with whatever framework you're using, of course.)
Note that Visual Studio isn't being used here. Doesn't matter what version of that you're using, because you're not using it when you compile from the command line. The command line compiler is part of the framework itself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With