[SOLVED] VS Code: How to enable .CSS intellisense for ASP.NET .cshtml files?

Issue

I have installed the "HTML CSS Support" extension for VS Code but it only seems to work on files with extension .html. I can’t get it to work with .cshtml files unless I rename the file temporarily to html but that’s cumbersome.

What’s the best way to enable VS Code to provide intellisense for local and remote .css files for use in .cshtml files?

Solution

In order to associate .cshtml files to html formatter, you can insert the following snippet in your settings.json file:

  "files.associations": {
    "*.cshtml": "html"
  }

that way vscode treats .cshtml files like html file and you should be able to use formatters and intellisense in those files.


Besides, you can use this workaround using this extension to change the language-mode-setting of vscode.

Answered By – Empiire

Answer Checked By – David Marino (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *