3

I'm using linqtotwitter (v3.0.3), installed with NuGet.

It's working with VS2012 .NET 4.5

But when I try to deploy, taking this error on runtime;

Could not load file or assembly 'System.Net.Http.Primitives, ... or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.

System.Net.Http.Primitives.dll is in the folder.

Any ideas?

emrahustun
  • 31
  • 1
  • 5

3 Answers3

4

I just fixed the same problem. Look at your local web.config and see what's been added to the runtime > assemblyBinding section.

I added this to my live web.config and it fixed the problem.

  <dependentAssembly>
    <assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.2.22.0" newVersion="4.2.22.0" />
  </dependentAssembly>
Owen
  • 4,229
  • 5
  • 42
  • 50
1

LINQ to Twitter v3.0.3 has the following dependencies:

System.Net.Http.dll, v4.0.0.0
System.Net.Http.Extensions.dll, v2.2.18.0
System.Net.Http.Primitives.dll, v4.2.18.0
System.Net.Http.WebRequest.dll, v4.0.0.0

When you install the NuGet package, these assemblies install too and need to be deployed with the application.

Sometimes, you'll also see this error if you've included an assembly, but haven't deployed all of that assemblies dependencies. You can use a decompiler, or ILDasm, to look at the references that an assembly has to make sure you've included everything. I use Telerik's JustDecompile, which is free, and it lets you drill down on the reference tree to see everything you need to include.

Joe Mayo
  • 7,501
  • 7
  • 41
  • 60
1

I added linqtotwitter on a service project (using nuget), then got this error when attempting to run unit tests on in.

My unit test project already had the 'dependentAssembly' in the app.config, as mentioned elsewhere. What fixed it for me was to run nuget on the test project too.

From the package manager console, select your test (or web) project, then run:

Install-Package linqtotwitter
Dunc
  • 18,404
  • 6
  • 86
  • 103