Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio errors in .cshtml for new Blazor project that compiles fine? how to disable it?

I just created new blazor project via

dotnet new blazorhosted

and opened FetchData.cshtml, but VS threw 9 errors at me.

Of course whole project is compiling & works fine, but it's very annoying

How can I disable showing errors for .cshtml files?

Visual Studio 2019 Preview

Severity    Code    Description Project File    Line    Suppression State
Error   CS0103  The name 'forecasts' does not exist in the current context  Blazor.Client   FetchData.cshtml    27  Active

Error   CS0115  'Template.ExecuteAsync()': no suitable method found to override Blazor.Client   FetchData.cshtml    1   Active

Error   CS0229  Ambiguity between 'Template.__o' and 'Template.__o' Blazor.Client   FetchData.cshtml    1   Active

Error   CS0229  Ambiguity between 'Template.__o' and 'Template.__o' Blazor.Client   FetchData.cshtml    1   Active

Error   CS0229  Ambiguity between 'Template.__o' and 'Template.__o' Blazor.Client   FetchData.cshtml    1   Active

Error   CS0103  The name 'page' does not exist in the current context   Blazor.Client   FetchData.cshtml    4   Active

Error   CS0103  The name 'inject' does not exist in the current context Blazor.Client   FetchData.cshtml    5   Active

Error   CS0103  The name 'forecasts' does not exist in the current context  Blazor.Client   FetchData.cshtml    11  Active

Error   CS0103  The name 'functions' does not exist in the current context  Blazor.Client   FetchData.cshtml    37  Active
like image 855
Axelly Avatar asked Dec 29 '18 15:12

Axelly


1 Answers

Sometimes Blazor blows up on me and throws errors on lines that have no errors, just like this.

I close the file(s), clean the entire solution, restart my computer, then rebuild just the project I am working on and it goes away.

Maybe that will work for you too.

like image 150
Joe Avatar answered Nov 04 '22 20:11

Joe