开发者

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.

开发者_StackOverflow社区Does anyone know of a workaround (such as a VS macro) that is able to accomplish this very basic task?


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.)


The answer (months later): It cannot be done. (Not without writing a tedious script - and such a script cannot be straightforwardly, if at all, found on the internet.)

Therefore, it is true that Microsoft has simply not implemented this very basic feature into the IDE.

I do not know if this feature has been implemented in VS 2010.

The lack of this feature makes it impossible to conveniently use the IDE as an editor in conjunction with 3rd-party search tools (such as PowerGREP).

Sad.


Here is VBS script (Windows supports VBScript natively - no need for compilation or any additional interpreters)

open-in-msvs.vbs full-path-to-file line column

It opens full-path-to-file:line:column in running instance of MSVS or starts new one.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜