Orchardcore: Multiple Build Errors after Upgrading Module Project Packages to v1.0.0-beta3-68699

Created on 3 Oct 2018  路  5Comments  路  Source: OrchardCMS/OrchardCore

I have an existing ASP.NET Core Module Project that had been working. I updated all the NuGet packages to 1.0.0-beta3-68699. I believe this has something to with the changes that @sebastienros made for #2441. I am getting several build errors.:

CS0433 The type 'ModuleMarkerAttribute' exists in both 'OrchardCore.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' and 'OrchardCore.Modules.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'

CS0433 The type 'StartupBase' exists in both 'OrchardCore.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' and 'OrchardCore.Modules.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'

CS0433 The type 'IShellHost' exists in both 'OrchardCore.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' and 'OrchardCore.Environment.Shell.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'

image

OrchardCore.Environment.Navigation has not been updated.

Most helpful comment

Here is the implementation of my menu. It adds a store menuitem and a client menuitem underneath it in the admin area. I basically got this from the OrchardCore source code and modified it to meet my needs. The INavigationProvider internface now has a BuildNavigationAsync() method, that may be what is throwing you off.

using Microsoft.Extensions.Localization;
using OrchardCore.Navigation;
using System;
using System.Threading.Tasks;

namespace Dockaltech.Clients
{
    public class AdminMenu : INavigationProvider
    {
        public AdminMenu(IStringLocalizer<AdminMenu> localizer)
        {
            T = localizer;
        }

        public IStringLocalizer T { get; set; }


        public Task BuildNavigationAsync(string name, NavigationBuilder builder)
        {           
            if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase))
            {
                return Task.CompletedTask;
            }

            builder
                .Add(T["Store"], "15", test => test
                    .AddClass("menu-store").Id("store")
                .Add(T["Clients"], "1", clients => clients
                    .Action("Index", "Admin", new { area = "Dockaltech.Clients" })
                    .LocalNav()
                    )
                );
            return Task.CompletedTask;
        }
    }
}

Then in Startup.cs for your module:

public override void ConfigureServices(IServiceCollection services) { services.AddScoped<INavigationProvider, AdminMenu>(); }

All 5 comments

I believe you can remove OrchardCore.Modules.Abstractions and OrchardCore.Environment.Navigation from the project. This is related to #2199.

I am using INavigationProvider to modify the Admin Menu. Has this Interface been moved to another package?

Ok fixed it. Added package OrchardCore and OrchardCore.Menu. Removed OrchardCore.Modules.Abstractions and OrchardCore.Environment.Navigation as @awyl suggested.
`
image

@mdockal I had the same problem. Google search led me here. However, after adding / removing as per the thread, I still get errors with INavigationProvider (needing OrchardCore.Environment.Navigation).

How did you implement the interface? Thanks in advance.

Here is the implementation of my menu. It adds a store menuitem and a client menuitem underneath it in the admin area. I basically got this from the OrchardCore source code and modified it to meet my needs. The INavigationProvider internface now has a BuildNavigationAsync() method, that may be what is throwing you off.

using Microsoft.Extensions.Localization;
using OrchardCore.Navigation;
using System;
using System.Threading.Tasks;

namespace Dockaltech.Clients
{
    public class AdminMenu : INavigationProvider
    {
        public AdminMenu(IStringLocalizer<AdminMenu> localizer)
        {
            T = localizer;
        }

        public IStringLocalizer T { get; set; }


        public Task BuildNavigationAsync(string name, NavigationBuilder builder)
        {           
            if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase))
            {
                return Task.CompletedTask;
            }

            builder
                .Add(T["Store"], "15", test => test
                    .AddClass("menu-store").Id("store")
                .Add(T["Clients"], "1", clients => clients
                    .Action("Index", "Admin", new { area = "Dockaltech.Clients" })
                    .LocalNav()
                    )
                );
            return Task.CompletedTask;
        }
    }
}

Then in Startup.cs for your module:

public override void ConfigureServices(IServiceCollection services) { services.AddScoped<INavigationProvider, AdminMenu>(); }

Was this page helpful?
0 / 5 - 0 ratings