DotNet Development without Visual Studio (using VS Code)

February 21, 2022    Web Development Angular Node NPM

DotNet Development without Visual Studio using VS Code

I get to start a new contract with a brand new, fast laptop! Hurray! The challenge is to avoid an MSDN license for Visual Studio. This product has a lot of .csproj and .fsproj in a larger solution.

I was able to do work, but ran into a few things that caused me to request and receive a VS license anyways. I’ll note them at the bottom.

Earlier I shared about the challenges I encountered with setting up for Angular development without Visual Studio .

Extensions

  • C# Omnisharp
  • .NET Core Test Explorer
  • .NET Extension Pack, includes Ionide for F#

Optional and Helpful Extensions

  • Azure Tools
  • GitLens, Git Tree Compare, Git Graph
  • vscode-solution-explorer is helpful for solutions
    • right click on a project to run/debug
  • Nuget Gallery by pcislo
  • Visual Studio IntelliCode
  • Visual Studio Keymaps
  • Docker
  • Kubernetes
  • Azure Kubernetes Service
  • Angular Language Service
  • Other JS/TS extensions
    • TS Lint
  • Beautify
  • Code Spell Checker
  • CodeMetrics

Chrome Dev Tools Extension

Building

Open at the correct folder, go to the Run and Debug tab, change the top to the project you want to run. The launch.json lists all the projects.

With the solutions explorer, you can find it and right click to run.

Alternatively, If you open the directory, you’ll need a launch.json for that directory

ctrl+shift+b will build

F5 will run with a debugger

You can always use dotnet run in the command line.

Docs on Tasks in VS Code .

Run Tests

The tests are written with xUnit.

dotnet test from the project file directory works

Use the .NET Core Test Explorer extension

I had to open the folder of the .fsproj to get the F# tests to run in the test explorer.

Jasmine tests run from the command line or they might show up in the Test explorer.

MS VS Code Testing docs

Where I ended up

I was able to get on-boarded, fix a few bugs and be productive without Visual Studio for about a month. When I started adding new unit tests, in an unfamiliar code base, I kept getting NullReferenceExceptions. This caused the VS Code Test Explorer extension to stop working and I couldn’t run the test again. I had to re-start VS Code to run the test again. I also found the Test Explorer extension hard to work with across multiple projects and it was slowing me down.

I now have Visual Studio 2022 for DotNet development, sometimes I just use Windows Terminal to start up the api with dotnet run. I do all of my Angular/web development in VS Code. This is working well for me.

2024 Update

The C# Dev Kit promises to make this much better. You do need a Visual Studio license to use it.



Watch the Story for Good News
I gladly accept BTC Lightning Network tips at [email protected]

Please consider using Brave and adding me to your BAT payment ledger. Then you won't have to see ads! (when I get to $100 in Google Ads for a payout, I pledge to turn off ads)

Use Brave

Also check out my Resources Page for referrals that would help me.


Swan logo
Use Swan Bitcoin to onramp with low fees and automatic daily cost averaging and get $10 in BTC when you sign up.