Basics

F,xlr BT You can specify another filename for the executable application that you create. To do this, use the /out switch followed by a colon and type the name of the executable file that you want to create. For example, to compile the FirstApp.cs source file to an executable file named HelloWord.exe, you would type csc /out:HelloWorld.exe FirstApp.cs

You can view all of the options for the C# compiler by typing csc /? at the command line. Because the options list is long and could scroll outside of the viewable window, type csc /? | more to see the options one screen at a time.

C:\Docunents and SettingsNAdmin istratoiOcd C:\CSharp C :\Cs harp]fcsc Firstflpp.es]

Microsoft >Ji;

6151

Copyright CO Mil

C:\Csharp^Firstftpp. i

C:\WINNT lSystem32\cind

Microsoft Windows 2000 [Ue] <C> Copyright 1985-2000 Mil n 5.00.2195] oft Corp.

C:\Docunents and SettingsNAdmin istratoiOcd C:\CSharp C :\Cs harp]fcsc Firstflpp.es]

Microsoft >Ji;

6151

Copyright CO Mil

C:\Csharp^Firstftpp. i

Gii Compiler Uersion 7.00.9148 CCLR version oft Corp 2000. All rights reserved.

□ Change directories to the source file location by using the cd command.

Note: In this example, the command is cd C:\Csharp.

^0 Compile the class at the command prompt using the csc command.

Ily Documents

C: V.WINNT \System32Kcmd

Microsoft Windows 2000 [Uersion 5.08.21951 <C> Copyright 1985-2000 Microsoft Corp.

C:\Documents and Settings\Administrator>cd C:\CSharp

Note: In this example, the command is csc FirstApp.cs.

■ An executable file is created from the source file.

^0 Run the program by typing the name of the executable file and pressing Enter.

C:\Cshflrn>Pirstflpp.F!xe Hello World using Ctt!

■ The program displays the Hello World using C#! message.

Was this article helpful?

0 0

Post a comment