[RESOLVED]Microsoft.AspNet.Identity.Owin is breaking my webconfig. Could not load file or assembly 'Newtonsoft.Json' or one of its dependencies. How to fix?

Hello Friends,

I am building an MVC 5 application from scratch. All I used was the basic MVC format. I then created a homecontroller with a hello world index. Everything working fine, until this next step, which is part of me building identity 2.0 for my project.

I ran the following command:

Install-Package Microsoft.AspNet.Identity.Owin

This breaks my webconfig and gives me the following error:

Could not load file or assembly 'Newtonsoft.Json' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) 

Specifically, it breaks this part of the webconfig:

<dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
  </dependentAssembly>

I then tried to change it to the following and it still doesn’t work.

<dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" />
        <bindingRedirect oldVersion="0.0.0.0-4.5.11.0" newVersion="4.5.11.0" />
  </dependentAssembly>

Anyone else encounter this bug and what is the fix?

Note:

This is the only reference I found in the csproj:

<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
      <HintPath>..packagesNewtonsoft.Json.4.5.11libnet40Newtonsoft.Json.dll</HintPath>
    </Reference>

I found the fix to my own problem. The key was taking a peek at the csproj. I changed the reference to 4.5.0.0 and it works. Super weird. This is a bug. How can I report it? It’s very reproducible.

Hi hlyates,

Thanks for your post.

hlyates

I found the fix to my own problem. The key was taking a peek at the csproj. I changed the reference to 4.5.0.0 and it works. Super weird. This is a bug. How can I report it? It’s very reproducible.

NO, I think this is not bug.

 you should Update  the latest version .NET Framework .

Best Regards,

Eileen

Leave a Reply