winform应用程序自动更新版本

本文介绍了一种通过update.exe来更新WinForm应用程序的方法,首先创建包含版本信息的update.xml文件,然后update.exe会检查并下载更新文件,如果发现新版本,会停止当前运行的WinForm程序并进行升级。整个过程涉及到版本比较、文件下载和程序替换。
摘要由CSDN通过智能技术生成

我现在做的是由更新程序来更新winform程序,但是最后的目的是想winform自己本身能够更新吧,还是没找到好的方法,现记录下有update.exe来更新winform.exe。

1.先建一个记录有版本信息的xml文件,update.xml

其中的代码如下:

<root xmlns="">
  <module>
    <moduleName>BLL.dll</moduleName>
    <version>4.0</version>
    <appUrl>http://10.77.150.105:7003/webservice/Release/BLL.dll</appUrl>
  </module>
  <module>
    <moduleName>DAL.dll</moduleName>
    <version>4.0</version>
    <appUrl>http://10.77.150.105:7003/webservice/Release/DAL.dll</appUrl>
  </module>
  <module>
    <moduleName>winform.exe</moduleName>
    <version>4.0</version>
    <appUrl>http://10.77.150.105:7003/webservice/Release/demo.exe</appUrl>
  </module>
  <module>
    <moduleName>Model.dll</moduleName>
    <version>4.0</version>
    <appUrl>http://10.77.150.105:7003/webservice/Release/Model.dll</appUrl>
  </module>
  <module>
    <moduleName>RdCard.dll</moduleName>
    <version>4.0</version>
    <appUrl>http://10.77.150.105:7003/webservice/Release/RdCard.dll</appUrl>
  </module>
  <module>
    <moduleName>sdtapi.dll</moduleName>
    <version>4.0</version>
    <appUrl>http://10.77.150.105:7003/webservice/Release/sdtapi.dll</appUrl>
  </module>
  <module>
    <moduleName>WltRS.dll</moduleName>
    <version>4.0</version>
    <appUrl>http://10.77.150.105:7003/webservice/Release/Wltrs.dll</appUrl>
  </module>
</root>

update.xml是放在已经部署的webservice文件夹下的。

下面是update.exe代码:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.IO;

namespace Update
{
    public partial class Form1 : Form
    {

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值