aspnetboilerplate - 测试错误:无法加载文件或程序集'Castle.Core,版本 = 4.0.0.0,文化 = 中性
问题描述
我用架构 Asp.Net Mvc5.x 和 Single Page Web Application Angular JS 安装了 ASP.NET Boilerplate 的免费启动模板
并且当我将已添加的测试作为示例运行到模板时,该示例称为 Should_Get_Current_User_And_Tenant_When_Logged_In_As_Tenant() 可以在项目 SpecificDownloadedProjectName.Tests 中找到
我得到错误
Could not load file or assembly 'Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
我当前的 castle.core 版本是 v4.3.1
和 Abp 3.8.3
这些版本是 NuGet 包中最新的可用版本
我尝试通过 NuGet 包管理器将 Castle.core 更新为 4.0.0,正如异常消息中提到的那样,但我无法出现以下错误
Severity Code Description Project File Line Suppression State
Error Unable to resolve dependencies. 'Castle.Core 4.0.0' is not compatible with 'Abp 3.8.3 constraint: Castle.Core (>= 4.3.1)', 'Castle.Core-log4net 4.3.1 constraint: Castle.Core (= 4.3.1)', 'Castle.DynamicProxy 2.2.0 constraint: Castle.Core (= 1.2.0)'. 0
我应该怎么做才能解决这个异常
解决方案
这是 Nuget 的问题,有时无法解决,因此您必须在 web.config 或 app.config 中手动添加以下行。您还必须确保行的顺序。
<dependentAssembly>
<assemblyIdentity name="Castle.Core" publicKeyToken="407dd0808d44fbdc" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.0.0.0" />
</dependentAssembly>
注意:您可以根据需要设置 oldVersion 和 newVersion 值。
推荐阅读
- angular - 滑动时垫滑块值未更新
- python - PYTHON:如何在 python 文本中显示点
- c - 该程序打印“hello”而不是“Hi”。如何?
- c# - 无法使用简化的 Draw 方法翻转精灵
- python - 如何在文件路径中使用变量
- javascript - firebase 云函数无法读取未定义的属性“ref”
- c# - Entity Framework Core:如何使用存储过程的结果集并通过维护异步将其映射到对象和对象的对象
- java - 无法创建我班级的对象 - 为什么?
- javascript - 语义 UI 无法从多个选择下拉列表中获取文本和值
- azure - 如何使用 ADF V1 设置管道以将数据从 Redshift(SSH 隧道)提取到 Azure 数据仓库?