0
votes

My Program uses EF to access data from a SQL CE database. When debug the application using debug setup it works fine but if I use release setup I get a MetadataException when the program tries to access the database through EF. What I've checked so far:

  • Debug and release configuration is identical (same target platform)
  • The app.config is copied to the same directory as the executable (\Release)
  • The sdf database file is copied to \Release\
  • Metadata Artifact Processing is set to Embed in Output Assembly
  • Connection string name is identical in app.config and EF model

My app.config:

    <?xml version="1.0"?>
    <configuration>
    <connectionStrings>
    <add name="GeoDataEntities" connectionString="metadata=res://*/Model.EF.Model.csdl|res://*/Model.EF.Model.ssdl|res://*/Model.EF.Model.msl;provider=System.Data.SqlServerCe.3.5;provider connection string=&quot;Data Source=|DataDirectory|\GeoData.sdf&quot;" providerName="System.Data.EntityClient" />
    </connectionStrings>
    <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
    </startup>
</configuration>

The assembly Model.EF is the namespace and Model the name of the edmx, I think that should be right.

I know that there a lot of posts and blogs about MetadataException and I've tried to solve this but nothing have worked so far.

Best regards

Jay

1

1 Answers

0
votes

I really don't know what I've done but it's working since I've checked in and checked out from TFS.