Gary Gary - 1 year ago 230
C# Question

Exception when refreshing EF designer

new to Entity Framework....

I am currently using the latest update for EF and Visual Studio 2012, when trying to refresh from the database to update tables in my model that have changed, the designer is throwing a COMException "A file or folder with the name '' already exists. Please give a unique name to the item our are adding.

It looks like it wants me to delete all my model files when refreshing from DB, this can't be right. Am I missing something?

Answer Source

This happens because entity framework creates your model in an auto generated container.designer.cs file. This file contains classes that map with your database tables.

On this occasion, don't delete the model but only delete .tt files

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download