Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
when i build my file in C# editor this is the error i m getting.What should i do?

C#
>Error	1	Program 'C:\Users\Akshara\Documents\Visual Studio 2008\Projects\ConsoleApplication1\ConsoleApplication1\obj\Debug\ConsoleApplication1.exe' has more than one entry point defined: 'ConsoleApplication1.Program.Main(string[])'.  Compile with /main to specify the type that contains the entry point.	C:\Users\Akshara\Documents\Visual Studio 2008\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs	10	21	ConsoleApplication1

>Error	2	Program 'C:\Users\Akshara\Documents\Visual Studio 2008\Projects\ConsoleApplication1\ConsoleApplication1\obj\Debug\ConsoleApplication1.exe' has more than one entry point defined: 'ConsoleApplication1.Program1.Main(string[])'.  Compile with /main to specify the type that contains the entry point.	c:\users\akshara\documents\visual studio 2008\projects\consoleapplication1\consoleapplication1\program1.cs	6	15	ConsoleApplication1
Posted
Updated 10-Jul-12 4:01am
v2
Comments
Sergey Alexandrovich Kryukov 10-Jul-12 15:51pm    
What does it mean "build my file in C# editor"? Which file?
--SA

You have more than one static method named "Main". Search in your code for static methods named "Main", and remove or rename the extra.

The Main method is the entry point of a C# console application or windows application. (Libraries and services do not require a Main method as an entry point.). When the application is started, the Main method is the first method that is invoked.

http://msdn.microsoft.com/en-us/library/acy3edy3(v=vs.110).aspx[^]
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 10-Jul-12 15:52pm    
Sure, a 5.
--SA
Manas Bhardwaj 11-Jul-12 5:56am    
Thx SA!
Prasad_Kulkarni 11-Jul-12 5:35am    
+5!
Manas Bhardwaj 11-Jul-12 5:56am    
Thx!
You have two main programs in your project C:\Users\Akshara\Documents\Visual Studio 2008\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs which has Main() at line 10, and c:\users\akshara\documents\visual studio 2008\projects\consoleapplication1\consoleapplication1\program1.cs which has Main() at line 6. Remove the one that you do not want.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900