vb.netvisual-studiocommand-promptcommandparameter

Argument To Input Into VS12.0 Command Prompt To Open To a Specific Line Number vb.net


I'm looking to write some code to open the visual studio command prompt and move to a specific line number. Here's what I've gotten so far:

Process.Start("C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts\Developer Command Prompt for VS2013.lnk", "/K devenv /edit FileLocation /command ""edit.goto LineNumber""")

Command prompt opens up but I've having trouble making an argument. The command:

devenv /edit FileLocation /command "edit.goto LineNumber"

works on the command prompt, but I'm not sure how to input this command into vb.net using process.start()


Solution

  • First of all, don't use shortcuts to locate programs.

    You should find Visual Studio's directory, instead, then execute it from there. For example, mine is located in C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE.

    For example:

    Process.Start("C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe", "/edit ""FileLocation"" /command ""edit.goto LineNumber""")

    This way you don't have to rely on the existence of the shortcut.