Specifies the class or module that contains the Sub Main procedure.
/main:location
Use this option when creating an executable file or Windows executable program. If the /main option is omitted, the compiler searches for a valid shared Sub Main in all public classes and modules.
See
When location is a class that inherits from System.Windows.Forms.Form, vbc.exe lets you compile code at the command line that was created in the development environment:
' Compile with /r:System.dll,SYSTEM.WINDOWS.FORMS.DLL /main:MyC. Public Class MyC Inherits System.Windows.Forms.Form End Class
To set /main in the Visual Studio integrated development environment
To set /main programmatically
The following code compiles t2.vb
and t3.vb
, specifying that the Sub Main procedure will be found in the Test2
class:
vbc t2.vb t3.vb /main:Test2