Reputation: 754518
I'm dipping my toes into Blazor, and I'm running into some trouble.
I have a Visual Studio 2019 Professional (v16.1.6) version installed, and .NET Core 3.0.0 Preview 5:
C:\projects> dotnet info
Welcome to .NET Core 3.0!
SDK Version: 3.0.100-preview5-011568
I created a "Blazor ASP.NET Core hosted" project from VS 2019, and I can run it just fine.
Now I wanted to add a "Blazor" page to the Pages
folder:
but I get this error:
Do I need to install anything more than basic VS2019Pro and .NET Core 3.0.0 preview 5? If so: what am I missing, what do I need in addition?
OK, so I tried to circumvent this trouble by adding a "regular" *.cshtml
page and then just renaming it to mypage.razor
. Trouble with that is: the @page "/mypage"
directive at the top of the file isn't recognized ("The name 'page' isn't recognized in the current context") - why? Can I fix that somehow??
Any inputs are most welcome! Thanks a heap
Upvotes: 0
Views: 497
Reputation: 45626
You can't add a Razor Page to a Blazor app. Razor Page is a thing you add to your Razor Pages application. In Blazor no such objects as Razor Pages exist. You should add a Component. You may have a Component page, as for instance, MyDocPage, which contains child components.
In order to use IUriHelper, you have to inject it into your components. It is automatically added into the DI container by the Blazor framework.
Hope this helps...
Upvotes: 1
Reputation: 20048
IMHO, dev issue.
You can see that it has happend before, they have fixed it and now again: https://developercommunity.visualstudio.com/content/problem/431328/scaffolding-error-there-are-no-scaffolders-support.html
Report a bug and it will be fixed again :P
Upvotes: 2