My Pluralsight training says Blazor Server side pages have the .razor extension. I have seen training on the web with cshtml files but I figure they are not using razor pages. When I add Razor Page in VS2019 the resulting page extension is .cshtml. What
am I doing wrong? Thanks
Blazor and Razor Pages are two different development frameworks. Blazor Components (officially
Razor components) have a .razor extension. Razor Pages have a .cshtml extension. The _Host.cshtml Razor Page in server-side Blazor is used to host the Blazor application. Beyond that, you should not need to add Razor Pages to a server-side Blazor application.
You should add Razor Components and give them an @page directive so that they are navigable. Razor Pages and Razor Component are two different items in the New Item dialog. You need this one for Razor/Blazor Components:
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
None
0 Points
1 Post
Confused on Basic Blazor
Oct 16, 2019 02:36 AM|arheck|LINK
My Pluralsight training says Blazor Server side pages have the .razor extension. I have seen training on the web with cshtml files but I figure they are not using razor pages. When I add Razor Page in VS2019 the resulting page extension is .cshtml. What am I doing wrong? Thanks
All-Star
194525 Points
28083 Posts
Moderator
Re: Confused on Basic Blazor
Oct 16, 2019 06:47 AM|Mikesdotnetting|LINK
Blazor and Razor Pages are two different development frameworks. Blazor Components (officially Razor components) have a .razor extension. Razor Pages have a .cshtml extension. The _Host.cshtml Razor Page in server-side Blazor is used to host the Blazor application. Beyond that, you should not need to add Razor Pages to a server-side Blazor application. You should add Razor Components and give them an @page directive so that they are navigable. Razor Pages and Razor Component are two different items in the New Item dialog. You need this one for Razor/Blazor Components:
Contributor
2710 Points
874 Posts
Re: Confused on Basic Blazor
Oct 16, 2019 06:58 AM|Rena Ni|LINK
Hi arheck,
You need to updated Visual Studio 2019 v16.3 or later.And install asp.net core 3.0. Then you could find the .razor file like below:
Reference: https://dotnet.microsoft.com/download/dotnet-core/3.0
Best Regards,
Rena