由於微軟提供的更新程式使用不方便,所以又寫了此程式。此程式是本人一年前所寫的一段程式,當時在開發一個CS版本報價系統,當時由於開發過程倉促,代碼可能有點不是太規範此程式編譯後只有一下AutoUpdate.exe檔案與一個設定檔UpdateList.xml,主要通過本地程式與服務端程式檔案的版本號碼來升級與更新本地程式檔案。
UpdateList.xml檔案內容如下:
<?xml version="1.0" encoding="gb2312"?>
<AutoUpdater>
<description>Application autoUpdate</description>
<Updater>
<Url>http://10.0.5.98/SoftUpdate/</Url>
<LastUpdateTime>2005-09-05</LastUpdateTime>
</Updater>
<Application applicationId="ItemSoft">
<EntryPoint>ItemSoft.exe</EntryPoint>
<Location>.</Location>
<Version>1.0.0.0</Version>
</Application>
<Files>
<File Ver="1.0.0.0" Name="ItemSoft.exe" />
<File Ver="1.0.0.0" Name="Reports\test.txt"/>
<File Ver="1.0.0.0" Name="Interop.grproLib.dll"/>
<File Ver="1.0.0.0" Name="Reports\test.grf"/>
</Files>
</AutoUpdater>
說明:
<description></description> 程式的描述;
<Url></Url> 補救伺服器地址,為一個虛擬目錄或網站路徑;
<EntryPoint></EntryPoint> 需要更新主程式檔案,為exe;
<Location>.</Location> 需要更新主程式檔案所在路徑;
<Version>1.0.0.0</Version> 主程式版本號碼;
<Files> </Files> 需要更新的檔案清單;Ver:檔案版本號碼,Name:檔案名稱,包括路徑(相對);
使用時,在補救伺服器上建立Web虛擬目錄或網站,然後將需要更新的檔案與UpdateList.xml放在上面;
本地將AutoUpdate.exe與UpdateList.xml放在主程式的根目錄下。本地UpdateList.xml中的版本號碼如果小於服務端,Bot會自動下載所需要更新的檔案。
本人的完整.Net打包程式下載中所帶的項目中,就使用了此更新程式。
源碼下載:/Files/jenry/AutoUpdate.rar
二進位檔案下載:/Files/jenry/bin.rar
組建組態檔案UpdateList.xml工具:/Files/jenry/AULWriter1.0.rar (由whatisgood 提供,感謝!!)New