thelarz/MvcBreadCrumbs

Doesn't work with dnx 5.0

Opened this issue · 5 comments

rykr commented

What needs to be done to have this work with dnx 5?

I use a complex several line page header which has the breadcrumbs above the navigation menu and not below like most other approaches requires. The thelarz/MVCBreadCrumbs it works perfectly for this by putting the @Html.Raw(BreadCrumb.Display()) statement in the _Layouts.chtml.

My problems is I am building a VS 2015 DNX451 MVC6 application and the MVCBreadCrumbs does not work due to dependency incompatibilities.

What are the future plans for MVCBreadCrumbs? Will there be a compatible version anytime soon?
Regards, Brooks

I made the project in .NET Core for my application
https://mega.nz/#!0lwhRZqC!je6_IkMtlEyNm0gBN9y2kWfzDQZAxU_c8zgF1xpoDBo

Add this to startup.cs
` services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();

        services.AddSingleton<MvcBreadCrumbs.Core.BreadCrumb>();`

Then I created a viewcomponent:

`
public class BreadCrumbViewComponent : ViewComponent
{
private readonly BreadCrumb breadCrumb;

    public BreadCrumbViewComponent(BreadCrumb breadCrumb)
    {
        this.breadCrumb = breadCrumb;
    }

    public async Task<IViewComponentResult> InvokeAsync()
    {
        return View(breadCrumb);
    }
}`

and then view/shared/components/breadcrumb/default.cshtml
`@model BreadCrumb

@Html.Raw(Model.Display())`

best regards
Dominic Rooijackers

That's really good info. Thanks Dominic. I hope to have some time to circle around and work on this too.

Ok, let me know if you need some help.

It doesn't work with MVC5. I followed the instructions provided by Larz (https://github.com/thelarz/MvcBreadCrumbs/blob/master/README.md) but it didn't show anything on the screen. All I got was a white bar at the top instead of subnavigation levels displayed. See below:

`The layout page:

<div class="container-fluid body-content">
@Html.Raw(BreadCrumb.Display())
@RenderBody()

The child page:

[BreadCrumb]
public class UsersController : Controller
{
public ActionResult Index()
{
return View();
}
}`