5

I have an EF project that containing my data model that I have been successfully using. The "Metadata Artifact Processing" option is set to "Embed in Output Assembly".

As the .edmx file was in the root folder of the project the metadata string used in the EntityConnectionStringBuilder was set to:

res://*/myProject.csdl|res://*/myProject.ssdl|res://*/myProject.msl

When I was restructuring the project, I moved the .ecdm file into a subfolder: /DataLayer/myProject/ and I changed the metadata string to:

res://*/DataLayer/myProject/myProject.csdl|res://*/DataLayer/myProject/myProject.ssdl|res://*/DataLayer/myProject/myProject.msl

This now causes an error ("The specified metadata path is not valid") but I can't see what's wrong with the folder path I've specified in the metadata.

I know that I can just move the .ecdm file back to the root but I've had this problem before and couldn't fix it - is there something obvious I'm missing?

GrandMasterFlush
  • 6,269
  • 19
  • 81
  • 104

1 Answers1

9

I finally worked it out.

The folders should be separated with '.' not '/'.

The correct format for the metadata is:

res://*/DataLayer.myProject.myProject.csdl|res://*/DataLayer.myProject.myProject.ssdl|res://*/DataLayer.myProject.myProject.msl

Hopefully this will save someone from banging their head against the wall for a while!

GrandMasterFlush
  • 6,269
  • 19
  • 81
  • 104
  • 1
    At least I only banged my head for a little while. Thanks for nothing EF! – A.R. Aug 07 '14 at 14:41
  • 1
    You can find out what name to use for your metadata file by opening your DLL with DotPeek and looking in the Resources section; there you'll see the .csdl, .ssdl and .msl files listed with their full names. – philu Jul 13 '16 at 07:24