Click here to Skip to main content
15,888,454 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Presently i am working with boilerlate framework, while doing unity testing i am getting below error.



Message: System.IO.FileLoadException : Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)


please help me out of this.

Thanks in advance.

What I have tried:

Actually i have no idea about unit test cases. so i did not tried anything.
Posted
Updated 6-Sep-17 0:44am

1 solution

The problem you have here has nothing to do with the unit tests, per se. The problem is that you either don't have Microsoft.Extensions.DependencyInjection.Abstractions referenced in your unit test assembly, or a dependency of this assembly is missing, or you have the wrong version of this assembly referenced by your unit test assembly. What is happening here is that, even though your unit test doesn't have any code that calls into this assembly (hence the reason your unit test compiles) but it's relying on it being there because your actual code is looking to use it. As this is from a nuget package, all you need do is add exactly the same nuget reference to your unit test assembly as you have in your main project.
 
Share this answer
 
Comments
Lokesh Rajana 6-Sep-17 8:08am    
yes i have tried with same nuget reference only, still it is not working.
Pete O'Hanlon 6-Sep-17 8:28am    
Look in your csproj file for the unit test. Is it exactly the same reference in there as for your main code?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900