release生成的exe不能用,因为程序主入口点Application.Run()参数改成了getInstance。

mrnian2008 2009-04-07 09:21:08
入口点Application.Run(new Form1())改为如下代码中的Application.Run(Form1.getInstance()),然后release出来的exe文件就无法执行了。

 static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(Form1.getInstance());
}
}


其中Form1.getInstance()在Form1.cs中定义如下:

private static Form1 instance = new Form1();

public static Form1 getInstance()
{
return instance;
}

请高手指教!
...全文
105 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
sxmonsy 2009-04-07
  • 打赏
  • 举报
回复
试试回贴
iGouzy 2009-04-07
  • 打赏
  • 举报
回复
这句话注释掉就可以了
//Application.SetCompatibleTextRenderingDefault(false);



怫悰 2009-04-07
  • 打赏
  • 举报
回复
提示什么错误?
mrnian2008 2009-04-07
  • 打赏
  • 举报
回复
2楼正解

111,126

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧