Kevin Dente ponders on Twitter:
This is something I’ve been meaning to do for a while, as often I’ll open a Web Application in Visual Studio configured to run under IIS and be met with the following:
Running anything elevated is easy, you just need to call ShellExecute (the .NET equivalent is System.Diagnostics.Process.Start) with the “RunAs” verb, so it’s simply a matter of starting Visual Studio’s devenv.exe passing the path to the current solution.
So here goes: copy and paste this into a Macro Module (ALT+F11) then wire up to a toolbar button as appropriate:
Sub ElevateVisualStudio() Dim slnPath As String = DTE.Solution.FullName DTE.Solution.Close(True) Dim startInfo As New System.Diagnostics.ProcessStartInfo(DTE.FullName, slnPath) startInfo.Verb = "RUNAS" System.Diagnostics.Process.Start(startInfo) DTE.Quit() End Sub
Works On My Machine™, etc and only tested on Visual Studio 2008.
One thought on “Macro to Restart Visual Studio Elevated”
Lots of of people write about this issue but you said really true words!!