Using Visual Studio Code for .NET Framework Projects in C#

As Visual Studio Code is the only completely free member of Visual Studio family now that Visual Studio Express is gone (and no, Community edition doesn’t count as a proper replacement), I wanted to have some of my projects debuggable from within it. While .NET Core works out of box, it takes a bit of effort to setup a full .NET Framework project.

First step is, of course, hunt on Stack Overflow. If you are lucky you might find a guide how to do it that actually works perfectly once you do a few modifications to your project. However, depending on your project, you might not need to go that far.

To start, destination computer will require something that can build your projects. Since installing Visual Studio makes the whole exercise a bit pointless, go and download Build Tools for Visual Studio 2019.

To your Visual Studio Code workspace add familiar .vscode directory and add tasks.json that will build your project. Based on a few of my .NET Framework projects, I found the following common denominator to do wonders (of course, change name of solution and exact path to your source and binaries):

"version": "2.0.0",
"tasks": [
"label": "build",
"dependsOn": [ "clean" ],
"type": "process",
"windows": {
"command": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\MSBuild\\Current\\Bin\\amd64\\msbuild.exe",
"args": [
"options": { "cwd": "${workspaceFolder}/Source/" },
"group": "build"
"label": "clean",
"type": "shell",
"windows": {
"command": "DEL",
"args": [ ".\\Binaries\\*" ]

Here you can already see the trick – we’re adding parameters as argument to MSBuild instead of modifying the project file. I found that most projects (definitely all I tried) are only missing portable debug type and x64 as a platform target (I am still sucker for Any CPU). If it doesn’t work for you, go and check the original article to see if something else is missing.

And the last step is placing launch.json into .vscode directory (again, adjust names):

"version": "0.2.0",
"configurations": [
"name": ".NET Framework Launch",
"type": "clr",
"request": "launch",
"preLaunchTask": "build",
"program": "Program.exe",
"args": [],
"cwd": "${workspaceFolder}/Binaries/",
"stopAtEntry": false

This should be sufficient to get you debugging in a pinch.

3 thoughts to “Using Visual Studio Code for .NET Framework Projects in C#”

  1. Thanks for your tips, I was finally able to debug a little bit in VsCode for my complex WPF application with multiple projects nicely. Key point was to ensure that MSBuild was ran with both DebugType set to portable and x64 as platform. Thanks!

  2. … “and no, Community edition doesn’t count as a proper replacement”
    Why? No reason given.
    I would say it does.

    1. I does for a independent developer. However, if you are working in a company with more than a few employees, you cannot use Community Edition (not allowed by license). License for VS Express didn’t have such limitations.

      Now, you can say that any big company should have VS license anyhow and that’s probably true. However, it does complicate situation for people whose primary work is not in Visual Studio and who develop their own internal tools for fun. And, even if developer does have the license, it complicates things as you need to take care where you install it and whether person you install it for has license to cover his ass.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.