Visual Studio 2022 setup for C# (theme, settings, extensions)
28 Jun 2019 #productivity #visualstudioVisual Studio is the de facto IDE for C#. You will spend countless hours inside Visual Studio. You are better off spending some time to customize it to boost your productivity.
My Visual Studio setup is heavily inspired by De-Cruft Visual Studio. It aims to leave more space to the text editor by removing unneeded menus and bars.
These are the theme, settings and extensions I use to be more productive with Visual Studio.
1. Theme and Layout
- Color theme: Dark
- Text Editor theme: Solarized Dark
- Font: FiraCode 14pt
- Zoom: 110%
- Windows:
- Left
- Test Explorer
- Source Control Explorer
- Right
- Properties
- Solution Explorer
- Git Changes
- Team Explorer
- Bottom
- Output
- Error List
- C# Interactive: A C# REPL, so you don’t have to create a Console project to try things out
- Left
2. Settings
To change your Visual Studio settings, go to “Tools” menu and then to “Options”.
On the left pane, you will find Visual Studio settings groupped by features, languages and extensions.
In “Text Editor”, unselect Enable mouse click to perform Go to Definition, Selection Margin and Indicator margin.
Next, uncheck Disable CodeLens. Only activate Show Test Status and Show C# References.
Next, in C# specific settings, enable Line numbers. And, hide Navigation Bar and Code Outlining.
Go down to Advanced settings to Add missing using directives on paste. Yeap, Visual Studio can add missing using staments when you paste some code. That’s a time saver!
After installing “Productivity Power Tools” extension, unselect Compress blank lines and Compress lines that do not have any alphanumeric characters. Code looks weird compressed.
Speaking of extensions, after installing “VSVim” extension, use Handle all with Visual Studio. This way, we have the best of both worlds. And, we still have Control + C
and Control + V
.
For shortcuts, add Ctrl+Shift+w
to easily close all documents from the keyboard.
3. Extensions
- VSVim It enables Vim keybindings in the text editor
- Productivity Power Tools
- Editor Guidelines: Add a Solarized Magenta guideline at column 120
- Fixed Mixed Tabs
- Custom Document Well
- Match Margin
- VSColorOutput It gives you a fancier Output tab with colors
- SaveAllTheTime No more
Ctrl + S
. It saves automatically all modified files. Why this feature isn’t included in Visual Studio out-of-the-box? It’s already present in Visual Studio Code! - SolutionColor It colors the solution bar per project. No more editing production code without noticing it. Use Solarized theme, too. Red for Beta and Magenta for Production
- LocateInTFS It finds the location of the selected file in the Source Control Explorer tab
- AddNewFile It adds new files directly from the Solution Explorer. Forget about
Right Click -> Add -> New Folder
, to then add the file you want. You can create folders and files in from a single pop-up window. You only need to hitShift + F2
and type the path, name and extension of your new file. - SemanticColorizer It colors fields, classes, methods and more. Make extension methods italics, only
- NUnit 3 Test Adapter. A must-have
- MappingGenerator It creates mappings from one object to another and from a list of parameters to an object. You need to initialize an object with sample values? In your tests for example? MappingGenerator does it for you!
- CodeMaid It cleans and formats your files. It remove extra blank lines. It removes and sorts your using statements. It removes extra spaces before and after parenthesis. You got the idea!.
- AsyncMethodNameFixer To not to forget to add the
Async
suffix on async method names. - Multiline Search and Replace No need to copy and paste your code into Notepad++ to replace multiple lines at once.
- Line Endings Unifier Yes, it unifies the line endings of your files. You can choose the line ending you want to use in your files. Depending on the number of files in your solution, it could take a couple of seconds. But it does its job!
- Moq.Autocomplete If you use Moq to create fakes, this extension is for you. Inside the
Setup()
methods, it autocompletes the parameter list of the faked method usingIt.IsAny<T>()
for each parameter. A time saver! I use this extension along with these snippets for Moq. - Open Command Line: Right click on a project or solution and open a Terminal in the folder of that solution or project. Or, simply press Alt + Space.
4. Presentation mode
Fire a new instance from Visual Studio Developers Tools command prompt, using
devenv /RootSuffix Demo
It will open a separate and clean instance with no configurations or extensions. Any changes made to this instance won’t affect the “normal” instance next time you open Visual Studio.
To make Visual Studio work in Presentation mode:
- Remove Navigation Outline, Server Explorer, Toolbox, Git changes, and Properties. Only keep Solution Explorer.
- Disable CodeLens.
- Use Cascadia Mono, 14pt.
- Change Output and Developer Powershell font to Consolas 14pt.
- Increase size of tooltips:
- Change Statement Completion font size to 12pt.
- Change Editor Tooltip font size to 13pt.
- Change text highlight color to yellow.
- Use 120% as default zoom level.
- Install SaveAllTheTime.
- Optionally install the GitHub theme.
- Optionally install the MarkdownEditor extension to present using markdown files.
Voilà! That’s how I use Visual Studio 2019 for C# coding. If you’re wondering what’s Vim and why you should learn it, check my post Learning Vim for Fun and Profit.
For more productivity tools and tricks, check these programs that saved me 100 hours and how I used a Visual Studio extension and a Git feature to get rid of two recurrent review comments.
Happy coding!