Home > Net >  Blazor unhandled exception: Cannot provide a value for property 'BlazorStrapSrc' on type &
Blazor unhandled exception: Cannot provide a value for property 'BlazorStrapSrc' on type &

Time:01-12

I am using VS 2022 and created a Blazor WebAssembly ASP.NET Core hosted project. I want to implement an image slider on my Index.razor and tried to use BlazorStrap. This is the code I am using:

@using BlazorStrap
<BSCarousel HasControls="true" HasIndicators="true" >
    <BSCarouselItem>
        <svg  width="800" height="400" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: First slide" preserveAspectRatio="xMidYMid slice" focusable="false">
            <rect width="100%" height="100%" fill="#777"></rect><text x="50%" y="50%" fill="#555" dy=".3em">First slide</text>
        svg>
    </BSCarouselItem>
    <BSCarouselItem>
        <svg  width="800" height="400" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: Second slide" preserveAspectRatio="xMidYMid slice" focusable="false">
            <rect width="100%" height="100%" fill="#666"></rect><text x="50%" y="50%" fill="#444" dy=".3em">Second slide</text>
        </svg>
    </BSCarouselItem>
    <BSCarouselItem>
        <svg  width="800" height="400" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: Third slide" preserveAspectRatio="xMidYMid slice" focusable="false">
            <rect width="100%" height="100%" fill="#555"></rect><text x="50%" y="50%" fill="#333" dy=".3em">Third slide</text>
        </svg>
    </BSCarouselItem>
</BSCarousel>

But if I start to debug it I get this error:

enter image description here

enter image description here

What do I need to do? What did I forgot?

CodePudding user response:

You may not have registered BlazorStrap in services?

builder.Services.AddBlazorStrap();

  •  Tags:  
  • Related