使用ADO.NET DbContext Generator出现错误—Unable to locate file

如果在使用ADO.NET DbContext Generator生成类时出现如下错误:

Running transformation: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Unable to locate file

这是因为没有正确使用,使用ADO.NET DbContext Generator生成类的正确方法是:

1)打开*.edmx文件,右键单击,选择“添加代码生成项”:

image

2)然后选择“代码”—“ADO.NET DbContext Generator”,自己再命一个名称后点击“添加”:

image

现在就正确的生成了所有的简化类。

posted @ 2012-04-01 10:50  Statmoon  阅读(897)  评论(0编辑  收藏  举报