Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>CSC.exe is the CSharp compiler included in the .NET Framework and can be used to compile from the command prompt. The output can be an executable (.exe) if you use /target:exe, or a DLL if you use /target:library. CSC.exe is found in the .NET Framework directory, e.g. for .NET 3.5, <code>c:\windows\Microsoft.NET\Framework\v3.5\</code>. </p> <p>To run it, first open a command prompt (click Start... then type <code>cmd.exe</code>). You may then have to cd into the directory that holds your source files. </p> <p>Run the C# compiler like this: </p> <pre><code> c:\windows\Microsoft.NET\Framework\v3.5\bin\csc.exe /t:exe /out:MyApplication.exe MyApplication.cs ... </code></pre> <p>(all on one line) </p> <p>If you have more than one source module to be compiled, you can put it on that same command line. If you have other assemblies to reference, use <code>/r:AssemblyName.dll</code> .</p> <p>Ensure you have a static Main() method defined in one of your classes to act as the "entry point".</p> <p>To run the resulting EXE, just type <code>MyApplication</code> followed by <code>&lt;ENTER&gt;</code> at the command prompt. </p> <p><a href="https://msdn.microsoft.com/en-us/library/ms379563(v=vs.80).aspx" rel="noreferrer">This article</a> on MSDN goes into more detail on the options for the command-line compiler. You can embed resources, set icons, sign assemblies - everything you could do within Visual Studio. </p> <p>If you have Visual Studio installed, in the Start menu (under Visual Studio Tools) you can open a "Visual Studio Command Prompt" that will set up all required environment and path variables for command line compilation.</p> <p>While it's very handy to know of this, you should combine it with knowledge of some sort of build tool such as <a href="http://nant.sourceforge.net/" rel="noreferrer">NAnt</a>, <a href="http://msdn.microsoft.com/en-us/library/0k6kkbsd.aspx" rel="noreferrer">MSBuild</a>, <a href="http://www.finalbuilder.com/" rel="noreferrer">FinalBuilder</a> etc. These tools provide a complete build environment, not just the basic compiler.</p> <h3>On a Mac</h3> <p>On a Mac, syntax is similar, only C sharp Compiler is just named <code>csc</code>:</p> <pre><code>$ csc /target:exe /out:MyApplication.exe MyApplication.cs ... </code></pre> <p>Then to run it :</p> <pre><code>$ mono MyApplication.exe </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload