Automatically update a C# Windows Forms applicatio

2020-04-19 04:57发布

问题:

I want my application to automatically check for updates and update the application if needed. I installed InstallShield Limited edition, but when I went to the update section I found out that I need to install FlexNet which requires me to purchase it.

I found out that Windows has stopped supporting Windows Installer which is why in Visual Studio 2013 it's not listed in the setup and deployment section.

I also read about ClickOnce, but there is a small issue when I tried to deploy my application to the FTP server. It asked for the username and password, but it added a warning that these values will be in plain text! So, what should I do? Is there another third-party way of creating an installer and setting up automatic updates?

回答1:

I've used ClickOnce with dozens of applications and have never seen the username/password prompt. My process is:

  1. Declare the application is downloaded from "http://www.yourSite.com/yourApp/"
  2. Publish to folder "yourApp" in whatever location you want
  3. Drag and drop that whole folder into your WWW space on your server
  4. Email your users the link "http://www.yourSite.com/yourApp/yourApp.application"

For updates, just repeat this same process (except emailing users), and everything else takes care of itself. Be sure check the box in your application settings that tells it to check for updates of course. I've used ClickOnce with dozens of applications and have never seen the username/password prompt. My process is:

  1. Declare the application is downloaded from "http://www.yourSite.com/yourApp/"
  2. Publish to folder "yourApp" in whatever location you want
  3. Drag and drop that whole folder into your WWW space on your server
  4. Email your users the link "http://www.yourSite.com/yourApp/yourApp.application"

For updates, just repeat this same process (except emailing users), and everything else takes care of itself. Be sure check the box in your application settings that tells it to check for updates of course.



回答2:

The prompt about the username and password only applies during the deployment. So I wouldn't deploy the app using FTP in a Starbucks using their Wi-Fi, but it should be fine at work or on your private network at home.



回答3:

Consider looking:

  • How to: Manage Updates for a ClickOnce Application
  • How to: Check for Application Updates Programmatically Using the ClickOnce Deployment API

You can distribute your application using a webserver, even your application can run from a link in a web page.

And also you can check for update using code.