Ammar Khan
Ammar Khan

Reputation: 356

Getting Dll Exception When I convert the console app into Class Library

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 located assembly's manifest definition does not match the assembly reference

I 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

Upvotes: 1

Views: 598

Answers (3)

Bijington
Bijington

Reputation: 3751

What version of .NET are you using? If it is 4.0 or later can you check whether your library is set to use the Client framework or the full one. To check this you can right click on the project and select properties, it should then be on the first tab. Make sure it is set to the full framework not the Client framework.

Upvotes: 1

tweellt
tweellt

Reputation: 2171

Try this:

  • Clean Project
  • Check if bin folder is empty, if not delete all files
  • Remove reference and add it again
  • Build project again

Cheers

Upvotes: 1

EkoostikMartin
EkoostikMartin

Reputation: 6921

Try adding this to your web.config (or app.config):

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-2.2.18.0" newVersion="2.2.18.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

Upvotes: 1

Related Questions