在C#编辑器中构建文件 [英] building a file in C# editor

查看:70
本文介绍了在C#编辑器中构建文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在C#编辑器中构建文件时,这就是我得到的错误.我该怎么办?

when i build my file in C# editor this is the error i m getting.What should i do?

>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

推荐答案

您有多个名为"Main"的静态方法.在代码中搜索名为"Main"的静态方法,然后删除或重命名该多余的方法.

Main方法是C#控制台应用程序或Windows应用程序的入口点. (库和服务不需要Main方法作为入口点.)启动应用程序时,Main方法是第一个被调用的方法.

http://msdn.microsoft.com/en-us/library/acy3edy3 (v = vs.110).aspx [
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[^]


您的项目C:\Users\Akshara\Documents\Visual Studio 2008\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs中有两个主程序,其中第10行的Main(),而c:\users\akshara\documents\visual studio 2008\projects\consoleapplication1\consoleapplication1\program1.cs在第6行有Main().删除不需要的.
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.


这篇关于在C#编辑器中构建文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆