Tuesday, March 03, 2009

Programs that launch (or should launch) Visual Studio

Programs such as FxCop provide links to source files that can be clicked and then edited in Visual Studio. 

FxCop recently (probably since I went 64bit, but also possibly a side-effect of running Windows 7) started failing when clicking these links.  It said:

Could not start Microsoft Visual Studio. Try specifying an alternate source code editor in Application Settings.

Maybe it just looks in \Program Files\Microsoft Visual Studio\[whatever version].  Anyway, I couldn’t see anything in the event log or any local FxCop logs, so I just changed the setting under Tools\Settings to use an explicit path to devenv.exe.

This worked, although it started a new instance of the IDE for every file.  To get around that, you need to use the /Edit argument.  Here’s what it looks like (click to make it bigger):

sshot-2

There’s other handy switches, some of which I knew about, like building a particular project/solution (to get the full list, run devenv.exe /?).   It now uses an existing instance of Visual Studio if one’s present, otherwise it starts one up. 

1 comment:

Anonymous said...

Thanks for the tip. It looks like it opens the correct document but does not go straight to the line number. For more complete solution see http://stackoverflow.com/questions/350323/open-a-file-in-visual-studio-at-a-specific-line-number