2015-04-29 60 views
-1

我想在我的應用程序中包含一個軟件更新,用於檢查共享位置或URL,例如Google Drive中用於替換舊.exe和配置文件的共享URL。如果有新的更新可用,那麼用戶應該收到通知等。有人可以指導我如何實現這一點,或者如果這是可行的?使用C#更新軟件時更新軟件

+0

https://autoupdaterdotnet.codeplex.com/ –

+0

http://netsparkle.codeplex.com/ –

+0

@MortenFrederiksen不容易編寫作爲答案? – csharpwinphonexaml

回答

3

這是完全可行的。

有一種解決方案叫做ClickOnce,它可以在每次啓動時檢查更新。

另一種方式是有另一個程序,這將是您的更新,因爲Windows將不允許您覆蓋打開的文件(主程序可以更新更新)

不過,我會建議的Dropbox的公用文件夾託管文件,它擁有的GDrive恕我直言幾個優點(直接下載鏈接(GDrive的共享鏈接重定向到一個下載頁面,GDrive的主機URL不會報告下載的文件大小))

編輯:要與使用的ClickOnce Dropbox的公共文件夾按照以下步驟操作:

(我假設你已經安裝了Dropbox的同步客戶端)

1. (not mandatory if you plan to host only one project) create a subfolder in your dropbox public folder :) 
2. Open your project's properties go in the "Properties tab" 
3. The first box is where you will publish your application (select the folder created in 1) 
4. The second box is where the installer/updater will fetch the files, this one is a little trickier. 
    4.1. Create a file in the folder created in 1 
    4.2. Wait for it to be synchronised... Right-click on it, then click on "Copy public link" 
    4.3. Paste the link in the second box (back in VS) 
    4.4. Remove the file name from the path you just pasted 
5. Click on the "Updates" button then tick the checkbox "THe application must check for updates" then choose if you want the updates to be downloaded before or after the application launch. 

這就是它的基本配置。

還有其他的可能性,但它不是這裏的主題:)

+0

謝謝你,這真的很有幫助。我會和其他人剛剛發佈的一樣。如果您有使用Dropbox網址進行點擊一次的示例代碼,請介意分享? – svb

+0

這是抓住:) ClickOnece不需要一行代碼:) 進入你的項目的屬性,檢查發佈標籤.....這是ClickOnce配置。 – Sidewinder94

+0

從本質上講,我需要像autoupdaterdot net這樣的一次點擊配置將不允許它被完成,因爲應用程序將被打開。這是否意味着我必須包含類似.bat文件的東西,並在下載完成後調用它? – svb