Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio: How to open file from Windows command line to specific line in running instance of VS?

Unfortunately, it is impossible to use the Windows command line to open a file in an already-running instance of Visual Studio at a specific line number. (VS 2008)

Open a file in Visual Studio at a specific line number shows a command-line parameter combination that fails, and presents code for an executable that can be called instead at the command line - but this code does not build out-of-the-box in VS 2008.

Does anyone know of a workaround (such as a VS macro) that is able to accomplish this very basic task?

like image 790
Dan Nissenbaum Avatar asked Jul 10 '10 13:07

Dan Nissenbaum


People also ask

How do I open a Visual Studio solution from the command line?

start MySolution/MySolution. sln and hit Enter . This will open whatever version of Visual Studio you currently have set to open with . sln files in Windows.

How do I run a specific file in command prompt?

Type "start [filename.exe]" into Command Prompt, replacing "filename" with the name of your selected file. Replace "[filename.exe]" with your program's name. This allows you to run your program from the file path.


1 Answers

If you can upgrade to VS2008 SP1, then Fouré Olivier's answer should work to open a file in an existing instance of Visual Studio:

devenv /edit FILE_PATH

For other solutions similar to the answer you linked to, there's a similar perl script here and a python plugin here (see dte_put_file). Both are for use with vim, but you could fix them up to work for anything. (I haven't used either of them.)

like image 159
idbrii Avatar answered Oct 13 '22 00:10

idbrii