创建空项目怎么编译不过去

.Net技术 码拜 8年前 (2016-06-03) 1144次浏览
创建空项目,添加个类文件,怎么编译不过去

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Project1
{
    class Class1
    {
        public void main(string[] arg)
        {
        }
    }
}
-- 已启动生成: 项目: Project1, 配置: Debug x86 --
错误 CS5001: 程序“C:\Users\Administrator\Desktop\Project1\Project1\obj\x86\Debug\Project1.exe”不包含适合于入口点的静态“Main”方法
编译完成 -- 1 个错误,0 个警告
生成启动时间为 2016/8/21 14:34:52。
ResolveAssemblyReferences:
  将生成 TargetFramework 配置文件排除列表。
GenerateTargetFrameworkMonikerAttribute:
正在跳过目标“GenerateTargetFrameworkMonikerAttribute”,原因是全部输出文件相对于输入文件而言都是最新的。
CoreCompile:
  C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /platform:x86 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\mscorlib.dll" /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\System.Core.dll" /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\System.dll" /debug+ /debug:full /filealign:512 /optimize- /out:obj\x86\Debug\Project1.exe /target:exe Class1.cs "C:\Users\Administrator\AppData\Local\Temp\.NETFramework,Version=v4.0,Profile=Client.AssemblyAttributes.cs"
生成失败。
已用时间 00:00:00.65
========== 生成: 成功或最新 0 个,失败 1 个,跳过 0 个 ==========
解决方案

20

不是说的很清楚了吗:不包含适合于入口点的静态“Main”方法
public void main(string[] arg)
改为
public static void Main(string[] arg)
或另建一个

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明创建空项目怎么编译不过去
喜欢 (0)
[1034331897@qq.com]
分享 (0)