Some Visual Studio Tips


Here are a few non-trivial
tips for .NET developers. The first ones are from the excellent blog of Sara
If you don’t know her work, I would advise you should go and also read her
book: Visual Studio Tips which is a collection of here first 250 tips. Sara is a
tester in the VS team and her passion is to discover and spread the word about
advanced VS tips. I learned plenty of tricks but here are some that positively
affect my habits:



Also, I have 2 tricks that
my colleagues found useful to learn so I wanted to spread the word:


When you are debugging an
application you can use the cool possibility to set a conditional breakpoint.



But what if you want the
same facility on a non-currently-debugged
process? This situation happens especially when debugging a multi-process
application. You might want to debug a process in a particular situtation while
doing smoke-tests. You just have to use
a temporary Debug.Assert( put your condition here ).
Simple but efficient! The only risk is to forget to remove this assertion. Not such
a big deal since assertions are absent in release code but still. Personally I
took the habit to put a // TODELETE
comment tag and then check before each release is such a tag is in the code.




Another trick relevant if
you have several VS solutions opened. One source file you are currently
debugging in VS instance A might not be part of the VS solution currently
opened. Thus you would like to open the source file from VS instance B that
contains the parent VS solution. For such situation you can copy the full path
of the source file in VS instance A…




…and then open it
(Ctrl+O) from VS instance B. Also, in case you didn’t
know, pasting the full path and then click open just works.


This entry was posted in Uncategorized. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • mendicant

    As opposed to the Clipboard Ring, I much prefer the app ClipX ( which has a few neat plugins, as well as the ability to persist between shutdowns.

    Plus it works in all apps, not just VS.

  • Kyle Baley

    One I use often is to bind Ctrl+Shift+D to Debug.AttachToProcess for web applications. Press Ctrl+Shift+D, then press w to get to the w3wp process. Then I can refresh whatever page I’m on in Firefox or IE and have it hit the debugger. Much faster than launching the web application each time with F5. Can’t take credit for discovering it but I also can’t remember where I found it.

  • Patrick Smacchia

    YanYg, I would say that most of these tips shoud work with VC++ and VB.NET environement also, just try them.

  • YanYg

    I definetely didn’t know these. Thank you very much. But although I don’t code in c# can I use these ? (I use vc++)