Search code examples
blazor.net-6.0visual-studio-2022

error the in razor.g.cs file, can't find in VS, can't find the _razor.g.cs file


I'm getting "; expected" error in my .razor file and in _razor.g.cs file,

In previous blazor versions I was finding these g.cs files in the solution folder, now I can't find them there, and double clicking on the error message in VS doesn't point me to anywhere (error message has no line number, the one for .g.cs has a line number), and I can't find the problem.

Where are the _razor.g.cs files located now ?


Solution

  • Edit the project file (.csproj) and add this:

    <PropertyGroup>
        <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>   
    </PropertyGroup>
    

    The file will by default go to obj\debug\net6.0\generated\...
    Click the "Show all files" button to find it.