I once got this issue once when I upgraded an old project to .NET Framework 4.7.
If that is the case here too, then the *.tt
file is deprecated now. It is a T4 generator file, which will create C# source required to access your entity objects and needs to be replaced. Do the following to update it (assuming you're using database first approach):
- Remove the current (deprecated)
*.tt
file (exclude it from project and delete it)
- Open the
*.edmx
file in the solution explorer by double-clicking it. The data classes diagrams are opening up.
- Right-Click on a free space in the data classes visualization (your EF data model) and select "Update model from database..." in the context menu
- Specify and test data connection (to ensure it is successful)
Now what happens in the background is that a new *.tt
file will be generated. Once that is completed, rebuild your solution and the error should disappear.
But be aware that you likely have to do more changes afterwards, because there have been a couple of breaking changes in the newer versions of EF, which I have described here.