您的位置:首页 > 其它

关于程序本身启动更新程序完成更新后再启动自己的源码

2008-07-28 12:45 337 查看
using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace Start
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
string appPath = Application.StartupPath;
AppDomainSetup startSetup = new AppDomainSetup();

startSetup.ApplicationBase = @"F:/MyProjects/Update/Update/bin/Debug";
startSetup.ApplicationName = "AutoUpdate";
startSetup.PrivateBinPath = @"F:/MyProjects/Update/Update/bin/Debug";

AppDomain startDomain = AppDomain.CreateDomain("start", null, startSetup);
startDomain.ExecuteAssembly(startSetup.ApplicationBase+"//Update.exe");
AppDomain.Unload(startDomain);

try
{
AppDomain auditDomain = AppDomain.CreateDomain("AuditBuilder", null, startSetup);
auditDomain.ExecuteAssembly("AuditBuilder.exe");
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
}
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: