Friday, 6 December 2019

Host two websites under same domain, which has different versions of Entity Framework package installed

We do have two websites which we need to host it under a same domain name , So for this we normally create a website and inside that we will be creating a new application for the child

This is not a big deal , but if we have packages with different versions installed in the websites then we will be getting a version conflict error. 

Example in our OLDProject we do have EF version 4x and NewProject has EF version 6x 
Then we will be getting an exception like 

Since we have an EF section in the OLDProject we dont need to add the EF section in NewProject 

What we need to do is remove the EF section from NewProject(Child) Then add a Assembly Redirect 

Comment below line ( Version may differ in your case 
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
Then Add an assembly redirect like below 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" />
        <bindingRedirect oldVersion="" newVersion="" />

No comments:

Post a Comment