Here in my code in my ASP.NET Core project I have that's causing the issue:
As Text:
<script>
/**
* Get a setting value.
* @param {string} name
* @param defaultValue
* @returns {*}
*/
getSetting(name, defaultValue) {
return name in this.settings ? this.settings[name] : defaultValue;
}
</script>
The error that I'm getting for every documentation code, which is red lined is https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/cs0103
which gets clearly identified as C# code, even though I'm writing this code in a .cshtml file <script> tag...
How do I fix this? It prevents me from compiling and executing...
I am using Visual Studio 2022 Preview 4.1 if that matters
.cshtml files are interpreted as Razor templates where @ is used to mark C# code in the template.
You can either escape with a second @ i.e. @@param etc or move the JS to a separate file.