不含适合的切入点静态'主'的方法 [英] Does not contain a static 'main' method suitable for an entry point

查看:109
本文介绍了不含适合的切入点静态'主'的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始整理我的code,以天进seperarate的.cs文件,以允许与UI的工作方法继续做,所以我会在同一命名空间下创建的.cs code和公共部分类的名称,这样的方法可能是可互操作的。

I began organizing my code to day into seperarate .cs files, and in order to allow the methods that work with the UI to continue to do so I would create the .cs code under the same namespace and public partial class name so the methods could be inter-operable.

我的头看起来像这样在四个文件,包括我的主要核心文件调用:

My header look like this in four files, including my main core file that calls:

public shell()
{
InitializeComponent(); 
}

那与UI工作(和似乎是造成这个新的冲突)的.cs文件页眉区域:

Header area of .cs files that work with the UI (and seem to be causing this new conflict):

using System;
using System.Windows.Forms;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
using System.Data.SqlServerCe;
using System.Diagnostics;
using System.Threading;
using System.Collections.Specialized;
using System.Net;
using System.Runtime.InteropServices;
using watin = WatiN.Core;
using WatiN.Core.Native.InternetExplorer;
using System.Web; 


namespace WindowsFormsApplication1
{

    public partial class shell : Form
    {

现在,当我尝试调试/ preVIEW我的应用程序(顺便说一句,这是在Visual Studio中Windows应用程序2010防爆preSS)我收到此错误信息:

Now when I try to debug/preview my application (BTW this is a Windows Application within Visual Studio 2010 Express) I get this error message:

Does not contain a static 'main' method suitable for an entry point

我看着在应用程序 - >启动对象的应用程序性能,但它给我提供任何选项。我怎么能告诉开始于有我的InitializeComponent()的cs文件的应用;命令?

I looked in the application properties in Application->Startup object, but it offer me no options. How can I inform the application to begin at the .cs file that has my InitializeComponent(); command?


  • 我到目前为止已经看了看四周没办法解决。

  • 在每一个cs文件的属性设置为编译。

  • 我没有看到一个App.xaml文件在我的解决方案资源管理器中,但我确实看到一个app.config文件。

我还是很新的,这是我在用C#code的组织方法的第一次尝试。

I'm still very new and this is my first attempt at an organizing method with c# code.

推荐答案

我一直在寻找这个问题为好,在我的情况的解决方案是太容易了。我添加了一个新的空项目到解决方案。新添加的项目被自动设置为一个控制台应用程序。但是,由于添加的项目是一个空的项目,没有Program.cs中在新项目的存在。 (如预期)

I was looking at this issue as well, and in my case the solution was too easy. I added a new empty project to the solution. The newly added project is automatically set as a console application. But since the project added was a 'empty' project, no Program.cs existed in that new project. (As expected)

所有我需要做的是改变项目属性的输出类型为类库

All I needed to do was change the output type of the project properties to Class library

这篇关于不含适合的切入点静态'主'的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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