Tips and Tricks for Using Visual Studio.Net Effectively


Published on

Some tips and tricks to use visual more productively and pleasantly

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Tips and Tricks for Using Visual Studio.Net Effectively

  1. 1. Microsoft Visual Studio.Net Tips and Tricks to save you 10 minutes a day Wei Li 09/2006
  2. 2. If I had eight hours to chop down a tree, Id spend six sharpening my axe - Abraham Lincoln
  3. 3. What do you want most froman IDE?It is just me - Assist me write good (hopefully) code fast and happily
  4. 4. Let us make a great IDEbetterLaunch VS.NET quicklyOrganize views and windowsChoose color scheme and fontMaster some shortcutsDo not repeat yourself using macrosExtend VS.NET using addinsUse command window
  5. 5. First thing first – save time onstart upSay NO to the start page
  6. 6. Choose the right start upoption Show Start Page Load last loaded solution Show Open Project dialog box Show New Project dialog box Show Empty environment
  7. 7. Suppress the splash pageIt probably does not bring you anything good
  8. 8. Suppress the splash page
  9. 9. Start VS.NET from commandpromptC:> devenv /nosplash c:weicsharpproj1proj1.sln c:weicsharpproj1Prerequisite Put C:Program FilesMicrosoft Visual Studio .NET C: Files 2003Common7IDE into your path 2003Common7IDE
  10. 10. Set the path
  11. 11. Litter your desktop with asolution shortcutDouble click it to open the solution
  12. 12. A little more about workingwith command promptC:>devenv /?C:>devenv c:weitrialcsharpunit_testunit_test.sln/build DEBUGWhy? Automation and continuous integration
  13. 13. Views, windows, layoutsSolution ViewProperty ViewServer View…Debug WindowOutput WindowTask List Window…Oh My!
  14. 14. Less is moreEver tried Alt + Shift + Enter?
  15. 15. Organize the views andwindowsMake views/windows auto-hideBring them back with shortcuts and command window aliases only when they are needed
  16. 16. Link file under editing tosolution explorer
  17. 17. Link file under editing tosolution explorer
  18. 18. Disable the navigation bar
  19. 19. Little thing countsAdd guide lines to Visual Studio.Net Text EditorSubtle effect: do not write a line which is too long
  20. 20. Add guide lines to Visual Studio.NetText EditorOpen regedit HKEY_CURRENT_USERSoftwareMicrosoftVisualStudio<7.1>Navigate to HKEY_CURRENT_USERSoftwareMicrosoftVisualStudio<7.1>Text EditorRight-click on the Text Editor key and choose New String Value and name it "Guides"Set the value of the guides to RGB(92, 46, 46) 80, 100
  21. 21. Text editor color schemeCustomize a combination which is best for your eyes
  22. 22. Anyone likes the dark side ofVisual Studio.Net? Studio.Net?
  23. 23. Text editor color schemesample Source:
  24. 24. Text editor color scheme sampleSource:
  25. 25. Text editor color scheme sampleSource:
  26. 26. Font for text editorChoose a font that works best for your eyes
  27. 27. Font size for text editorChoose a font size - I choose a larger font size 14.Why?• Good for my eyes• Seeing a lot less code in the editor at a time helps write better code. You naturally want see a whole method in one go. Seeing less code has the subtle effect of writing shorter and cleaner method.
  28. 28. ShortcutsTons of themLots of them you never useLots of them you do not careMaster 10 – 15 killers that you use all the time
  29. 29. ShortcutsCtrl + Space Complete the current word or shows all available methods and properties for a classCtrl + Shift + Space Show the parameter information when the cursor is inside method parentheses
  30. 30. ShortcutsCtrl + K Ctrl + I Show a quick description about whatever object the cursor is currently resting on
  31. 31. ShortcutsCtrl + M + O Fold all codeCtrl + M + P Expand all folds
  32. 32. ShortcutsCtrl+K Ctrl+C Comment out the selected code areaCtrl+K Ctrl+U Uncomment the selected code areaCtrl+K Ctrl+F Format selected code area
  33. 33. ShortcutsF7 Code viewShift + F7 Design view
  34. 34. ShortcutsF8 Next item in the task list or search results.Killer usage: Search for something in the whole solution From command window: grep “wordtosearch” Then hit F8 for the results
  35. 35. ShortcutsF12 Go to definitionShift + F12 Go to reference
  36. 36. ShortcutsCtrl + F FindCtrl + Shift + F Find in files
  37. 37. ShortcutsF5 Start with debuggerCtrl + F5 Start without debuggerF10 Step overF11 Step into
  38. 38. ShortcutsEsc Set the focus back to code view (editor)Ctrl + Tab Go to the next opened file in the text editor
  39. 39. And do not forgetCtrl + S Save the current file Not just for VS.NETCtrl + Shift + S Save all modified files
  40. 40. And do not forgetShift + F10 = right click Bring up context menu It works not only for VS.NET
  41. 41. Create your own shortcutsTools->Options->Environment->KeyboardTools->Options->Environment-
  42. 42. My customized shortcutsalt + s Solution vieweralt + c Class vieweralt + p Property Vieweralt + f Find Filealt + o Opened filealt + a All members of the filealt + m Methods of a filealt + v Pending checkingalt + r Output vieweralt + t Options windowalt + h View history of the file under editing
  43. 43. ShortcutsList all shortcuts and print it out for referenceUse a macro available here:
  44. 44. MacrosA series of commands and instructions grouped togetherAutomate repetitive actions
  45. 45. MacrosCreate a macroRun a macroEdit a macro
  46. 46. MacrosAssign shortcut to a macro
  47. 47. MacrosCreate a command alias for a macro
  48. 48. AddinsAll killers no fillers
  49. 49. VSFileFinder2003Find files quickly in large solution with many projectsFreely available from: http://zero-one-A must
  50. 50. VSFileFinder2003
  51. 51. USysWare DPackCode browseFile browseSolution browseFreely available from:
  52. 52. USysWare DPack
  53. 53. USysWare DPack
  54. 54. USysWare DPack
  55. 55. USysWare DPack
  56. 56. QuickCode .NETWrite code for youGive you more time to code other things that you really want to spend time onAvailable from:
  57. 57. QuickCode .NET
  58. 58. QuickCode .NET
  59. 59. QuickCode .NET - Demowritemainforprivate fieldcomments (div, ///)create NUnit test class
  60. 60. TestDriven.NETIntegrate NUnit to Visual Studio.NETQuick DemoWill be covered in another talk
  61. 61. SolventRecursive Expand/ContractOpen All Sub ItemsOpen Containing Folder In Windows ExplorerCommand Prompt Here
  62. 62. VIEMUvi-vim emulation for Microsoft Visual StudioVi/Vim is an text editor which allows you to edit code quicklyNot a freewareNot for everyone due to its key binding
  63. 63. VIEMU - Demo h j k l - move around quickly gg - go to the beginning of a file G - go to the end of a file :15 - go to line 15 yy - copy a line p - paste :w - save the file :q - close a file :qa - close all files :prb - build the project
  64. 64. AddinsBring up addins using shortcuts and command aliasesThis makes addins really powerful
  65. 65. Command windowThe hidden treasure of VS.NETCan be used to do pretty much everythingMy control center for VS.NET
  66. 66. Command windowWhat can you do from command window?Bring up views, windowsBuild project and solutionSearch for something…You name it
  67. 67. Command window - DemoImportant: create a shortcut to bring up command windows firstMine is alt + w
  68. 68. Command windowCreate alias
  69. 69. Command windowList all aliases
  70. 70. Questions?
  71. 71. My question to youWhat shortcuts, tips and tricks you use all the time?
  72. 72. Being productiveTools matter but it is not only about tools. It is about a mind set.Nobody has time for it. Make it. Dig it.It pays off.
  73. 73. If you save 10 minutes a dayIs it a big deal?Let us do the math:10 (minutes/day) * 300 (days) = 3,000 minutes = 50 hours = One whole weekPlus, chances are you will save more than 10 minutes a day!Plus, you now can code in a better mental mood ☺