Tuesday, August 11, 2009

Multiple Main() methods inside a project

Hey All,

I am back :)

If you try to compile a project having multiple Main() methods, the compiler will throw an error. The simplest solution in this case would be to comment out/ remove teh Main() methods apart from the one we currently wish to use.

If you do not want to delete the additional Main() methods, do this:

Choose Project -> Properties
Choose the "Application" tab
In this tab, there is a drop down list titled "Startup object"
Choose the class that contains the "entry point" that should be run, ignorin the remaining Main() methods

I found this out in a MS developer site and thought of posting it. Hope this helps somebody!

Happy Coding :)

~ Karthik