EntityFramework error: The provider did not return a ProviderManifest instance

28,091

Solution 1

Aparently, the problem was the Visual studio version that I was using. Mind blowing if you ask me. After removing Visual Studio Web Express 2012 and installing Visual Studio 2013 Ultimate everything started working as it should.

Solution 2

Download http://www.microsoft.com/en-us/download/details.aspx?id=40762 and update Nuget EF to 6.1.3 and everything will work just fine.

Solution 3

Replacing 2012 with 2008 in ProviderManifestToken="2012" in the .edmx file worked for me.

  1. Replace 2012 with 2008 in ProviderManifestToken="2012"
  2. Save the .edmx file
  3. Clean and rebuild solution

Solution 4

This worked for me without changing the ProviderManifestToken="2012" to 2008 in the .edmx file.

in the .edmx file, I changed the following value from True to False.

<edmx:DesignerProperty Name="UseLegacyProvider" Value="False" /> 

The "The provider did not return a ProviderManifest instance." error went away.

Solution 5

This happens because VS2012 does not support sql 2012 and above. Change the value of ProviderManifestToken to 2008

Share:
28,091
Flame_Phoenix
Author by

Flame_Phoenix

I have been programming all my life since I was a little boy. It all started with Warcraft 3 and the JASS and vJASS languages that oriented me into the path of the programmer. After having that experience I decided that was what I wanted to do for a living, so I entered University (FCT UNL ftw!) where my skills grew immensely and today, after several years of studying, professional experience and a master's degree, I have meddled with pretty much every language you can think of: from NASM to Java, passing by C# Ruby, Python, and so many others I don't even have enough space to mention them all! But don't let that make you think I am a pro. If there is one thing I learned, is that there is always the new guy can teach me. What will you teach me?

Updated on July 24, 2022

Comments

  • Flame_Phoenix
    Flame_Phoenix almost 2 years

    My project is using ASP.NET MVC4, in C# with Visual Studio 2012 for Web Express.

    When compiling my project, I have the following error:

    The provider did not return a ProviderManifest instance. Could not determine storage version; a valid storage connection or a version hint is required.

    After many hours of search I believe that is error is somehow related to Entity Framework. I also found a work around for this error here: http://forums.devart.com/viewtopic.php?f=32&t=25748

    The workaround suggests that I change the field ProviderManifestToken="2012" to ProviderManifestToken="2008" in my .edmx file.

    After doing that the error goes away. But then I have another problem when I run the project, a runtime error:

    Could not load file or assembly 'Microsoft.Data.Edm' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

    === Pre-bind state information ===
    LOG: DisplayName = Microsoft.Data.Edm
    (Partial)
    WRN: Partial binding information was supplied for an assembly:
    WRN: Assembly Name: Microsoft.Data.Edm | Domain ID: 2
    WRN: A partial bind occurs when only part of the assembly display name is provided.
    WRN: This might result in the binder loading an incorrect assembly.
    WRN: It is recommended to provide a fully specified textual identity for the assembly,
    WRN: that consists of the simple name, version, culture, and public key token.
    WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
    LOG: Appbase = file:///C:/Users/Pedro/Documents/Visual Studio 2012/Projects/Dockis/Development/Dockis/Dockis/
    LOG: Initial PrivatePath = C:\Users\Pedro\Documents\Visual Studio 2012\Projects\Dockis\Development\Dockis\Dockis\bin
    Calling assembly : (Unknown).

    LOG: This bind starts in default load context.
    LOG: Using application configuration file: C:\Users\Pedro\Documents\Visual Studio 2012\Projects\Dockis\Development\Dockis\Dockis\web.config
    LOG: Using host configuration file: C:\Users\Pedro\Documents\IISExpress\config\aspnet.config
    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.

    LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
    LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/78aa89a1/af9f01eb/Microsoft.Data.Edm.DLL.
    LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/78aa89a1/af9f01eb/Microsoft.Data.Edm/Microsoft.Data.Edm.DLL.
    LOG: Attempting download of new URL file:///C:/Users/Pedro/Documents/Visual Studio 2012/Projects/Dockis/Development/Dockis/Dockis/bin/Microsoft.Data.Edm.DLL.
    LOG: Using application configuration file: C:\Users\Pedro\Documents\Visual Studio 2012\Projects\Dockis\Development\Dockis\Dockis\web.config
    LOG: Using host configuration file: C:\Users\Pedro\Documents\IISExpress\config\aspnet.config
    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
    LOG: Redirect found in application configuration file: 5.6.0.0 redirected to 5.6.1.0.
    LOG: Post-policy reference: Microsoft.Data.Edm, Version=5.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
    LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/78aa89a1/af9f01eb/Microsoft.Data.Edm.DLL.
    LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/78aa89a1/af9f01eb/Microsoft.Data.Edm/Microsoft.Data.Edm.DLL.
    LOG: Attempting download of new URL file:///C:/Users/Pedro/Documents/Visual Studio 2012/Projects/Dockis/Development/Dockis/Dockis/bin/Microsoft.Data.Edm.DLL.
    WRN: Comparing the assembly name resulted in the mismatch: Build Number
    ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

    Stack Trace:

    [FileLoadException: Could not load file or assembly 'Microsoft.Data.Edm' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
    
    [FileLoadException: Could not load file or assembly 'Microsoft.Data.Edm, Version=5.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
       System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
       System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +34
       System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
       System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77
       System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +16
       System.Reflection.Assembly.Load(String assemblyString) +28
       System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38
    
    [ConfigurationErrorsException: Could not load file or assembly 'Microsoft.Data.Edm, Version=5.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
       System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +752
       System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +218
       System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130
       System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170
       System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +91
       System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +285
       System.Web.Compilation.BuildManager.ExecutePreAppStart() +153
       System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +521
    
    [HttpException (0x80004005): Could not load file or assembly 'Microsoft.Data.Edm, Version=5.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
       System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9950728
       System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
       System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
    

    Dockis is the name of the project. After seeing this error I spent several hours believing that the errors lied somewhere in the versions of the package being used. However, this does not seem to be the case, since the majority of packages are up to date and there doesn't seem to be any conflicts between them.

    Consequently, I am back to believing that the problem lies with the version of EntityFramework, but I am out of ideas on how to fix this.

    I'm all ears, if you have any suggestions, I'll appreciate them.

  • granadaCoder
    granadaCoder over 9 years
    I had the same issue. VS2012 Premium had the error. VS2013 Premium built it ok. Reopened it in VS2012, and it failed again. No idea. Weird.
  • Pando
    Pando over 6 years
    This is a much better response than the ones suggesting that ProviderManifestToken attribute value is changed from 2012 to 2008. Using 2008 prevents the Entity Framework from using SQL 2012-specific functionality, such as OFFSET and FETCH.
  • dancerjude
    dancerjude over 5 years
    Not worked for me, I have "False" value in that property and the error message still appear.