pashi

pashi

  • NA
  • 17
  • 0

How to use ClickOnce to Update my application Manually

Apr 14 2007 6:20 AM
Hi all i wanna update my windows applicarion of C#.Net2.0
since VS2005 give Clickonce i've adopted dat to use this, but i am not with the correct outcome, please help me how to update my application.

i have taken a button<named update> and whenever user clicks update it should check for the latest version and should be updated
, whenever i run the below code its asking me to check is ur application is running under click once,

my code,

if (ApplicationDeployment.IsNetworkDeployed)
{
// Hold a reference to the current deployment
ApplicationDeployment currentDeploy = ApplicationDeployment.CurrentDeployment;
// Check to see if an update is available on the server
if (currentDeploy.CheckForUpdate())
{
// One is available, go get it
currentDeploy.Update();
// Make sure you save application state here
DialogResult dr = MessageBox.Show(
"Update downloaded, restart application?",
"Application Update", MessageBoxButtons.YesNo);
if (dr == DialogResult.Yes)
{
Application.Restart();
}
}
}

if (ApplicationDeployment.IsNetworkDeployed)
if i din't use this ApplicationDeployment.IsNetworkDeployed, its giving INVALIDDEPLOYMENTEXCEPTION--Application not installed.
Please help me how to overcome this thing..
Thnx in advance,
prashanth