Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Found Conflicts between versions of the same dependent assembly

I'm having real trouble trying to resolve this issue with my solution. I have my solution split into three projects and I think that's part of the problem.

I installed the packages using NUGET but I don't know how to 'change' the versions or bring them in line.

There are plenty of answers on here about this kind of issue, but no solid way to resolve it?

I have tried opening the project csproj files and I have edited them to include the same versions if the versions were different, but I'm not sure if that was the right thing to do.

I'm happy to provide as much information as is required to resolve it... all I have so far is this error message:

Warning   1   Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" culture="neutral" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
    </dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
        <assemblyIdentity name="System.Web.Razor" culture="neutral" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
    </dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages.Deployment" culture="neutral" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
    </dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages.Razor" culture="neutral" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
    </dependentAssembly>
    </assemblyBinding>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" culture="neutral" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.0.0" newVersion="5.2.0.0" />
    </dependentAssembly>
</assemblyBinding>

C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets 1635 5 uQuiz.WebUI

I know that I can add a 'redirect' but it doesn't seem right, as it's a new project that I just created really...

Here's my packages.config file:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="EntityFramework" version="6.1.1" targetFramework="net45" />
  <package id="Microsoft.AspNet.Mvc" version="5.0.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.Razor" version="3.2.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebPages" version="3.2.0" targetFramework="net45" />
  <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
  <package id="Moq" version="4.2.1402.2112" targetFramework="net45" />
  <package id="MySql.Data" version="6.8.3" targetFramework="net45" />
  <package id="MySql.Data.Entities" version="6.8.3.0" targetFramework="net45" />
  <package id="MySql.Web" version="6.8.3" targetFramework="net45" />
  <package id="Ninject" version="3.2.2.0" targetFramework="net45" />
  <package id="Ninject.MVC3" version="3.2.1.0" targetFramework="net45" />
  <package id="Ninject.Web.Common" version="3.2.2.0" targetFramework="net45" />
  <package id="Ninject.Web.Common.WebHost" version="3.2.2.0" targetFramework="net45" />
  <package id="WebActivatorEx" version="2.0.5" targetFramework="net45" />
</packages>
like image 923
Luke Avatar asked Sep 30 '22 00:09

Luke


1 Answers

You can open packages.config and edit the versions to make sure they are same. Once you do that, Nuget will use those versions on next build. You probably won't need the redirects then.

Also, system references like System.Web.Mvc are not always added via nuget packages. If you used the VS template to create project, they might be pointing to your Program Files (or wherever VS/ASP.Net MVC is installed). In that case, remove those references and add them via Nuget Package Manager.

like image 162
Mrchief Avatar answered Oct 03 '22 01:10

Mrchief