KCDC 2018 - Modern day C# development in Visual Studio 2017
1. Modern day C# development
in Visual Studio 2017
Kevin Pilch
@Pilchie
kevinpi@microsoft.com
2. Solution Load + Switching branches
• Large solutions load about twice as fast based on our telemetry
• Here’s a video that highlights some of the recent changes
• Still looking at further improvements
• Web
• Small projects
• Etc
• Branch switch history: n^2 project reload -> solution reload -> fast reload
• Do it inside VS!
3. Unit testing
• Way faster test discovery – based on source instead of built
assemblies
• Hierarchical test view
• Responsive icons
• Live Unit Testing
4. Editing
• Expand/Contract selection with Ctrl+Shift+ +/-
• Duplicate Line with Ctrl+D
• Go to Decompiled source with F12
• (Enable at ToolsOptionsText EditorC#Advanced)
• Go to virtual/abstract method with F12 on “override”
• Variable captures in quick info by hovering over =>
• Multiple caret support with Ctrl + Alt + LeftMouseClick, then Shift +
Alt + Ins
• Go to member in current document with Alt+`
• One click cleanup with Ctrl+K, D
• ReSharper keyboard scheme in ToolsOptionsEnvironmentKeyboard
5. Quick Fixes and Refactorings
• Add using for NuGet packages
• Enable at ToolsOptionsText EditorC#Advanced
• Toggle `var`/explicit type
• Make `readonly`
• Convert `foreach` to `for`
• Convert Linq query to `foreach`
• Invert `if`
• Add parameter from callsite
• Source control merge markers
6. Code Style and .editorconfig
• `var`/explicit type
• `this.`
• Naming conventions
• Modifiers
• Require braces
• Use ternary
• Use object/collection initializers
• Null checks, pattern matching, out vars, default expressions, tuples
7. Debugging
• Run to cursor
• Null reference exception details
• Faster stepping
8. Resources
• Get VS 2017: aka.ms/vs
• VS2017 Productivity Guide: aka.ms/vs2017guide
• Report performance issues: aka.msVSPerf
• EditorConfig Code Style: aka.ms/editorconfigDocs
• Refactoring Docs: aka.ms/refactorings
• Visual Studio IntelliCode Preview: aka.ms/VSIntelliCode
• Visual Studio Live Share Preview: aka.ms/vsls
• Getting Started with Roslyn: aka.ms/roslyn-analyzers