CopyMinder Knowledge Base
Browse By Category: | Look Up Error Number: | Search: |
Glossary | Contact Us |
CMInstall with Microsoft ClickOnce
Views: 1691
Rating: 14
Rating: 14
Rate It:
This is some code kindly donated to us by a CopyMinder user who wanted to run CMInstall.exe from ClickOnce.
We hope you find it useful.
if (ApplicationDeployment.IsNetworkDeployed) { // This is a clickonce application ApplicationDeployment deployment = ApplicationDeployment.CurrentDeployment; if (deployment.IsFirstRun) { // is the first run of THIS version of the application if (!IsAdminRole()) MessageBox.Show("This application must be initialised first. You might be prompted by Windows to elevate to " + "Adminstrator level, please accept in that case."); System.Diagnostics.Process process = new System.Diagnostics.Process(); process.StartInfo.FileName = "CMInstall.exe"; process.StartInfo.WorkingDirectory = System.IO.Directory.GetCurrentDirectory(); process.StartInfo.Arguments = "/k"; process.Start(); do { } while (!process.WaitForExit(200)); if (process.ExitCode != 0) { MessageBox.Show("Please report the following CMInstall error code: " + process.ExitCode.ToString()); System.Windows.Application.Current.Shutdown(); return; } } }
More Help
If this article did not help you to solve your problem, please use the menu at the top of the page to browse or search more articles, or to contact our support team.
Others in this Category