MetadataException in Release Build

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


    我真的不知道自己做了什么,但是从TFS检入并检出后,它就能正常工作。

    链接地址: http://www.djcxy.com/p/38800.html

    上一篇: MetadataException:指定的模式无效

    下一篇: 发布版本中的MetadataException