测试错误:无法加载文件或程序集'Castle.Core,Version = 4.0.0.0,Culture = neutral

问题描述 投票:0回答:1

我安装了ASP.NET Boilerplate的免费启动模板,其架构为Asp.Net Mvc5.x和单页Web应用程序Angular JS

当我将已经添加的测试运行到模板作为一个名为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   

我该怎么做才能解决这个异常

aspnetboilerplate
1个回答
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值。

© www.soinside.com 2019 - 2024. All rights reserved.