VS Code for ASP.NET Core projects

I’ve been using macOS as my main developer operating system for about 1 year and a half and I have to say, it’s really AWESOME. With Visual Studio Code and ASP.NET Core, we don’t need to be restricted to Windows (even though some people really like it).

After some months working on a really big project with ASP.NET Core, I learned some interesting things that I would like to share. They are a bunch of settings that are quite useful when developing with Visual Studio Code.

Note: You should put there configs in .vscode/.settings.json file

Editor config settings

They make your code as beautiful as inside Visual Studio Professional Edition

1
2
3
4
5
6
7
8
{
"csharpfixformat.style.braces.onSameLine": false,
"csharpfixformat.style.spaces.beforeParenthesis": false,
"editor.tabSize": 4,
"csharp.format.enable": false,
// if your solution has LOT of projects
"omnisharp.projectLoadTimeout": 10000
}

Connecting to a database

We don’t need management studio (when doing simple things)

If you want do Query database inside VSCode you can add this extension and add the connections to your settings file

1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
"mssql.connections": [
{
"server": "localhost",
"database": "some_database_dev",
"authenticationType": "SqlLogin",
"user": "SA",
"password": "YOUR_INSECURE_PASS",
"emptyPasswordInput": false,
"savePassword": true,
"profileName": "LocalhostDatabase"
}
]
}

Running multiple projects

It’s easier than in Visual Studio Professional

1
2
3
4
5
6
7
8
{
"compounds": [
{
"name": "Run All",
"configurations": ["Launch A", "Launch B", "Launch C"]
}
]
}

These settings are simple but they can be very useful in your code routine :)