how to work with ClickOnce for automatic updation
-
hi all i want to update my application with a prompt for that. i found Clickonce is very good, and tried alot to understand, see could able to publish and make the new versions, but my requirement is whenver user opens my applicaions and connected to internet i need to promt him saying u r working with olderversio(1.0 and current version 3.0 is available) if user clicks ok it should be updated please help me how to do so thnx in advance
prashanth, s/w Engineer, Syfnosys.
-
hi all i want to update my application with a prompt for that. i found Clickonce is very good, and tried alot to understand, see could able to publish and make the new versions, but my requirement is whenver user opens my applicaions and connected to internet i need to promt him saying u r working with olderversio(1.0 and current version 3.0 is available) if user clicks ok it should be updated please help me how to do so thnx in advance
prashanth, s/w Engineer, Syfnosys.
This info must be available in lots of places, but here it goes (in short)... To publish the initial application: 1. Right click on the Project in solution explorer. Click Properties. Click the Publish tab. 2. Enter the location you want to publish to in 'Publishing location' 3. Click the 'Updates' button. 4. Check the 'Application should check for updates' checkbox. 5. Check the 'Before the application starts' radio button. 6. Click OK to close the dialog. 7. Back on the main screen, select 'The application is available offline as well' 8. Enter your initial publish version under 'Publish Version' 9. Click the 'Publish Now' button. To publish an update: If you want to publish an optional update, just increment the 'Publish Version' and click the 'Publish Now' button. When starting the application the user will be prompted if the update should be installed. The user has the option to skip the update. If you want to publish a required update, increment the 'Publish Version'; then, click the 'Updates' button. In the dialog, check the 'Specify a minimum required version for...' checkbox. Enter the same version you just entered in 'Publish Version'. Click OK to close the dialog. On the main screen, click the 'Publish Now' button. The update will automatically install as soon as the user starts the application. Hope this helps, Roel
-
This info must be available in lots of places, but here it goes (in short)... To publish the initial application: 1. Right click on the Project in solution explorer. Click Properties. Click the Publish tab. 2. Enter the location you want to publish to in 'Publishing location' 3. Click the 'Updates' button. 4. Check the 'Application should check for updates' checkbox. 5. Check the 'Before the application starts' radio button. 6. Click OK to close the dialog. 7. Back on the main screen, select 'The application is available offline as well' 8. Enter your initial publish version under 'Publish Version' 9. Click the 'Publish Now' button. To publish an update: If you want to publish an optional update, just increment the 'Publish Version' and click the 'Publish Now' button. When starting the application the user will be prompted if the update should be installed. The user has the option to skip the update. If you want to publish a required update, increment the 'Publish Version'; then, click the 'Updates' button. In the dialog, check the 'Specify a minimum required version for...' checkbox. Enter the same version you just entered in 'Publish Version'. Click OK to close the dialog. On the main screen, click the 'Publish Now' button. The update will automatically install as soon as the user starts the application. Hope this helps, Roel
Thnx alot Mr.Roel I found ur help on click once is useful, but here i have a doubt about my current Error: INVALIDDEPLOYMENTEXEPTION, saying "Application in not installed" Here i have taken a button[Update] and when user clicks the buttion the functionality should checks the updated version and if available it should download the latest version for that my code is,, in Buttion private void button1_Click(object sender, EventArgs e) { if (ApplicationDeployment.IsNetworkDeployed) { ApplicationDeployment appDeploy = ApplicationDeployment.CurrentDeployment; bool update = appDeploy.CheckForUpdate(); if (update) { UpdateCheckInfo updateInfo = appDeploy.CheckForDetailedUpdate(); string version = updateInfo.AvailableVersion.ToString(); bool updateRequired = updateInfo.IsUpdateRequired; string minVersion = ""; if (updateInfo.MinimumRequiredVersion!=null) minVersion = updateInfo.MinimumRequiredVersion.ToString(); bool updateAvail = updateInfo.UpdateAvailable; long footprint = updateInfo.UpdateSizeBytes; StringBuilder sb = new StringBuilder(); sb.AppendFormat("Update Version: {0}\r\n", version); sb.AppendFormat("Minimum Version: {0}\r\n", minVersion); sb.AppendFormat("Update Required: {0}\r\n", updateRequired); sb.AppendFormat("Update Available: {0}\r\n", updateAvail); sb.AppendFormat("Update Footprint: {0} bytes\r\n", footprint); MessageBox.Show(sb.ToString()); if (updateAvail) { bool updated = appDeploy.Update(); if (updated) Application.Restart(); } } else MessageBox.Show("No updates are available."); } else { MessageBox.Show("This application was not launched using ClickOnce. Cannot perform update."); } } in PageLoad private void Form1_Load(object sender, EventArgs e) { if (ApplicationDeployment.IsNetworkDeployed) { ApplicationDeployment appDep
-
Thnx alot Mr.Roel I found ur help on click once is useful, but here i have a doubt about my current Error: INVALIDDEPLOYMENTEXEPTION, saying "Application in not installed" Here i have taken a button[Update] and when user clicks the buttion the functionality should checks the updated version and if available it should download the latest version for that my code is,, in Buttion private void button1_Click(object sender, EventArgs e) { if (ApplicationDeployment.IsNetworkDeployed) { ApplicationDeployment appDeploy = ApplicationDeployment.CurrentDeployment; bool update = appDeploy.CheckForUpdate(); if (update) { UpdateCheckInfo updateInfo = appDeploy.CheckForDetailedUpdate(); string version = updateInfo.AvailableVersion.ToString(); bool updateRequired = updateInfo.IsUpdateRequired; string minVersion = ""; if (updateInfo.MinimumRequiredVersion!=null) minVersion = updateInfo.MinimumRequiredVersion.ToString(); bool updateAvail = updateInfo.UpdateAvailable; long footprint = updateInfo.UpdateSizeBytes; StringBuilder sb = new StringBuilder(); sb.AppendFormat("Update Version: {0}\r\n", version); sb.AppendFormat("Minimum Version: {0}\r\n", minVersion); sb.AppendFormat("Update Required: {0}\r\n", updateRequired); sb.AppendFormat("Update Available: {0}\r\n", updateAvail); sb.AppendFormat("Update Footprint: {0} bytes\r\n", footprint); MessageBox.Show(sb.ToString()); if (updateAvail) { bool updated = appDeploy.Update(); if (updated) Application.Restart(); } } else MessageBox.Show("No updates are available."); } else { MessageBox.Show("This application was not launched using ClickOnce. Cannot perform update."); } } in PageLoad private void Form1_Load(object sender, EventArgs e) { if (ApplicationDeployment.IsNetworkDeployed) { ApplicationDeployment appDep
-
hi all i want to update my application with a prompt for that. i found Clickonce is very good, and tried alot to understand, see could able to publish and make the new versions, but my requirement is whenver user opens my applicaions and connected to internet i need to promt him saying u r working with olderversio(1.0 and current version 3.0 is available) if user clicks ok it should be updated please help me how to do so thnx in advance
prashanth, s/w Engineer, Syfnosys.
-
Are you sure you selected 'The application is available offline as well' on the publish tab when you published it? Roel
yes i am sure, i've selected 'The application is available offline as well' and can u please help me , how to work with Deployment.[ApplicationDeployment appDeploy = ApplicationDeployment.CurrentDeployment;] i couldn't create instance to ApplicationDeployment , please tell me whatz all the credentials needed to create an instance to ApplicationDeployment . thnx in advance
prashanth, s/w Engineer, Syfnosys.
-
yes i am sure, i've selected 'The application is available offline as well' and can u please help me , how to work with Deployment.[ApplicationDeployment appDeploy = ApplicationDeployment.CurrentDeployment;] i couldn't create instance to ApplicationDeployment , please tell me whatz all the credentials needed to create an instance to ApplicationDeployment . thnx in advance
prashanth, s/w Engineer, Syfnosys.
The ApplicationDeployment class does not have a constructor, so you can't create an instance of it. The only way to get an instance is to use the static CurrentDeployment property. No offense, but I do suggest you start looking at the documentation rather than asking basic questions like this on the forum. The forum really is meant to get answers to things you can't readily figure out from the documentation. The entire .NET framework documentation is available online. See for example: http://msdn2.microsoft.com/en-us/library/system.deployment.application.applicationdeployment.currentdeployment.aspx[^] Best regards, Roel