I have a Blazor app and a Razor library.
In my Razor library, I have a component, AccountNavigation.razor
that i am able to use with html syntax and it works correctly, like so: <AccountNavigation />
The problem is with another component, Login.razor
is in the same library, with @page "/login"
written at the top of it. No links work to href="/login"
or even if i try the route manually it does not work. If I move Login.razor
to the Blazor app project, it then will work.
My Razor library project is as follows:
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup Label="Globals">
<SccProjectName>SAK</SccProjectName>
<SccProvider>SAK</SccProvider>
<SccAuxPath>SAK</SccAuxPath>
<SccLocalPath>SAK</SccLocalPath>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.0.3.5</Version>
<LangVersion>8.0</LangVersion>
<RazorLangVersion>3.0</RazorLangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.RazorPages" Version="2.2.5" />
</ItemGroup>
</Project>
I've also tried targetting net core 3.0 and same issue. My Razor library only has 3 files in it. The working AccountNavigation.razor
, Login.razor
, and _Imports.razor
. Is there something that I am missing?
Test.razor
), does that component work? – BurnetteSorry, there's nothing at this address.
And yes, the library is referenced correctly, and another component in the Razor library works when i use it as a view component as stated in my original question. The problem only arises when I try and use the components as pages and try routing to them. – Perutz