实现方式:
1)程序启动,检测版本
2)有新的版本,是否更新
3)运行更新程序,退出原程序
private
void
Test()
{
DialogResult dr = MessageBox.Show( " 有新版本,是否现在更新? " , " 在线更新 " , MessageBoxButtons.YesNoCancel);
if (dr == DialogResult.Yes)
{
ShowUpdate();
}
}
private void ShowUpdate()
{
try
{
// 运行程序的路径
string update = Application.StartupPath + " /MyUpdate.exe " ;
Process proc = new Process();
proc.StartInfo.FileName = update;
proc.StartInfo.Arguments = "" ;
proc.Start();
// 关闭更新程序
this .Close();
}
catch { }
}
{
DialogResult dr = MessageBox.Show( " 有新版本,是否现在更新? " , " 在线更新 " , MessageBoxButtons.YesNoCancel);
if (dr == DialogResult.Yes)
{
ShowUpdate();
}
}
private void ShowUpdate()
{
try
{
// 运行程序的路径
string update = Application.StartupPath + " /MyUpdate.exe " ;
Process proc = new Process();
proc.StartInfo.FileName = update;
proc.StartInfo.Arguments = "" ;
proc.Start();
// 关闭更新程序
this .Close();
}
catch { }
}
更新实现步骤:
1、下载xml文件列表

2、解析xml文件,循环xml中的节点,下载文件
///
<summar