CopyMinder Knowledge Base
Browse by Category: | Lookup Error Number: | Search: |
Glossary | Contact Us |
CMInstall with Microsoft ClickOnce
Views: 1589
Rating: 14
Rating: 14
Rate It:
Print
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; } } }
Others in this Category