Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open file in current instance of Visual Studio when running under different credentials

I work on a project which is hosted in IIS, and therefore in order to debug this site I have to run Visual Studio as an administrator.

The problem is, when opening a file in Windows Explorer, I would like to open it in the current instance of Visual Studio (or a new instance if that is not the case).

I've had partial success, using a batch file with the following contents:

cd "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE" devenv /Edit %1

However, this opens Visual Studio as the currently logged-in user, and NOT as Administrator (so when I have an instance already open as administrator it opens a new instance anyway).

So the question is; how can I have the file open in the current instance, as Administrator?

like image 362
Adam Drewery Avatar asked Nov 01 '22 03:11

Adam Drewery


1 Answers

  1. Shift+right-click on the file in Explorer
  2. Press 'a' on the popup menu (selects Copy As Path)
  3. Switch to Visual Studio
  4. Press Ctrl+O then Ctrl+V then Enter

You could probably make some kind of AutoHotkey script to automate it, depending on how often you need to do this.

like image 105
demoncodemonkey Avatar answered Nov 17 '22 01:11

demoncodemonkey