Search code examples
nuget-packageaspnetboilerplate

Test error :Could not load file or assembly 'Castle.Core, Version=4.0.0.0, Culture=neutral


I installed the free startup template of ASP.NET Boilerplate with the architecture Asp.Net Mvc5.x and Single Page Web Application Angular JS

and when I run the already added test to template as an example which is called Should_Get_Current_User_And_Tenant_When_Logged_In_As_Tenant() which is found in the project SpecificDownloadedProjectName.Tests

I get the error

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)

my current version of castle.core is v4.3.1

and of Abp 3.8.3

and these versions are the last latest available ones in NuGet packages

I tried to update Castle.core via NuGet Package Manager to be 4.0.0 as the exception message mentions but I couldn't with the following error

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   

what should I do in order to resolve this exception


Solution

  • This is the issue with the Nuget, it doesn't resolve it sometime, so you have to manually add the below lines in the web.config or app.config. You have to make sure the order of the lines also.

    <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>
    

    Note: You can set the oldVersion and newVersion values as per the requirement.