Entity Framework 5 stopped running T4 templates files on save

喜欢而已 提交于 2019-12-05 13:08:52

Is your EDMX in a sub-folder of your project? If so, the good news is that you didn't do anything wrong. The bad news is that this is a known issue...check my blog post about it. http://thedatafarm.com/blog/data-access/watch-out-for-vs2012-edmx-code-generation-special-case/.

Two work arounds for the time being:

1) move the edmx into the main project folder 2) explicitly force the code gen as needed

There is actually another workaround option. I discovered this error because I upgraded an EF 4 EDMX to EF 5 by adding EF 5.x DbContext Generator to the project, which added T4 templates to the existing EDMX.

However, in the project file it did not mark them as DependentUpon the EDMX file so they did not appear under the EDMX node. Instead they appeared side-by-side with the EDMX in the folder. T4 generation worked fine until I manually went in and added the DependentUpon nodes in the project file.

Observe: http://www.youtube.com/watch?v=-boB5GhqfUI

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!