I needed to move a couple of Entity Framework edmx files into a new project directory. Although I used the “add existing item” functionality of VS 2008, I still managed to corrupt the connection string entries in the App.config file, likely by using a subfolder. This led to a string of the following error message when I tried to run the app: “Unable to load the specified metadata resource.” After searching for a fix, I found that by toggling a property of the edmx file, it is possible to realign the connection to the new project.
To do this, open the model in the Visual Studio GUI tool for editing edmx files. Use your cursor to select any point in the background of the diagram where there is not an object. If you look at your properties pane, you will notice a property for the diagram called “Metadata Artifact Processing”.
The default value for this property is “Embed in Output Assembly” and this appears to be accepted as the best default practice. To repair your metadata reference, though, change the value to “Copy to Output Directory” and build the project. Now set the value back to the original “Embed in Output Assembly”. Build the project again and you should be set to go. As this updates the App.config file, don’t forget to copy the updated entries to other projects that rely on the setting at run time.
