tips and tricks for using visual studio.net effectively
DESCRIPTION
Some tips and tricks to use visual studio.net more productively and pleasantlyTRANSCRIPT
Microsoft Visual Microsoft Visual Microsoft Visual Microsoft Visual Studio.NetStudio.NetStudio.NetStudio.NetTips Tips Tips Tips and Tricksand Tricksand Tricksand TricksTips Tips Tips Tips and Tricksand Tricksand Tricksand Tricks
to save you 10 minutes a dayto save you 10 minutes a dayto save you 10 minutes a dayto save you 10 minutes a day
Wei Li09/2006
If I had eight hours to chop down a tree, If I had eight hours to chop down a tree, If I had eight hours to chop down a tree, If I had eight hours to chop down a tree, I'd spend six sharpening my axeI'd spend six sharpening my axeI'd spend six sharpening my axeI'd spend six sharpening my axe
- Abraham Lincoln
What do you What do you What do you What do you want most want most want most want most from from from from an IDE?an IDE?an IDE?an IDE?
It is just me -
Assist me write goodgoodgoodgood (hopefully) code fast fast fast fast andandandand happilyhappilyhappilyhappily
Let us make a great IDE Let us make a great IDE Let us make a great IDE Let us make a great IDE better better better better Launch VS.NET quicklyOrganize views and windowsChoose color scheme and fontChoose color scheme and fontMaster some shortcutsDo not repeat yourself using macrosExtend VS.NET using addinsUse command window
First thing first First thing first First thing first First thing first –––– save time on save time on save time on save time on start upstart upstart upstart upSay NO to the start page
Choose the right start up Choose the right start up Choose the right start up Choose the right start up optionoptionoptionoption
Show Start Page
Load last loaded solutionLoad last loaded solutionLoad last loaded solutionLoad last loaded solutionLoad last loaded solutionLoad last loaded solutionLoad last loaded solutionLoad last loaded solution
Show Open Project dialog box
Show New Project dialog box
Show Empty environmentShow Empty environmentShow Empty environmentShow Empty environment
Suppress the splash pageSuppress the splash pageSuppress the splash pageSuppress the splash pageIt probably does not bring you anything
good
Suppress the splash pageSuppress the splash pageSuppress the splash pageSuppress the splash page
Start VS.NET from command Start VS.NET from command Start VS.NET from command Start VS.NET from command promptpromptpromptprompt
C:> C:> C:> C:> devenvdevenvdevenvdevenv ////nosplashnosplashnosplashnosplash c:c:c:c:\\\\weiweiweiwei\\\\csharpcsharpcsharpcsharp\\\\proj1proj1proj1proj1\\\\proj1.slnproj1.slnproj1.slnproj1.sln
PrerequisitePrerequisitePut C:C:C:C:\\\\Program FilesProgram FilesProgram FilesProgram Files\\\\Microsoft Visual Studio .NET Microsoft Visual Studio .NET Microsoft Visual Studio .NET Microsoft Visual Studio .NET 2003200320032003\\\\Common7Common7Common7Common7\\\\IDEIDEIDEIDE\\\\ into your path
Set the pathSet the pathSet the pathSet the path
Litter your desktop with a Litter your desktop with a Litter your desktop with a Litter your desktop with a solution shortcutsolution shortcutsolution shortcutsolution shortcut
Double click it to open the solution
A little more about working A little more about working A little more about working A little more about working with command promptwith command promptwith command promptwith command promptC:\>devenv /?
C:\>devenv c:\wei\trial\csharp\unit_test\unit_test.sln /build DEBUG/build DEBUG
Why? Automation and continuous integration
Views, windows, layoutsViews, windows, layoutsViews, windows, layoutsViews, windows, layoutsSolution View Property ViewServer View…Debug WindowDebug WindowOutput WindowTask List Window…Oh My!
Less is moreLess is moreLess is moreLess is more
Ever tried Alt + Shift + EnterAlt + Shift + EnterAlt + Shift + EnterAlt + Shift + Enter?
Organize the views and Organize the views and Organize the views and Organize the views and windowswindowswindowswindowsMake views/windows auto-hide
Bring them back with shortcuts and Bring them back with shortcuts and command window aliases only when they are needed
Link file under editing to Link file under editing to Link file under editing to Link file under editing to solution explorersolution explorersolution explorersolution explorer
Link file under editing to Link file under editing to Link file under editing to Link file under editing to solution explorersolution explorersolution explorersolution explorer
Disable the navigation barDisable the navigation barDisable the navigation barDisable the navigation bar
Little thing countsLittle thing countsLittle thing countsLittle thing countsAdd guide lines to Visual Studio.Net Text EditorSubtle effect: do not write a line which is too long
Add guide lines to Visual Add guide lines to Visual Add guide lines to Visual Add guide lines to Visual Studio.NetStudio.NetStudio.NetStudio.NetText EditorText EditorText EditorText EditorOpen regeditNavigate to HKEY_CURRENT_USERHKEY_CURRENT_USERHKEY_CURRENT_USERHKEY_CURRENT_USER\\\\SoftwareSoftwareSoftwareSoftware\\\\MicrosoftMicrosoftMicrosoftMicrosoft\\\\VisualStudioVisualStudioVisualStudioVisualStudio\\\\<7.1><7.1><7.1><7.1>\\\\Text Text Text Text
EditorEditorEditorEditorRight-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
Text editor Text editor Text editor Text editor colorcolorcolorcolor schemeschemeschemeschemeCustomize a combination which is best for
your eyes
Anyone likes the dark side of Anyone likes the dark side of Anyone likes the dark side of Anyone likes the dark side of Visual Visual Visual Visual Studio.NetStudio.NetStudio.NetStudio.Net????
Text editor color scheme Text editor color scheme Text editor color scheme Text editor color scheme samplesamplesamplesample
Source: http://seizethedave.com/etc/idehttp://seizethedave.com/etc/idehttp://seizethedave.com/etc/idehttp://seizethedave.com/etc/ide----color.gifcolor.gifcolor.gifcolor.gif
Text editor color scheme Text editor color scheme Text editor color scheme Text editor color scheme samplesamplesamplesample
Source: http://www.codinghorror.com/blog/archives/000682.htmlhttp://www.codinghorror.com/blog/archives/000682.htmlhttp://www.codinghorror.com/blog/archives/000682.htmlhttp://www.codinghorror.com/blog/archives/000682.html
Text editor color scheme Text editor color scheme Text editor color scheme Text editor color scheme samplesamplesamplesample
Source: http://www.codinghorror.com/blog/archives/000682.htmlhttp://www.codinghorror.com/blog/archives/000682.htmlhttp://www.codinghorror.com/blog/archives/000682.htmlhttp://www.codinghorror.com/blog/archives/000682.html
Font for text editorFont for text editorFont for text editorFont for text editorChoose a font that works best for your
eyes
Font size for text editorFont size for text editorFont size for text editorFont size for text editorChoose a font size - I choose a larger font
size 14.
Why?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.
ShortcutsShortcutsShortcutsShortcutsTons of themLots of them you never useLots of them you do not careLots of them you do not care
Master 10 – 15 killers that you use all the time
ShortcutsShortcutsShortcutsShortcuts
Ctrl + SpaceCtrl + SpaceCtrl + SpaceCtrl + Space
Complete the current word or shows all available methods and properties for a class
Ctrl + Shift + SpaceCtrl + Shift + SpaceCtrl + Shift + SpaceCtrl + Shift + Space
Show the parameter information when the cursor is inside method parentheses
ShortcutsShortcutsShortcutsShortcuts
Ctrl + K Ctrl + ICtrl + K Ctrl + ICtrl + K Ctrl + ICtrl + K Ctrl + I
Show a quick description about whatever object the cursor is currently resting on
Show a quick description about whatever object the cursor is currently resting on
ShortcutsShortcutsShortcutsShortcuts
Ctrl + M + OCtrl + M + OCtrl + M + OCtrl + M + OFold all code
Ctrl + M + PCtrl + M + PCtrl + M + PCtrl + M + PExpand all folds
ShortcutsShortcutsShortcutsShortcuts
Ctrl+K Ctrl+CCtrl+K Ctrl+CCtrl+K Ctrl+CCtrl+K Ctrl+CComment out the selected code area
Ctrl+K Ctrl+UCtrl+K Ctrl+UCtrl+K Ctrl+UCtrl+K Ctrl+UUncomment the selected code area
Ctrl+K Ctrl+FCtrl+K Ctrl+FCtrl+K Ctrl+FCtrl+K Ctrl+FFormat selected code area
ShortcutsShortcutsShortcutsShortcuts
F7F7F7F7Code view
Shift + F7Shift + F7Shift + F7Shift + F7Design view
ShortcutsShortcutsShortcutsShortcuts
F8F8F8F8Next item in the task list or search results.
Killer usage:Killer usage:Killer usage:Killer usage:Search for something in the whole solutionFrom command window: grep “wordtosearch”Then hit F8 for the results
ShortcutsShortcutsShortcutsShortcuts
F12F12F12F12Go to definition
Shift + F12Shift + F12Shift + F12Shift + F12
Go to reference
ShortcutsShortcutsShortcutsShortcuts
Ctrl + FCtrl + FCtrl + FCtrl + FFind
Ctrl + Shift + FCtrl + Shift + FCtrl + Shift + FCtrl + Shift + F
Find in files
ShortcutsShortcutsShortcutsShortcutsF5F5F5F5
Start with debugger
Ctrl + F5Ctrl + F5Ctrl + F5Ctrl + F5Start without debugger
Ctrl + F5Ctrl + F5Ctrl + F5Ctrl + F5Start without debugger
F10F10F10F10Step over
F11F11F11F11Step into
ShortcutsShortcutsShortcutsShortcuts
EscEscEscEscSet the focus back to code view (editor)
Ctrl + TabCtrl + TabCtrl + TabCtrl + TabGo to the next opened file in the text editor
And do not And do not And do not And do not forget forget forget forget
Ctrl + SCtrl + SCtrl + SCtrl + SSave the current fileNot just for VS.NET
Ctrl + Shift + SCtrl + Shift + SCtrl + Shift + SCtrl + Shift + SSave all modified files
And do not And do not And do not And do not forgetforgetforgetforgetShift + F10Shift + F10Shift + F10Shift + F10
= right clickBring up context menuIt works not only for VS.NETIt works not only for VS.NET
Create your own shortcutsCreate your own shortcutsCreate your own shortcutsCreate your own shortcutsToolsToolsToolsTools---->Options>Options>Options>Options---->Environment>Environment>Environment>Environment---->Keyboard>Keyboard>Keyboard>Keyboard
My customized shortcutsMy customized shortcutsMy customized shortcutsMy customized shortcutsalt + salt + salt + salt + s Solution viewer alt + calt + calt + calt + c Class viewer alt + palt + palt + palt + p Property Viewer alt + f alt + f alt + f alt + f Find File alt + o alt + o alt + o alt + o Opened file alt + o alt + o alt + o alt + o Opened file alt + aalt + aalt + aalt + a All members of the file alt + malt + malt + malt + m Methods of a file alt + valt + valt + valt + v Pending checking alt + ralt + ralt + ralt + r Output vieweralt + talt + talt + talt + t Options window alt + halt + halt + halt + h View history of the file under editing
ShortcutsShortcutsShortcutsShortcuts
List all shortcuts and print it out for reference
Use a macro available here:http://www.codinghorror.com/blog/archives/000315.htmlhttp://www.codinghorror.com/blog/archives/000315.htmlhttp://www.codinghorror.com/blog/archives/000315.htmlhttp://www.codinghorror.com/blog/archives/000315.html
MacrosMacrosMacrosMacrosA series of commands and instructions grouped
together
Automate repetitive actions Automate repetitive actions
MacrosMacrosMacrosMacros
Create a macro
Run a macroRun a macro
Edit a macro
MacrosMacrosMacrosMacrosAssign shortcut to a macro
MacrosMacrosMacrosMacrosCreate a command alias for a macro
AddinsAddinsAddinsAddins
All killers no fillersAll killers no fillers
VSFileFinder2003 VSFileFinder2003 VSFileFinder2003 VSFileFinder2003 Find files quickly in large solution with many projects
Freely available from:http://zerohttp://zerohttp://zerohttp://zero----oneoneoneone----zero.com/vs/zero.com/vs/zero.com/vs/zero.com/vs/http://zerohttp://zerohttp://zerohttp://zero----oneoneoneone----zero.com/vs/zero.com/vs/zero.com/vs/zero.com/vs/
A must
VSFileFinder2003VSFileFinder2003VSFileFinder2003VSFileFinder2003
USysWare DPackUSysWare DPackUSysWare DPackUSysWare DPackCode browseFile browseSolution browse
Freely available from:http://www.usysware.com/DPack/Default.aspxhttp://www.usysware.com/DPack/Default.aspxhttp://www.usysware.com/DPack/Default.aspxhttp://www.usysware.com/DPack/Default.aspx
USysWare DPackUSysWare DPackUSysWare DPackUSysWare DPack
USysWare DPackUSysWare DPackUSysWare DPackUSysWare DPack
USysWare DPackUSysWare DPackUSysWare DPackUSysWare DPack
USysWare DPackUSysWare DPackUSysWare DPackUSysWare DPack
QuickCode .NETQuickCode .NETQuickCode .NETQuickCode .NETWrite code for youGive you more time to code other things that you really
want to spend time on
Available from:http://www.dvxp.com/en/QuickCode.aspxhttp://www.dvxp.com/en/QuickCode.aspxhttp://www.dvxp.com/en/QuickCode.aspxhttp://www.dvxp.com/en/QuickCode.aspx
QuickCode .NETQuickCode .NETQuickCode .NETQuickCode .NET
QuickCode .NETQuickCode .NETQuickCode .NETQuickCode .NET
QuickCode .NET QuickCode .NET QuickCode .NET QuickCode .NET ---- DemoDemoDemoDemowritemainforprivate fieldprivate fieldcomments (div, ///)create NUnit test class
TestDriven.NETTestDriven.NETTestDriven.NETTestDriven.NETIntegrate NUnit to Visual Studio.NET
Quick Demo
Will be covered in another talk
http://testdriven.net/http://testdriven.net/http://testdriven.net/http://testdriven.net/
SolventSolventSolventSolventRecursive Expand/Contract
Open All Sub Items
Open Containing Folder In Windows Explorer
Command Prompt Here
http://www.paraesthesia.com/blog/comments.php?id=602_0_1_0_Chttp://www.paraesthesia.com/blog/comments.php?id=602_0_1_0_Chttp://www.paraesthesia.com/blog/comments.php?id=602_0_1_0_Chttp://www.paraesthesia.com/blog/comments.php?id=602_0_1_0_C
VIEMUVIEMUVIEMUVIEMUvi-vim emulation for Microsoft Visual StudioVi/Vim is an text editor which allows you to edit code
quickly
Not a freeware
Not for everyone due to its key binding
http://www.viemu.com/http://www.viemu.com/http://www.viemu.com/http://www.viemu.com/
VIEMU VIEMU VIEMU VIEMU ---- DemoDemoDemoDemoh j k l h j k l h j k l h j k l ---- move around quicklymove around quicklymove around quicklymove around quicklygg gg gg gg ---- go to the beginning of a filego to the beginning of a filego to the beginning of a filego to the beginning of a fileG G G G ---- go to the end of a filego to the end of a filego to the end of a filego to the end of a file:15 :15 :15 :15 ---- go to line 15go to line 15go to line 15go to line 15
yy yy yy yy ---- copy a linecopy a linecopy a linecopy a linep p p p ---- pastepastepastepaste
:w :w :w :w ---- save the filesave the filesave the filesave the file:q :q :q :q ---- close a fileclose a fileclose a fileclose a file:qa :qa :qa :qa ---- close all filesclose all filesclose all filesclose all files
:prb :prb :prb :prb ---- build the projectbuild the projectbuild the projectbuild the project
AddinsAddinsAddinsAddinsBring up addins using shortcuts and command aliases
This makes addins really powerful
Command windowCommand windowCommand windowCommand windowThe hidden treasure of VS.NET
Can be used to do pretty much everything
My control center for VS.NET
Command windowCommand windowCommand windowCommand windowWhat can you do from command window?
Bring up views, windowsBuild project and solutionBuild project and solutionSearch for something…You name it
Command window Command window Command window Command window ---- DemoDemoDemoDemoImportant: create a shortcut to bring up command create a shortcut to bring up command create a shortcut to bring up command create a shortcut to bring up command
windows firstwindows firstwindows firstwindows first
Mine is alt + walt + walt + walt + wMine is alt + walt + walt + walt + w
Command windowCommand windowCommand windowCommand window
Create alias
Command windowCommand windowCommand windowCommand window
List all aliases
Questions?Questions?Questions?Questions?
My question to youMy question to youMy question to youMy question to youWhat shortcuts, tips and tricks you use all the time?
Being productiveBeing productiveBeing productiveBeing productive
Tools 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.
If you save 10 minutes a dayIf you save 10 minutes a dayIf you save 10 minutes a dayIf you save 10 minutes a dayIs it a big deal?
Let us do the math:10 (minutes/day) * 300 (days)10 (minutes/day) * 300 (days)10 (minutes/day) * 300 (days)10 (minutes/day) * 300 (days)= 3,000 minutes= 3,000 minutes= 3,000 minutes= 3,000 minutes= 3,000 minutes= 3,000 minutes= 3,000 minutes= 3,000 minutes= 50 hours= 50 hours= 50 hours= 50 hours= One whole week= One whole week= One whole week= One whole week
Plus, chances are you will save more than 10 minutes a day!
Plus, you now can code in a better mental mood ☺