Compiling code using the Developer Command Prompt

Start the Developer Command Prompt for VS2015 by typing the letters deve in the
Windows 10 Search box, as you can see in the following screenshot. You will also find
it on the Start Menu or Start Screen listed in All apps in the Visual Studio 2015 folder

At the Command Prompt, enter the commands to do the following:
• Change to the C:\Code folder
• Compile the source code using the C# compiler
• Request a directory listing
• Run the application by entering the name of the EXE

Here are the commands:
cd C:\Code
csc myfirstapp.cs
dir
myfirstapp

The output in the Command Prompt window should look like this

Note that your source code, the file named myfirstapp.cs, has been compiled into
an assembly named myfirstapp.exe. When you enter the name of the assembly, it
is loaded and executed by .NET Framework 4.6 and its CLR.
You can copy the myfirstapp.exe file onto any computer with Windows 10 and
it will run correctly because all copies of Windows 10 have .NET Framework 4.6
installed. Actually, you can copy the file onto a computer with an older version
of Windows as long as it has .NET Framework 4.0 or later installed.

A typical error might be using the wrong case, a missing semi-colon at the end of
a line, or a mismatched pair of curly braces. For example, if you had mistyped a
lowercase m for the Main method you would see this error message:
error CS5001: Program does not contain a static 'Main' method suitable
for an entry point

Comentarios

Entradas populares