Search code examples
c#.netvisual-studioentity-frameworkdevart

'Unable to load the specified metadata resource.' when updating from VS 2019 to 2022


When upgrading my C# project from using Visual Studio 2019 to Visual Studio 2022, I get a runtime error of "System.Data.Entity.Core.MetadataException: 'Unable to load the specified metadata resource.'" As far as I can tell, this is from the .csdl, .msl, .ssdl files not being generated in VS 2022.

Various Notes:

  • I currently have both VS 2019 and VS 2022 installed. Both can compile the program without errors, but VS 2022 throws the runtime error. I can switch back and forth between Visual Studio versions...2019 always works, 2022 always errors out.
  • I am loading the same solution in both VS 2019 and VS 2022. The code files are the same.
  • When I compile in VS 2019, I can see the .csdl/.msl/.ssdl files in the obj/Debug folder, when I compile in VS 2022 these files do not appear. In VS 2022, the .dll file is also smaller by about the combined size of these files.
  • I have a .edml file (Devart), but no .edmx file. In this .edml file, the Model Settings have the Metadata Artifact Processing set to "Embed In Output Assembly".

Overall, my question is: What could cause these files to not be generated? Do I have a setting wrong somewhere in VS or have I not installed some needed package?


Solution

  • Updating to the new version of dotConnect for PostgreSQL (v8.0.0) immediately fixed the problem!