Solving the Entity Framework exception “Could not determine storage version”

Posted: (EET/GMT+2)

 

I was yesterday working on some older Entity Framework code, and wanted to test one part of the application. While doing so, the application reported the following error:

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

What is the solution to this error? If your application uses Entity Framework's EDMX files ("database first"), then an attribute called ProviderManifestToken is missing from the EDMX file. The EDMX file is an XML file.

One the file with a suitable XML editor (or, in Visual Studio with a right-click and "Open With…"), and then make sure the ProviderManifestToken can be found from the Schema element, as follows:

<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
  <!-- EF Runtime content -->
  <edmx:Runtime>
    <!-- SSDL content -->
    <edmx:StorageModels>
    <Schema Namespace="MyDatabaseModel.Store" ProviderManifestToken="2012" ...

Here, the last line is the one that needs the new attribute. Adding the attribute would solve the problem.