Found conflicts between versions of the same dependent assembly

I am having trouble solving this problem with my solution. I have a solution broken down into three projects and I think that's part of the problem.

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

There are many answers to this problem here, but no reliable way to solve it?

I tried to open the csproj project files and I edited them to include the same versions if the versions were different, but I'm not sure if that was correct.

I am happy to provide as much information as possible to resolve it ... all I am presenting 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 that doesn't seem to be correct as this is a new project I just created ...

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>

      

+3


source to share


1 answer


You can open packages.config

and edit versions to make sure they are the same. Once you do this, Nuget will use those versions for the next build. Then you probably won't need redirects.



Also, system links such as System.Web.Mvc

are not always added via nuget packages. If you've used the VS template to create your project, they might point to your program files (or wherever VS / ASP.Net MVC is installed). In this case, remove those links and add them through the Nuget Package Manager.

+2


source







All Articles