ServiceStack’s razor template uses MVC Razor .cshtml pages but Blazor .razor Component pages uses the @page directive for routing, you can create a Blazor Server template from:
The only server Razor templates we have are razor and the MVC Project templates, you can try starting with mvc to see if you can configure it to also use Razor pages, otherwise you can request a feature request for a new Razor Pages project template at:
I’ve created a version of ViewPage (RazorViewPage) that derives from Microsoft.AspNetCore.Mvc.RazorPages.Page instead, and this only required a few tweaks to get working.
Now the ‘The name ‘PageContext’ does not exist in the current context’ error is gone.
Happy to throw in a PR showing what I have done if it might be useful to somebody else, I would also be interested to see how this could be integrated into ServiceStack.Mvc.
To support Razor Pages properly required a few changes in ServiceStack which is now available from v6.5.1+ on MyGet.
I’ve also created a new razor-pages template containing an integrated example configured with Auth, Registration, form binding, validation, CRUD & Todo MVC example.
$ x new razor-pages ProjectName
It’s also using our new modern JS script module support which takes advantage of browsers native module support which enables modern JS development without any npm tooling that we’re moving other templates to use. To update the typed DTOs you can update the x dotnet-tool and update dto.mjs with: