After installing NuGet package PagedList.Mvc, application stopped on deployment server

265 Views Asked by At

I am working on an MVC 5 application and it was running perfectly fine before I started using the Pager from PagedList.Mvc. After I used this Pager, the application works fine on the development server but when I publish it to the file system and deploy it on another server, it gives me the following error:

Could not load file or assembly System.Web.Mvc Version 4.0.0.0

Please help me resolve this error.

1

There are 1 best solutions below

0
On BEST ANSWER

That's probably because PagedList.Mvc is compiled against System.Web.Mvc Version 4.0.0.0.

Try using bindingRedirect:

<configuration>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
                <bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="5.2.3.0"/>
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
</configuration>

Just update line <bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="5.2.3.0"/> with your proper versions.