For anyone wanting to generate an entry point using CodeDom, there's a type called CodeEntryPointMethod.  In VB, it generates the familiar Public Shared Sub Main().  However, CodeEntryPointMethod is limited in that most providers do not support setting a return type or defining function parameters.  That means your app can't have a return value.  It also means that you can't accept command line arguments, so this seems like a pretty major limitation.  The reason is that there are many languages which do not have the concept an "entry point" as a specific function which gets called.  Perl is one example which does not have a "main" function.

There is a way to get all of this functionality, and the solution is to generate some extra code to call into the Environment class.  First, you can use Environment.ExitCode to set the return code of your app.  Second, there's Environment.GetCommandLineArgs() which will return you the command line args.  Be aware that GetCommandLineArgs also returns the name of the exe and any path information that was included when the exe was launched.  For that reason, it demands EnvironmentPermission for reading the "Path" environment variable and may not work in semi trusted scenarios.