locked
Confused on Basic Blazor RRS feed

  • Question

  • User-705093314 posted

    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

    Wednesday, October 16, 2019 2:36 AM

All replies

  • User-821857111 posted

    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:

    Wednesday, October 16, 2019 6:47 AM
  • User711641945 posted

    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

    Wednesday, October 16, 2019 6:58 AM