Formatting Razor Files in Visual Studio Code

You can introduce them as HTML files (File -> Preferences -> Settings) without any 3rd party extensions:

{
  "editor.formatOnSave": true,
  "emmet.includeLanguages": {
    "aspnetcorerazor": "html"
  },
  "files.associations": {
    "*.cshtml": "html"
  }
}

Update: v1.17.0 of C# for Visual Studio Code add-on added preview Razor (cshtml) language service with support for C# completions and diagnostics.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)