C#错误I:// XXXXXXX /不包含main [英] C# error I://XXXXXXX/ does not contain main

查看:88
本文介绍了C#错误I:// XXXXXXX /不包含main的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此错误

Error	1	Program 'i:\Desktop\WindowsFormsApplication3\obj\Debug\thomasapp.exe' does not contain a static 'Main' method suitable for an entry point	I:\Desktop\WindowsFormsApplication3\CSC	WindowsFormsAplication3

不会停止弹出,我一直在做一个项目。任何人都可以帮我解决这个问题我试试这个 fourm。 ^ 但它根本不起作用!!!

will not stop popping up and I have been working on a project. Can anyone help me fix this I have try this fourm.^ but it never worked at all!!!

推荐答案

看看你得到的回复,你的评论看起来你的项目都不是可执行的 - 所以你为什么要生成一个无法执行的EXE文件?如果你正在生产类库(如它所示)那么你应该生成.DLL文件。



之后,我假设你正在尝试构建你的项目通过按F5 - 尝试执行启动项目 - 在这种情况下,这两个项目都不是。

要么:

1)添加静态Main方法报告问题和退出:

Looking at the response you got at SO, and your comment it look like neither of your projects is intended to be executable - so why are you producing an EXE file that cannot be executed? If you are producing Class libraries (as it suggests) then you should be producing .DLL files instead.

After that, I assume that you are trying to build your projects by pressing F5 - which tries to execute the Startup Project - which in you case is neither of these two projects.
Either:
1) Add a static Main method which reports a problem and exits:
[STAThread]
static void Main() { Console.WriteLine("This program is not executable"); }





2)将可执行程序项目添加到您的解决方案并将其设置为启动项目。



我自己,我会选择第二个选项并将其作为测试平台来测试其他两个项目......


Or
2) Add an executable program project to your solution and set it as the Startup project.

Myself, I'd go with the second option and use it as a "testbed" to test the other two projects...


这篇关于C#错误I:// XXXXXXX /不包含main的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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