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
3. is the leading time tracking solution for knowledge
workers. Graphical time tracking calendar, automatic tracking of
your work using signal trackers, high level of extensibility and
customizability, full support to work offline, and SaaS deployment
model make it the optimal choice especially in the IT consulting
business.
Try for free and without any risk. You can get your trial
account at http://www.timecockpit.com. After the trial period you
can use for only 0,20€ per user and month without a
minimal subscription time and without a minimal number of users.
4. ist die führende Projektzeiterfassung für Knowledge
Worker. Grafischer Zeitbuchungskalender, automatische
Tätigkeitsaufzeichnung über Signal Tracker, umfassende
Erweiterbarkeit und Anpassbarkeit, volle Offlinefähigkeit und
einfachste Verwendung durch SaaS machen es zur Optimalen
Lö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 und
Tag ohne Mindestdauer und ohne Mindestbenutzeranzahl.
5. Abstract (German)
Richtiger Umgang mit der IDE von Visual Studio
macht einen echten Unterschied in Sachen
Produktivität. In der Session zeigen Ihnen
Roman Schacherl und Rainer Stropek Tipps
und Tricks für Visual Studio C#, die Ihnen
helfen, besser im Code zu navigieren, schneller
Code zu schreiben, Fehler zu finden und vieles
mehr. Die gesamte Session wird bereits mit der
Version 2012 von Visual Studio gemacht.
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
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. 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. 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. 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. 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. 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. 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)
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. 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
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. 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)
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
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. 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
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. BTW – Did you know?
• Go to open file (Ctrl+Alt+Down)
• Split Window
• Track Active Item in Solution Explorer (Ctrl+Q, @opt track)
43. Zoom
• Zoom in text window with
Ctrl+Mousewheel
• Doesn‘t work in windows with icons
44. Selection
• Boxed Selection with Alt+Click&Drag
• Multi-Line Insert (also with zero-length
boxes): Alt+Click&Drag
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
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