Viewing Blazor auto-generated code

When you build an app with a .razor component in it, the compiler will auto-generate code to build the render tree. If you want to see the generated code you can edit your .csproj file and add the following to your <PropertyGroup> node.


After you build your application, look in the obj folder that is generated. In there you will see something like Debug\net6.0\generated\(etc) – just follow the folder structure down until you find some .cs files. That’s where you’ll find what you are looking for.


Leave a Reply

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