0

I converted my console app to Class Library project so that I can use dll again for multiple project. I am getting an error

Could not load file or assembly 'System.Net.Http.Primitives, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f711d50a3a' or one of its dependencies. The system can not find the file

I've already tried the solution mentioned here: Could not load file or assembly System.Net.Http.Primitives. Located assembly's manifest definition does not match the assembly reference.

But no luck. Any suggestion

mmBs
  • 8,421
  • 6
  • 38
  • 46
Ammar Khan
  • 346
  • 1
  • 9
  • 27
  • Maybe this can help you: http://stackoverflow.com/questions/18370360/could-not-load-file-or-assembly-system-net-http-primitives-located-assemblys-m – mike00 Feb 27 '14 at 09:41
  • Are you referencing it directly from your project ? – ilansch Feb 27 '14 at 09:42
  • No, I am referencing it with the dll – Ammar Khan Feb 27 '14 at 09:42
  • So you do reference it directly. When you stand on the project, do you see it in your reference list ? what is the DLL name ? is it Copy local property = true ? – ilansch Feb 27 '14 at 09:43
  • @Rasher that solution not work for me. Let me tell you something that, When I reference my dll into Console App and add those config line. It works. But it is not working when I am inside Win Form App. – Ammar Khan Feb 27 '14 at 09:44
  • @ilansch Yes Copy Local property set to true – Ammar Khan Feb 27 '14 at 09:45

3 Answers3

0

1- check if you are referencing an assembly which in turn referencing an old version of unity. for example let's say you have an assembly called ServiceLocator.dll which needs an old version of Unity assembly, now when you reference the ServiceLocator you should provide it with the old version of Unity, and that makes the problem.

2- may be the output folder where all projects build their assemblies, has an old version of unity.

you can use FuseLogVw application to find out who is loading the old assemblies, just define a path for the log, and run your solution, then check (in FuseLogvw) the first line where the Unity assembly is loaded, double click it and see the calling assembly, and here you go.

Your problem posted here previously: Could not load file or assembly or one of its dependencies

Please search before rising your question. Thanks

Community
  • 1
  • 1
NoName
  • 877
  • 12
  • 28
  • Where I can get Fuslogvw.exe? – Ammar Khan Feb 27 '14 at 09:53
  • I give you the name of it and link to detail information. Then you just search, download and use it. It's very easy, guy. Your problem solved by yourself, another just give you some advices. – NoName Feb 27 '14 at 09:57
  • Can you please tell me how can I define custom log path. It gives me an error Custom log path mus not be relative. I have logging folder in c drive – Ammar Khan Feb 27 '14 at 10:18
  • I got the log and it seems that, It tried to load System.Net.Http.Primitve.dll from Win Form app bind folder but actually It exist inside my class library project bin folder. Now How can I fix it? Any suggestion – Ammar Khan Feb 27 '14 at 10:33
  • Although exception get fixed. It's now pointing to right location. But now when I try to debug the code It just stope in the middle. Any idea? – Ammar Khan Feb 27 '14 at 10:56
0

try right click -> Properties -> Build Action -> Embeded Resource should make it work

Lucky Lefty
  • 347
  • 1
  • 8
0

I will show you clearly the mean of Lucky Lefty. In Solution Explorer, right click on you .dll file and choose properties. The properties pane appears then on Buil Action option, you choose Embeded Resource. After that, you rebuil your solution.

You can view more information from here: http://www.codeproject.com/Articles/528178/Load-DLL-From-Embedded-Resource

Remember: Google search is your best friend.

NoName
  • 877
  • 12
  • 28