Upgrade blazor project EF 3.1 to EF 6.0

iqworks Information Quality Works 331 Reputation points
2022-09-21T23:44:54.33+00:00

Hi, I am getting this message when i try to access a .net framework MVC EF 6 from a core project that uses EF 3.1.0, I get this message :

[2022-09-21T20:03:02.104Z] Error: System.IO.FileNotFoundException: Could not load file or assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.
File name: 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
at Mbsa.Common.CommonRepo`1..ctor()
at Mbsa.BL.MembersService..ctor() in D:\MBSSys\Mbsa\Mbsa 2021\BL\MembersService.cs:line 38
at MbsaDotNetStandard.MbsaUseFrameworkMethods.grabMbsaMember(Int32 mno) in D:\MBSSys\MbsaDotNetStandard\MbsaUseFrameworkMethods.cs:line 14
at MbsaBlazorServerSideEF.Pages.MbsaMemberPage.OnInitializedAsync() in D:\MBSSys\MbsaBlazorServerSideEF\Pages\MbsaMemberPage.razor:line 91
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)

My .net framework 4.7.2 is using :
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>

When I go into my .net 4.7.2 package manager console and type "get-package", this is what i see :
EntityFramework {6.4.4} Mbsa

Just want to make sure I am thinking about this correctly?

From this message it looks like I need to upgrade my core project from EF 3.1 to EF 6.0? So I am wondering if there another way to do this?

Thanks for any advice or suggestions

Developer technologies | .NET | Other
{count} votes

1 answer

Sort by: Most helpful
  1. iqworks Information Quality Works 331 Reputation points
    2022-09-22T20:24:48.213+00:00

    Hi @Jack J Jun , thanks for getting back. Sorry here is a more detailed breakdown of the programs, versions and projects I am trying to run.

    I have a .net framework MVC 4.7.2. It uses EF 6.0.0.0 and EF SqlServer 6.0.0.0.
    I have a .netStandard 2.0.
    I have a blazer server side .net 5.0.

    The goal is the grab EF data from my MVC project through .netStandard to my blazer server side project.

    I can access my MSSQL database from blazer and of course MVC. The data is retrieved by dapper. BUT they are not using .netStandard.

    Now I have this method in my .netStandard:

    **using System;  
    using System.Collections.Generic;  
    using System.Text;  
    using Mbsa;  
      
    namespace MbsaDotNetStandard  
    {  
        public class MbsaUseFrameworkMethods  
        {  
            public Mbsa.Models.MbsaMember grabMbsaMember(int mno)  
            {  
                 Mbsa.BL.MembersService mservice = new Mbsa.BL.MembersService();  
                 Mbsa.Models.MbsaMember mmember = mservice.GetMemberById(mno);  
                      
                return mmember;  
                  
            }  
             
        }**  
    

    From my blazer server side project, I call the above method that is in .netStandard (the 1 is the memberNo (like a customer):

     *MbsaDotNetStandard.MbsaUseFrameworkMethods oou = new   
     MbsaDotNetStandard.MbsaUseFrameworkMethods();  
     Mbsa.Models.MbsaMember mbrt = oou.grabMbsaMember(1);*  
    

    Hence the error :

    System.IO.FileNotFoundException: Could not load file or assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.
    File name: 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

    Which leads me to believe that since I already have my MVC project with EF 6.0, it looks like that I need to bring my blazer server side projects’s EF from 3.1 to 6.0.

    I am unclear about installing EF 6.0 on my blazer server side .net 5.0?
    Looks like I have to my blazer server side at version .net 6.0 before I can install EF 6.0 on this blazer server side?

    Please let me know if you need more detail. (there is a lot going on here :-))


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.