Dominic Böttger

← Back to blog

Published on Sun May 10 2020 00:00:00 GMT+0000 (Coordinated Universal Time) by Dominic Böttger

Visual Studio Code is my favorite Code Editor and I like that it’s so lightweight and also wanted to use it for C# development instead of the full-blown Visual Studio experience.

Some time ago I tried to use Visual Studio Code instead but I was missing some things to improve the development workflow. I wanted to have features like live unit testing and better guidance while coding C#. I tested some plugins and some configurations and now I think I found a solution to fulfill my needs.

Essential Extensions

  1. C# - THE C# extension powered by OmniSharp
  2. .NET Core Test Explorer - Live testing while coding
  3. Auto-using - Automatically adds using statements
  4. C# FixFormat - Auto-format code on save
  5. Coverage Gutters - Visualize code coverage
  6. Fakesharper - Integrates Resharper into VSCode

Configuration

Add these settings to .vscode/settings.json:

{
  "dotnet-test-explorer.testProjectPath": "**/*Test.csproj",
  "dotnet-test-explorer.autoWatch": true,
  "dotnet-test-explorer.testArguments": "/p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=./lcov.info",
  "omnisharp.enableRoslynAnalyzers": true,
  "csharpfixformat.sort.usings.enabled": true,
  "editor.formatOnSave": true,
  "[csharp]": {
    "editor.defaultFormatter": "Leopotam.csharpfixformat"
  }
}

StyleCop Integration

Add StyleCop.Analyzers via NuGet, then add the ruleset path to your csproj:

<PropertyGroup>
  <CodeAnalysisRuleSet>..\StyleCop.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>

A complete example template is available at github.com/dominicboettger

Written by Dominic Böttger

← Back to blog
  • Turn Your Surface Pro 6 Into a Home Assistant Voice Satellite

    Turn Your Surface Pro 6 Into a Home Assistant Voice Satellite

    Transform your old Surface Pro 6 into a powerful voice assistant for Home Assistant using Wyoming Satellite and openWakeWord. The conference-grade microphones make it perfect for voice control.

  • Fix Surface Pro Touch After Suspend on Linux

    Fix Surface Pro Touch After Suspend on Linux

    How to fix the Surface Pro touchscreen losing functionality after suspend/resume on Linux with the linux-surface kernel using systemd sleep hooks.

  • AvePoint Fly Migrator TLS 1.2 workaround

    AvePoint Fly Migrator TLS 1.2 workaround

    A workaround to enable TLS 1.2 support for IMAP migrations with AvePoint's Fly Migrator.

  • Optimize Visual Studio Code for C# .NET Core development

    Optimize Visual Studio Code for C# .NET Core development

    A brief introduction and some information on how VSCode can be optimized for a great C# .NET core developer experience.

  • Pretty Windows Terminal and PowerShell Setup

    Pretty Windows Terminal and PowerShell Setup

    My Windows Terminal and PowerShell configuration. It includes modules like git-posh and oh-my-posh to beautify the command-line experience.

  • Securely fight COVID-19 in a Windows Sandbox

    Securely fight COVID-19 in a Windows Sandbox

    A simple script which installs the Folding@Home client into a Windows Sandbox.