Page 1 of 1

Automated Updates via ClickOnce/CodePlex Simple way to update your VB.NET/C# applications. Rate Topic: -----

#1 Amrykid   User is offline

  • D.I.C Lover
  • member icon

Reputation: 150
  • View blog
  • Posts: 1,589
  • Joined: 16-December 08

Posted 27 November 2010 - 08:18 AM

In our software world, everything needs a good bug fixin' or too. Operating Systems need updates just as much as our software does. When you release software to the public, users WILL find bugs in it. If theres no means to update it, the users will drop the software and it will be a very long time before they consider try it again. Update functionality is critical to your software in this case.

For a long time, I have release software with no means to auto-update but now, starting with my latest project, I began to provide these updates as a design choice. Usually, I perfer to upload my source code to Github. Instead, I switched back to CodePlex (which I used during the development of Open Studio). Recently, Microsoft implemented ClickOnce support as a means to auto-update software through CodePlex. ClickOnce has been with us since .NET 2.0 but until recently, I always thought of it as a annoyance. I was wrong.

With that, I read Microsoft's Blog post on the subject and immediately jumped into development. Now enough with the talking, lets break out Visual Studio and get started!

NOTE: Getting your project uploaded to CodePlex is beyond the scope of this article but if you already have a project on CodePlex, read on!

Setting up
We will use my latest project, Notepad.NET for this example which is available here. You may know how to create a "release" for the Downloads section, well creating a clickonce package for that release is just an extra step. Before you build your software, you must set it up for updates. Open your project in Visual Studio, go to its settings and go to the publish tab:
Attached Image

Adjust the publish version numbers accordingly. When your done, press Publish Wizard. You will be greeted with a screen like this:
Attached Image
That screen is asking you where do you want the publish files to be saved. Leave it at "publish\" so that we can quickly fetch it when we're done. The next screen will ask you the installation url.
Attached Image

Simply replace "notepadnet" to the url of your codeplex project url. Press Next. This screen will ask you if the application is an online app or a online/offline app. Leave it on Offline like so:
Attached Image

Lastly, it shows us the overview of the publish.
Attached Image
Click finish and navigate to "publish\" which will be in your Solution's directory. Navigate to that folder.
Attached Image

Zip that directory (make sure to have the "setup file" on the top-level of the zip file, this is important or else it will NOT work).
Attached Image

Releasing to the public
Now that the bulk of the work is down, go to your CodePlex site and create a new release.
Attached Image
Under the release name, press 'This is a clickonce release'. That checkbutton will turn into a browse button. Upload your publish zip using that. While we're at it, go into your "publish\" dir, and go through the Application Files directory until you get to your solution's binaries (exes and dlls). Zip that up and then upload that to the standard release section at the bottom. Note, that last bit was completely optional.

Finally, fill in the description/release notes section and press Save at the bottom of the page.

Attached Image

And there you have it. If the user installed your application via ClickOnce as shown above, when ever you publish a new release with a clickonce package, they will be prompted to install the new update. In a later tutorial, I will show you how to create a custom ClickOnce updating GUI instead of the default one.

  • Q: When I go into the application files directory, I only see .deploy files. How do I get the binaries? A: Go to your publish tab -> Updates (or Options, iirc) -> Use .deploy extension.
  • Q: Can I make ClickOnce check for updates after the application starts? A: Go to publish tab -> Updates -> Check for Updates after application starts.
  • Q: Do I have to use CodePlex? A: No, if you can set up a website with FrontPage extensions, you can provide updates from your website.

I hope you enjoyed my tutorial. It was the longest one I have ever written and I hope it will be of great use!

Attached image(s)

  • Attached Image

Is This A Good Question/Topic? 0
  • +

Page 1 of 1