Show/Hide Toolbars

XSharp

Navigation: X# Documentation > X# Compiler Options

Command-line Building With xsc.exe

Scroll Prev Top Next More

You can invoke the X# compiler by typing the name of its executable file (xsc.exe) at a command prompt.

 

If you use a standard Command Prompt window, you must adjust your path before you can invoke xsc.exe from any subdirectory on your computer.

 

You can also use MSBuild to build X# programs programmatically. For more information, see the MSBuild documentation on MSDN.

 

The xsc.exe executable file usually is located in the {Program Files}\XSharp\Bin folder under the Windows directory.

 

When you build programs with the Visual Studio IDE then Visual Studio will locate the X# compiler automatically for you and the build output from the compiler will be shown in the Output Windows of Visual Studio.

You can set the verbosity level of the compiler output from the Tools/Options, Projects and Solutions, Build and Run page.

Rules for Command-Line Syntax for the X# Compiler

 

The X# compiler uses the following rules when it interprets arguments given on the operating system command line:

 

Arguments are delimited by white space, which is either a space or a tab.

The caret character (^) is not recognized as an escape character or delimiter. The character is handled by the command-line parser in the operating system before it is passed to the argv array in the program.

A string enclosed in double quotation marks ("string") is interpreted as a single argument, regardless of white space that is contained within. A quoted string can be embedded in an argument.

A double quotation mark preceded by a backslash (\") is interpreted as a literal double quotation mark character (").

Backslashes are interpreted literally, unless they immediately precede a double quotation mark.

If an even number of backslashes is followed by a double quotation mark, one backslash is put in the compiler options array for every pair of backslashes, and the double quotation mark is interpreted as a string delimiter.

If an odd number of backslashes is followed by a double quotation mark, one backslash is put in the compiler options array for every pair of backslashes, and the double quotation mark is "escaped" by the remaining backslash. This causes a literal double quotation mark (") to be added in compiler options array.

Commandline options can start with a hyphen (-) or a slash (/). On Non windows platforms the hyphen should be used because the slash may be seen as a path delimiter character

If you do not use the /noconfig compiler option then references to the assemblies listed in xsc.exe will be automatically included.

Sample commands for the X# Compiler

 

xsc file.prg

 

Compile File.prg and produce File.exe

xsc -target:library file.prg

 

Compile File.prg and produce File.dll

xsc -out:Program.exe file.prg

 

Compile File.prg and produce Program.exe

xsc -define:DEBUG -optimize -out:File.exe *.prg

 

Compiles all the X# files in the current directory, with optimizations on and defines the DEBUG symbol. The output is File2.exe

 

xsc /target:library /out:File2.dll /warn:0 /nologo /debug *.prg

 

Compiles all the X# files in the current directory producing a debug version of File2.dll. No logo and no warnings are displayed

 

xsc /target:library /out:MyBase.rdd *.prg

 

Compiles all the X# files in the current directory to MyBase.rdd  (a DLL):