Rainer Stropek | software architectsCoding Like the Wind
Introduction• software architects gmbh• Rainer Stropek   – Developer, Speaker, Trainer   – MVP for Windows Azure   – raine...
is the leading time tracking solution for knowledgeworkers. Graphical time tracking calendar, automatic tracking ofyour wo...
ist die führende Projektzeiterfassung für KnowledgeWorker. Grafischer Zeitbuchungskalender, automatischeTätigkeitsaufzeich...
Abstract (German)Richtiger Umgang mit der IDE von Visual Studiomacht einen echten Unterschied in SachenProduktivität. In d...
Intro• VS 2012 – should I?   – Development of Windows Store Apps (requires     Windows 8 also on developer pc)   – Enhance...
NAVIGATE
Call Hierarchy (1/2)• Shows…  – …calls from/in selected member  – …interface implementations  – …virtual or abstract imple...
Call Hierarchy (1/2)• Improvements compared to Find all  references  – Hierarchical visualization  – Scope can be specifie...
Code Definition Window• View, Code Definition Window  (Ctrl+W, D)• Shows the symbol definition based on  – Sourcecode or  ...
Quick Launch• Jump to Quick Launch with Ctrl+Q• Searches for menus and options• Specify search scope:  – @menu … (limit to...
Navigate To (1/3)• Improved Search  – IMHO better than Object Browser (Ctrl+W, J)  – Searching for file names  (e.g. „DBQ...
Navigate To (2/3)• When is Find better?  – Quick Find (Ctrl+F) vs. Find In Files    (Ctrl+Shift+F)  – Tip: Quick Replace (...
Navigate To (3/3)• Tip: F8, to move to the next element in lists (go to next  location)   • Build Errors   • Find Results ...
TODO Lists (1/3)• // TODO: …
TODO Lists (2/3)• Bookmarks (Ctrl+B, T)• Can be named
TODO Lists (3/3)• Task List Shortcuts (Ctrl+E, T)
Reference Highlighting• All symbol references are highlighted   • references = everything found by Find All References    ...
Outlining• Outlining as known  • Collapse to definitions (Ctrl+M, O)  • Toggle outlining (Ctrl+M, M)• Tip: #region Code Sn...
CODE GENERATION
Generate From Usage• Useful with TDD• Accessible via…  • …Mouse (Smart Tag = Pain)  • …Ctrl+. (=Pain Killer)• Generates Ty...
IntelliSense (1/2)• Modes   • Completion Mode (as known)   • Suggestion Mode (for TDD; see Generate From     Usage)• Switc...
IntelliSense (2/2)• Parameter informations are displayed with  Ctrl+Shift+Space• Show Quick Info (Ctrl+K, I)
IntelliSense (2/2)• Parameter informations are displayed with  Ctrl+Shift+Space• Show Quick Info (Ctrl+K, I)
C# Code documentation• Tooltips• Sandcastle  • Sandcastle Help File Builder  • MAML for concept files  • GhostDoc
Snippets (1/2)• Insert prepared code blocks• Optional  • Parameter  • using Statements  • References• Code Snippet UI (Ctr...
Snippets (2/2)• Surround code block with snippet:  Ctrl+K, S
Code Snippets in ASP.NET
Item and Project Templates (1/4)
Item and Project      Templates (2/4)• Generates a ZIP file containing  the template• Has to be deployed manually• Use VSI...
Item and Project Templates (3/4)
Item and Project Templates (4/4)• Install Visual Studio 2012 SDK for Extensibility project types• Read more about item/pro...
T4 Templates•   Integrated Template engine in Visual Studio•   Use e.g. for     – Code generation     – Generation of XML ...
T4 (Development- and Design Time)
T4 (Runtime)
WINDOWS AND VIEWS
Solution Explorer       • Search       • Expand tree down         to Methods       • Open multiple         Solution Explor...
Test Explorer• Replaces the  Test Toolbar• Demo: Analyze  test coverage
„New Project“-Dialog                       Ctrl+E
Fast Add Reference                        Ctrl+E
Docking• Document Windows  • Docking also in Document Frame  • Tip: Multi-monitor support• Tip: Ctrl+Doubleclick on window...
BTW – Did you know?• Go to open file (Ctrl+Alt+Down)• Split Window• Track Active Item in Solution Explorer (Ctrl+Q, @opt t...
Zoom• Zoom in text window with  Ctrl+Mousewheel• Doesn‘t work in windows with icons
Selection• Boxed Selection with Alt+Click&Drag• Multi-Line Insert (also with zero-length  boxes): Alt+Click&Drag
BTW – Did you know?
DEBUGGING
Conditional Breakpoints• Breakpoint hits only, if the given  condition is true• Be careful: slows down execution!
IntelliTrace• Record errors in scenarios, where you  don‘t have Visual Studio – and debug  them locally afterwards• Record...
IntelliTrace
Immediate Window• Ctrl+D,I• Execute code during Design Time or  Debugging
Data Tips (1/2)• Present in the debugger for variables of current  scope   • Pin to source: Data Tip is linked to source c...
Data Tips (2/2)• Pinning Subexpressions• Tip: Object-IDs
DLR Support• Specific support of dynamic data type  in Debugger
Thank youfor your attention.rainer@timecockpit.com
Upcoming SlideShare
Loading in …5
×

Coding Like the Wind - Tips and Tricks for the Microsoft Visual Studio 2012 C# IDE

1,408 views

Published on

Microsoft Visual Studio 2012 contains a bunch of productivity features for C# developers. Rainer Stropek, MVP for Windows Azure, summarizes his top tips for the new VS2012 C# IDE in this presentation

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,408
On SlideShare
0
From Embeds
0
Number of Embeds
21
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Coding Like the Wind - Tips and Tricks for the Microsoft Visual Studio 2012 C# IDE

  1. 1. Rainer Stropek | software architectsCoding Like the Wind
  2. 2. Introduction• software architects gmbh• Rainer Stropek – Developer, Speaker, Trainer – MVP for Windows Azure – rainer@timecockpit.com – @rstropek http://www.timecockpit.com
  3. 3. is the leading time tracking solution for knowledgeworkers. Graphical time tracking calendar, automatic tracking ofyour work using signal trackers, high level of extensibility andcustomizability, full support to work offline, and SaaS deploymentmodel make it the optimal choice especially in the IT consultingbusiness.Try for free and without any risk. You can get your trialaccount at http://www.timecockpit.com. After the trial period youcan use for only 0,20€ per user and month without aminimal subscription time and without a minimal number of users.
  4. 4. ist die führende Projektzeiterfassung für KnowledgeWorker. Grafischer Zeitbuchungskalender, automatischeTätigkeitsaufzeichnung über Signal Tracker, umfassendeErweiterbarkeit und Anpassbarkeit, volle Offlinefähigkeit undeinfachste Verwendung durch SaaS machen es zur OptimalenLösung auch speziell im IT-Umfeld.Probieren Sie kostenlos und ohne Risiko einfach aus.Einen Testzugang erhalten Sie unter http://www.timecockpit.com.Danach nutzen Sie um nur 0,20€ pro Benutzer undTag ohne Mindestdauer und ohne Mindestbenutzeranzahl.
  5. 5. Abstract (German)Richtiger Umgang mit der IDE von Visual Studiomacht einen echten Unterschied in SachenProduktivität. In der Session zeigen IhnenRoman Schacherl und Rainer Stropek Tippsund Tricks für Visual Studio C#, die Ihnenhelfen, besser im Code zu navigieren, schnellerCode zu schreiben, Fehler zu finden und vielesmehr. Die gesamte Session wird bereits mit derVersion 2012 von Visual Studio gemacht.
  6. 6. Intro• VS 2012 – should I? – Development of Windows Store Apps (requires Windows 8 also on developer pc) – Enhancements are shown in this session – but many tips and tricks work in VS 2010) – System requirements: Windows 7 or higher – Project files are compatible to VS 2010• Main target: show productivity tips for your day-to-day work
  7. 7. NAVIGATE
  8. 8. Call Hierarchy (1/2)• Shows… – …calls from/in selected member – …interface implementations – …virtual or abstract implementations• „Find all references (Ctrl+K, R) on steroids“ – Context menu for any member, View Call History – Ctrl+K, T
  9. 9. Call Hierarchy (1/2)• Improvements compared to Find all references – Hierarchical visualization – Scope can be specified – Deferred execution – More proper results (see OnPropertyChanged)• Limitations – Use outside of C# Code (e.g. XAML)
  10. 10. Code Definition Window• View, Code Definition Window (Ctrl+W, D)• Shows the symbol definition based on – Sourcecode or – Referenced binary Assemblies• Reacts to – Current cursor position – Current selection in Class View, Object Browser or Call Browser
  11. 11. Quick Launch• Jump to Quick Launch with Ctrl+Q• Searches for menus and options• Specify search scope: – @menu … (limit to menu items) – @opt … (limit to settings) – @mru (Most recently used)
  12. 12. Navigate To (1/3)• Improved Search – IMHO better than Object Browser (Ctrl+W, J) – Searching for file names  (e.g. „DBQ“ finds „DbClientQuery.cs“) – CamelCaseSearch (e.g. „MAN“ finds „MarkAsNew“)• Edit, Navigate To (Ctrl+,)• Tips – Search word in lower case  case insensitive – Upper and lower case  case sensitive – space = And-conjunction
  13. 13. Navigate To (2/3)• When is Find better? – Quick Find (Ctrl+F) vs. Find In Files (Ctrl+Shift+F) – Tip: Quick Replace (Ctrl+H) vs. Replace In Files (Ctrl+Shift+H) – Regular Expressions• Rarely known, but useful – Go to next result in Quick Find (F3) – Go to definition (F12) works also without having the source code
  14. 14. Navigate To (3/3)• Tip: F8, to move to the next element in lists (go to next location) • Build Errors • Find Results • Etc.• Tip: Ctrl+Minus, to navigate to the last shown source code line (navigate backward)
  15. 15. TODO Lists (1/3)• // TODO: …
  16. 16. TODO Lists (2/3)• Bookmarks (Ctrl+B, T)• Can be named
  17. 17. TODO Lists (3/3)• Task List Shortcuts (Ctrl+E, T)
  18. 18. Reference Highlighting• All symbol references are highlighted • references = everything found by Find All References (Ctrl+K, R)• Ctrl+Shift+ and Ctrl+Shift+ to jump between references• Can be enabled/disabled in the settings• Colors can be configured in the settings
  19. 19. Outlining• Outlining as known • Collapse to definitions (Ctrl+M, O) • Toggle outlining (Ctrl+M, M)• Tip: #region Code Snippet• Tip: Ad Hoc Blocks • Select the code block • Hide Selection (Ctrl+M, Ctrl+H) •  Ad Hoc Block gets created
  20. 20. CODE GENERATION
  21. 21. Generate From Usage• Useful with TDD• Accessible via… • …Mouse (Smart Tag = Pain) • …Ctrl+. (=Pain Killer)• Generates Type, Field, Property or Method • Tip: Generate New Type if code should be generated in a different project (e.g. test projects)
  22. 22. IntelliSense (1/2)• Modes • Completion Mode (as known) • Suggestion Mode (for TDD; see Generate From Usage)• Switch completion mode with Ctrl+Alt+Space• How to get the member list manually? • Ctrl+K, L (or Ctrl+J)
  23. 23. IntelliSense (2/2)• Parameter informations are displayed with Ctrl+Shift+Space• Show Quick Info (Ctrl+K, I)
  24. 24. IntelliSense (2/2)• Parameter informations are displayed with Ctrl+Shift+Space• Show Quick Info (Ctrl+K, I)
  25. 25. C# Code documentation• Tooltips• Sandcastle • Sandcastle Help File Builder • MAML for concept files • GhostDoc
  26. 26. Snippets (1/2)• Insert prepared code blocks• Optional • Parameter • using Statements • References• Code Snippet UI (Ctrl+K, X)• Code Snippet Manager (Ctrl+K, Ctrl+B)• Tip: Snippet Designer on Codeplex
  27. 27. Snippets (2/2)• Surround code block with snippet: Ctrl+K, S
  28. 28. Code Snippets in ASP.NET
  29. 29. Item and Project Templates (1/4)
  30. 30. Item and Project Templates (2/4)• Generates a ZIP file containing the template• Has to be deployed manually• Use VSIX projects to create installer
  31. 31. Item and Project Templates (3/4)
  32. 32. Item and Project Templates (4/4)• Install Visual Studio 2012 SDK for Extensibility project types• Read more about item/project templates in VS2012: http://msdn.microsoft.com/en-us/library/ms247121.aspx
  33. 33. T4 Templates• Integrated Template engine in Visual Studio• Use e.g. for – Code generation – Generation of XML or HTML• Development Time / Compile Time / Runtime• Read more about T4: http://msdn.microsoft.com/en-us/library/bb126445.aspx
  34. 34. T4 (Development- and Design Time)
  35. 35. T4 (Runtime)
  36. 36. WINDOWS AND VIEWS
  37. 37. Solution Explorer • Search • Expand tree down to Methods • Open multiple Solution Explorers with different scopes • Show Base/Derived Types
  38. 38. Test Explorer• Replaces the Test Toolbar• Demo: Analyze test coverage
  39. 39. „New Project“-Dialog Ctrl+E
  40. 40. Fast Add Reference  Ctrl+E
  41. 41. Docking• Document Windows • Docking also in Document Frame • Tip: Multi-monitor support• Tip: Ctrl+Doubleclick on window title to get it back to the last position
  42. 42. BTW – Did you know?• Go to open file (Ctrl+Alt+Down)• Split Window• Track Active Item in Solution Explorer (Ctrl+Q, @opt track)
  43. 43. Zoom• Zoom in text window with Ctrl+Mousewheel• Doesn‘t work in windows with icons
  44. 44. Selection• Boxed Selection with Alt+Click&Drag• Multi-Line Insert (also with zero-length boxes): Alt+Click&Drag
  45. 45. BTW – Did you know?
  46. 46. DEBUGGING
  47. 47. Conditional Breakpoints• Breakpoint hits only, if the given condition is true• Be careful: slows down execution!
  48. 48. IntelliTrace• Record errors in scenarios, where you don‘t have Visual Studio – and debug them locally afterwards• Record specific Events during execution (e.g. all sent SQL statements and exceptions)• Unfortunately only Ultimate Edition
  49. 49. IntelliTrace
  50. 50. Immediate Window• Ctrl+D,I• Execute code during Design Time or Debugging
  51. 51. Data Tips (1/2)• Present in the debugger for variables of current scope • Pin to source: Data Tip is linked to source code position and scrolls with the text • Comments on pinned data tips
  52. 52. Data Tips (2/2)• Pinning Subexpressions• Tip: Object-IDs
  53. 53. DLR Support• Specific support of dynamic data type in Debugger
  54. 54. Thank youfor your attention.rainer@timecockpit.com

×