ClickOnce issues

I’m having a fair amount of trouble with ClickOnce, now I’m actually using it. I’m researching how updates can be user initiated. Some problems are simply solved be restarting Visual Studio 2005.One problem however is a bit less obvious.
It’s real easy to reproduce the error. Create a new project, preferably a Windows Application. Now add a new reference to System.Deployment and add the following using statement to your form.
using System.Deployment.Application; Add a button to the new form, double click it and add the following code.
if (ApplicationDeployment.IsNetworkDeployed) {       ApplicationDeployment appDeploy = ApplicationDeployment.CurrentDeployment;       if (appDeploy.CheckForUpdate())       {             MessageBox.Show("Updating app, when done, I’ll restart.");             appDeploy.Update();             Application.Restart();       } }  
Now go to your project properties, to the *Publish* tab and choose the *Updates* button. Then disable the “The application should check for updates” checkbox. This way, we can specify when the application should update ourselves.
Now publish the application, install it from the webpage and it’ll run automatically. Press the button and you’ll be presented with a great dialog box, but not our own!
Application cannot be updated programmatically unless the deployment manifest includes the element.
That’s the error you’ll be presented with. To fix it, go to the publish tab in your project configuration again, press the *Updates* button and specify an update location. This location should only be specified if the publish location is different, but specify the exact same location, publish, install via web page, run the app and press the button again. You’ll see your problem is fixed.
In another post I’ll talk a bit more about security issues in ClickOnce, as this puzzled me a bit as well. Although there’s extensive documentation, most just lightly touched the subject I wanted more info about.