|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
/main (Specify Location of Main Method) (C# Compiler Options)
This option specifies the class that contains the entry point to the program, if more than one class contains a Main method.
If your compilation includes more than one type with a Main method, you can specify which type contains the Main method that you want to use as the entry point into the program.
This option is for use when compiling an .exe file.
To set this compiler option in the Visual Studio development environment
Open the project's Properties page. For details, see.
Click the Application property page.
Modify the Startup object property.
To set this compiler option programmatically, see.
Compile t2.cs and t3.cs, specifying that the Main method will be found in Test2:
csc t2.cs t3.cs /main:Test2