我现在做的是由更新程序来更新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
{