https://docs.microsoft.com/en-us/visualstudio/ide/go-to-and-peek-definition
[*.cs]
indent_style = space
indent_size = 4
insert_final_newline = true
# Organize usings
dotnet_sort_system_directives_first = true
# RCS1090: Call 'ConfigureAwait(false)'.
dotnet_diagnostic.RCS1090.severity = none
- Code Style Preferences: https://learn.microsoft.com/en-us/visualstudio/ide/code-styles-and-code-cleanup?view=vs-2022
- Code Style Rules (full example): https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options
Tools, Options, Text-Editor, Code-Cleanup:
- "Select Code Cleanup Profile on Save profile": select "Profile 1"
- Enable "[x] run Code Cleanup Profile on Save"
- click "Configure Code Cleanup": Add Option "Fix all warnings and errors set in EditorConfig" to the top
Classic .NET: https://referencesource.microsoft.com/
Be aware of all security and performance issues!
Tools: Options:
- Enable Just My Code
- Enable .NET framework source stepping
- Debugging, Symbols: enable symbol file (.pdb) locations. I set the path to c:\temp\symbols\
Details: https://devblogs.microsoft.com/devops/understanding-symbol-files-and-visual-studios-symbol-settings/
- Tools: Options: Disable all XAML options, if you don't need it
- Text Editor: All Languages: Code Lense: disable it (also helps to reduce distraction, but unittest status might be helpful)
Start-Process -Wait -FilePath "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" -ArgumentList "update --passive --norestart --installpath ""C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise"""
ReSharper is very useful and I recommend it. But there are some downsides like cost and impacts on performance (especially on solution load time). There are other tools which are free and might help on your daily work. Check out my ReSharper alternatives in "Visual Studio Extensions"
See chapter .editorconfig for setting all the configuration:
- to avoid git issues, make sure all team members agree on the same tabs/spaces/indentation settings
- reduce merge conflicts by [x] Place 'System' directories first when sorting usings
Currently, I have all the following extensions installed and I cannot see any performance issues.
I like this option for several reasons:
- Automatically clean up your code, to avoid unused code (sort usings to avoid merge conflicts, remove unused usings)
- Format your code: this avoids merge conflicts. It is especially important, when you work in a team.
- Check the VS Code tools as well: https://github.com/boeschenstein/vscode1_information
An extension to cleanup and simplify our C#. Format on save is not enabled by default: Please enable this option: "Automatically run cleanup on save file".
A collection of 500+ analyzers, refactorings and fixes for C#.
Detect Code Quality and Security issues on the fly.
Generates a unit test boilerplate from a given C# class, setting up mocks for all dependencies. This tool can save you a lot of time crafting Unit tests. It supports all common frameworks. (XUnit, Moq, ...)
-
https://github.com/madskristensen/BasicEssentials
- Add New File
- Comment Remover
- Developer News
- File Icons
- Font Sizer
- Insert GUID
- Markdown Editor
- Output Enhancer
- Theme Switcher
- Tweaks
-
VS 2019: https://github.com/madskristensen/WebEssentials2019
-
VS 2022: https://marketplace.visualstudio.com/items?itemName=MadsKristensen.TheEssentials2022
Handle clientside packages in Visual Studio (similar to npm, webpack, yarn, bower)
https://docs.microsoft.com/en-us/dotnet/core/testing/unit-testing-code-coverage?tabs=windows
TODO: evaluate free tools:
- https://dotnetfoundation.org/projects/coverlet
- https://github.com/OpenCover/opencover
- https://doc.froglogic.com/squish-coco/latest/coveragescanner.html
- https://github.com/SteveGilham/altcover
Reporting
- https://marketplace.visualstudio.com/items?itemName=MadsKristensen.FileDiffer
- https://www.meziantou.net/comparing-files-using-visual-studio.htm
NsDepCop
- http://www.plainionist.net/Dependency-Governance-DotNet/
- https://github.com/realvizu/NsDepCop
This cannot be undone!
This resets all changese in the source folder to the current branch.
'git clean -fdx'
# to run this:
# 1) close visual Studio first
# 2) right click this file, run in PowerShell
$file1ToCheck = ".\MyVeryCoolSolution.sln"
"Current directory: " + (Get-Item -Path ".\").FullName
if ((Test-Path $file1ToCheck -PathType leaf))
{
"Solution file found."
} else {
throw "Solution file not found in current directory"
}
# delete subfolders
'========================== BEFORE ========================== '
Get-ChildItem .\ -include packages,bin,obj,bld,Backup,_UpgradeReport_Files,Debug,Release,ipch,help,.vs -Recurse
'========================== DELETING NOW ==================== '
Get-ChildItem .\ -include packages,bin,obj,bld,Backup,_UpgradeReport_Files,Debug,Release,ipch,help,.vs -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse }
'========================== AFTER =========================== '
Get-ChildItem .\ -include packages,bin,obj,bld,Backup,_UpgradeReport_Files,Debug,Release,ipch,help,.vs -Recurse
- If you haven't, install
everything
in your windows machine (best search tool ever: https://www.voidtools.com/) - Search for
vsdiffmerge
to get its path - Found it here:
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\vsDiffMerge.exe
- Open git-extensions, open settings for
difftool
andmergetool
- Select
vsdiffmerge
and use thevsdiffmerge
path