2015-04-29 58 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