System.Data.MetadataException: Unable to load the specified metadata resource

前端 未结 12 1646
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-16 10:18

My connection strings are as follows:



        
相关标签:
12条回答
  • 2020-12-16 11:05

    I also encountered this problem and it was because I forgot to reference the project that contained the EDMX file.

    0 讨论(0)
  • 2020-12-16 11:10

    Refer to http://forums.devart.com/viewtopic.php?t=22092 .

    If this doesn't help, please specify:

    • are you working with ADO.NET Entity Data Model (.edmx) or Devart Entity Model (.edml)?
    • the value of your model file's Build Action property
    • the value of the Metadata Artifact Processing property of your model
    • the build number (x.xx.xxx) of your dotConnect for Oracle
    • the version of your Visual Studio
    • follow Pawel's advice to check if resources were embedded in the assembly
    0 讨论(0)
  • 2020-12-16 11:12

    I was getting an exception like this. The problem was that I renamed my .edmx file and forgot to change the name in EF Web.config file's connection string:

    metadata=res://*/MyModel.csdl|res://*/MyModel.ssdl|res://*/MyModel.msl;
    
    0 讨论(0)
  • 2020-12-16 11:13

    I also encountered this problem becaue I was the missing entityFramework config section in the app.config.

    I had this:

    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    

    But not this:

    <entityFramework>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
          <parameters>
            <parameter value="mssqllocaldb"/>
          </parameters>
        </defaultConnectionFactory>
        <providers>
          <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
        </providers>
    </entityFramework>
    
    0 讨论(0)
  • 2020-12-16 11:18

    We upgraded from .net core 1 to 3.1 and from visual studio 2015 to visual studio 2019. We noticed that the Build Action for some files has been reset. So we changed back the Build Action from None to Content for all files ending with .tt, and their Copy to Output directory to Do Not Copy.
    We also had to change the build action of the .edmx file to EntityDeploy and its copy to output directory value to Do Not Copy.
    HTH someone.

    0 讨论(0)
  • 2020-12-16 11:20

    The easiest solution that resolved this for me was to remove the obj folder which sit at the same level as the bin folder and re-run the application, my god it took way longer than it needed

    0 讨论(0)
提交回复
热议问题