Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > Upgrade programs on the go ?
 

Upgrade programs on the go ?

In my organisation I compile the programs in visual studio 2005, (C# programs) and then I place the .exe files in a network share folder where people run them.

The problem is that if someone is running a program I cant copy a new version of it in the same folder, nor can I force them to restart their applications.

Is there a way to

a) upgrade the program in the right folder?

b) have a method to restart their apps?

Razer1911  Wednesday, July 18, 2007 8:41 AM

Hi, Razer1911,

You can use clickonce to deploy your application and it updatesautomatically.

ClickOnce tutorial

http://msdn2.microsoft.com/en-us/library/t71a733d(VS.80).aspx

If you want to update manually,

thenyou don't need to choose "The application should check for updates",

just use some logic to trigger the update.

For example

Code Snippet

private void saveButton_Click(object sender, EventArgs e)

{

if (ApplicationDeployment.IsNetworkDeployed == true)

{

ApplicationDeployment thisDeployment = ApplicationDeployment.CurrentDeployment;

this.Text = "Checking update!";

if (thisDeployment.CheckForUpdate() == true)

{

if (MessageBox.Show("New Version detected, update now?", "Update Now?", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)

{

this.Text = "Updating";

thisDeployment.Update(); //Update here

MessageBox.Show("Done, restart now");

Application.Restart(); //Restart application

}

else

{

this.Text = Application.ProductName + " " + Application.ProductVersion;

}

}

else

{

MessageBox.Show("You have the latest release!");

}

}

else

{

MessageBox.Show("This is not a ClickOnce Application");

}

}

Hopes this helps,

Regards

Hi, Razer1911,

You can use clickonce to deploy your application and it updatesautomatically.

ClickOnce tutorial

http://msdn2.microsoft.com/en-us/library/t71a733d(VS.80).aspx

If you want to update manually,

thenyou don't need to choose "The application should check for updates",

just use some logic to trigger the update.

For example

Code Snippet

private void saveButton_Click(object sender, EventArgs e)

{

if (ApplicationDeployment.IsNetworkDeployed == true)

{

ApplicationDeployment thisDeployment = ApplicationDeployment.CurrentDeployment;

this.Text = "Checking update!";

if (thisDeployment.CheckForUpdate() == true)

{

if (MessageBox.Show("New Version detected, update now?", "Update Now?", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)

{

this.Text = "Updating";

thisDeployment.Update(); //Update here

MessageBox.Show("Done, restart now");

Application.Restart(); //Restart application

}

else

{

this.Text = Application.ProductName + " " + Application.ProductVersion;

}

}

else

{

MessageBox.Show("You have the latest release!");

}

}

else

{

MessageBox.Show("This is not a ClickOnce Application");

}

}

Hopes this helps,

Regards

You can use google to search for other answers

Custom Search

More Threads

• VB application to be run in Win95
• VSTO Installer Stopped Working
• Getting URL of download location?
• Launch a specific ClickOnce version
• Runnning ClickOnce app as Scheduled Task
• Unknown Deployment Server During Bootstrapper Construction
• Placing Shortcut That Can Be Accessed by All Users
• Changing the Webpage the Application is Run From
• A update problem with ClickOnce
• How to copy all files in a directory during custom install