Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Visual Studio
Visual C#
C# Reference
C# Compiler Options
 /main (Specify Location of Main Met...

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
C# Language Reference 
/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.

/main:class
class

The type that contains the 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

  1. Open the project's Properties page. For details, see How to: Set Project Properties (C#, J#).

  2. Click the Application property page.

  3. Modify the Startup object property.

    To set this compiler option programmatically, see StartupObject.

Compile t2.cs and t3.cs, specifying that the Main method will be found in Test2:

csc t2.cs t3.cs /main:Test2

Other Resources

C# Compiler Options

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker