hi friends,

in visual C# 2008 express edition IDE, when I tried to add more than one C# source files in the same project then I got following errors:

Error    1    Program 'C:\Documents and Settings\Santosh Tripathi\My Documents\Visual Studio 2008\Projects\ConsoleApplication1\ConsoleApplication1\obj\Debug\ConsoleApplication1.exe' has more than one entry point defined: 'ConsoleApplication1.Class2.Main()'.  Compile with /main to specify the type that contains the entry point.    C:\Documents and Settings\Santosh Tripathi\My Documents\Visual Studio 2008\Projects\ConsoleApplication1\ConsoleApplication1\Class2.cs    10    21    ConsoleApplication1


Error    2    Program 'C:\Documents and Settings\Santosh Tripathi\My Documents\Visual Studio 2008\Projects\ConsoleApplication1\ConsoleApplication1\obj\Debug\ConsoleApplication1.exe' has more than one entry point defined: 'ConsoleApplication1.Class1.Main()'.  Compile with /main to specify the type that contains the entry point.    C:\Documents and Settings\Santosh Tripathi\My Documents\Visual Studio 2008\Projects\ConsoleApplication1\ConsoleApplication1\Class1.cs    10    21    ConsoleApplication1

what all I want is to add more than one C# program files in a single C# project in this IDE.

is this possible ?
regards
san

You can have 1000 files in your project. But only one of them can contain a method called Main.

Comments
Quick solution.

You can have 1000 files in your project. But only one of them can contain a method called Main.

you mean, we can call any method in the file other than having Main() method from inside the file having Main() method?

Yes, you can.

that means, every time to create new program we have to create new projects first or we can make our new program as part of the existing program inside the same project without defining new main method, right?

Right.


You seem to pose your questions in such a way I only have to give a short answer:D
I send you an example of what you can do, made a console application and added a class file "Dog" to the project, hope this will clear up some things.

If you think your problem is solved, please mark this thread as solved. You don't have to do this for my beautifull eyes, but do it for other users out here.

This article has been dead for over six months. Start a new discussion instead.