Must a Blazor web app only use .razor components?

Falanga, Rod, DOH 245 Reputation points
2025-02-05T18:34:19.34+00:00

Very simple question here, so please be gentle with me.

I started a new Blazor app in early November 2024. The last time I worked on it was early December 2024, when several other urgent demands came up and I had to put this app aside until now. I cannot remember exactly what template I chose when creating this app, but it has both CSHTML and Razor files within it. I've run into a problem, so I started looking for solutions. On Stack Overflow I saw an answer to a different question, which left me with the impression that one should NEVER use CSHTML files within a Blazor web app. I thought that using both CSHTML and RAZOR within the same project was fine, so long as when you use a Blazor component it is referenced as a Blazor component. But this person's adamant emphasis that under no circumstances should you use a CSHTML file in a Blazor app has me doubting myself/understanding.

So, basically is this person's assertion that a CSHTML file must never, under any circumstances, be within a Blazor app true?

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,665 questions
{count} votes

Your answer

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