Developer, Former MVP, now at Microsoft - Best of 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
"$(DevEnvDir)..\..\Common7\Tools\Bin\mt.exe" -manifest "$(ProjectDir)$(TargetName).exe.manifest" –outputresource:"$(TargetDir)$(TargetFileName)";#1
private void LaunchElevatedProcess(){ ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.UseShellExecute = true; // default, but be explicit startInfo.WorkingDirectory = Environment.CurrentDirectory; //or other if you prefer startInfo.FileName = @"some_path_to.exe"; //// if the other process did not have a manifest //// then force it to run elevated //startInfo.Verb = "runas"; // Two lines below make the UAC dialog modal to this app startInfo.ErrorDialog = true; startInfo.ErrorDialogParentHandle = this.Handle; try { Process p = Process.Start(startInfo); // block this UI until the launched process exits // I.e. make it modal p.WaitForExit(); } catch(Exception ex) { // user cancelled MessageBox.Show(ex.Message, "caught it!"); //for demo purposes return; }}