Orchard Core 版本冲突 The type 'FormTagHelper' exists in both 'Microsoft.AspNetCore.Mvc.TagHelpers, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' and...

时间:2023-03-08 16:36:21

最近老大让我看Orchard Core,这是一个CMS系统。可以先参考大佬的文章:https://www.cnblogs.com/shanyou/archive/2018/09/25/9700422.html

我新建了一个空项目,更改Startup.cs

Orchard Core 版本冲突 The type 'FormTagHelper' exists in both 'Microsoft.AspNetCore.Mvc.TagHelpers, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' and...

然后启动项目,想着应该可以正常运行,可是报了下面这个错误:

  • The type 'RazorViewAttribute' exists in both 'Microsoft.AspNetCore.Mvc.Razor, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' and 'Microsoft.AspNetCore.Mvc.Razor, Version=2.1.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'

    +

    1. [assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/.Modules/OrchardCore.Setup/Views/Setup/Index.cshtml", typeof(AspNetCore.__Modules_OrchardCore_Setup_Views_Setup_Index))]
  • The type '__Modules_OrchardCore_Setup_Views_Setup_Index' already contains a definition for '__Microsoft_AspNetCore_Mvc_TagHelpers_SelectTagHelper'

    +

    1. private global::Microsoft.AspNetCore.Mvc.TagHelpers.SelectTagHelper __Microsoft_AspNetCore_Mvc_TagHelpers_SelectTagHelper;
  • The type 'FormTagHelper' exists in both 'Microsoft.AspNetCore.Mvc.TagHelpers, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' and 'Microsoft.AspNetCore.Mvc.TagHelpers, Version=2.1.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'

  • Orchard Core 版本冲突 The type 'FormTagHelper' exists in both 'Microsoft.AspNetCore.Mvc.TagHelpers, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' and...

    这个看起来像是版本的冲突。折腾了一阵子,通过安装Microsoft.AspNetCore.Mvc解决了。

  • Install-Package Microsoft.AspNetCore.Mvc