如何在启动程序时更改默认启动程序,但仅限于设置如此?
答案 0 :(得分:2)
<强> Program.cs的强>
[STAThread]
static void Main()
{
//
// read your setting, and store it to a variable, such as "applicationName"
//
Application.EnableVisualStyles();
Application.SetCompatibleRenderingDefault(False);
switch (applicationName)
{
case "firstapp":
Application.Run(new App1());
break;
case "secondapp":
Application.Run(new App2());
break;
default:
Application.Run(new Form1());
break;
}
}
除非我完全错过了这个标记。