Forcing "server" comments on Visual Studio

28 Views Asked by At

On Visual Studio 2022, I am programming a website in asp.net core 8 C#.

Trying to comment some code via the button in the top bar, I get a "javascript" style comment if I am in javascript into a CSHTML. Can Visual Studio be told to always make razor-style "server" comments?

It would be helpful to reduce the plain text comments in the code once you compile and release the site.

1

There are 1 best solutions below

1
Tiny Wang On

I trust I can understand your requirement.

enter image description here

In js part, if we use the default comment way, it will give us //content which makes you worried about having too much plain text comments in the code , so that you want to have @* content *@ as the default comment for cshtml file.

However, I didn't find such settings in my VS 2022 community version. So that I'm afraid we couldn't set it directly.

enter image description here