1
votes

I can call Process.Start(filename.sln) and it launches VisualStudio with that solution.

But doing so using ProcessStartInfo with Verb="runas" and I get an exception. Even with UseShellExecute=true.

Is there a way to launch an app running as admin where I pass it the app's data file and don't have the application.exe filename?

2

2 Answers

0
votes

Found the answer - when you run as admin you can only give it the executable file, not the app for the program to run. So you have to pass devenv.exe, not filename.sln

0
votes
ProcessStartInfo processInfo = new ProcessStartInfo(); //new process class
processInfo.Verb = "runas"; //wanna admin rights
processInfo.FileName = sDevPath + "devenv.exe"; //exe file path
processInfo.Arguments = sPrjPath + "mConverter.sln"; //sln file as argument
try
{
  Process.Start(processInfo); //try to start
}
catch (Win32Exception)
{
  //oops
}