Share via

Why are there no .razor files on the deployed server?

Falanga, Rod, DOH 980 Reputation points
2026-05-01T17:19:36.4433333+00:00

I've been developing web applications using Microsoft technologies, since WebForms. I'm used to seeing the HTML page files in the deployed folder on the web server. Now I am deploying a small Blazor application to an internal server using GitHub Self-Hosted Runner on an internal server. Looking at the folder on the destination server, I see .dlls, an .exe (for the application), a few .pdb and .json files. But no .razor files. But when I run the app I see the Blazor pages fine.

I realize that both the .razor and .razor.cs files are partial classes. Does the building of the application incorporate the UI into the .dlls files or the .exe file?

Developer technologies | .NET | Blazor
0 comments No comments

Answer accepted by question author

  1. Danny Nguyen (WICLOUD CORPORATION) 6,785 Reputation points Microsoft External Staff Moderator
    2026-05-04T04:15:18.8066667+00:00

    Hi @Falanga, Rod, DOH .

    To confirm what the earlier Q&A Assist's Answer mentioned:

    This is expected for Blazor.

    .razor files are project source files. When you build/publish, the Razor tooling generates C# from each .razor component and compiles it into your app’s assemblies (your app DLL and any referenced component-library DLLs). The published .exe is the entry point that runs the app and loads those assemblies.

    So the UI from the .razor files is included in the compiled DLLs, which is why the app works even though no .razor files are deployed.

    References:

    Hopefully this would provide some additional insights. I would greatly appreciate it if you could follow this guidance or provide feedback.

    Thank you.

    2 people found this answer helpful.
    0 comments No comments

Answer accepted by question author

  1. Q&A Assist
    2026-05-01T17:19:46.5733333+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    Razor (.razor) files are compile-time artifacts, not runtime content. During build and publish, the Razor compiler turns each .razor file into a .NET class and compiles that class into the app’s assemblies, so the original .razor files are not deployed.

    For Blazor apps:

    • Each Razor component file (.razor) is compiled into a .NET class when the project is built. The generated class contains the component’s state, rendering logic, lifecycle methods, event handlers, and other logic.
    • The compiled component classes are included in the app’s main assembly (for example, <app_name>.dll) or in referenced class library assemblies, not as separate .razor files on disk.
    • With the Razor SDK and source generation enabled (UseRazorSourceGenerator is true by default), views/components are compiled into the main assembly and a separate <app_name>.Views.dll isn’t produced.

    Therefore, the UI defined in .razor files is incorporated into the compiled DLLs that are deployed alongside the app’s EXE, which is why the app runs correctly even though the .razor source files aren’t present on the server.


    References:

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.