T4 and Edmx conflict - "input file appears to be using a schema version not supported by this template"
Asked Answered
P

1

6

I'm getting a warning from the T4 when the input file is a EF5 edmx.

Running transformation: The input file appears to be using a schema version not supported by this template. This may lead to compile errors. Please use 'Add New Generated Item' to add an updated template.

Any idea why this is happening?

Plumb answered 4/4, 2013 at 1:47 Comment(1)
Possibly, If you have changed the EF version... social.msdn.microsoft.com/Forums/en-US/…Bateman
C
1

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):

  1. Remove the current (deprecated) *.tt file (exclude it from project and delete it)
  2. Open the *.edmx file in the solution explorer by double-clicking it. The data classes diagrams are opening up.
  3. 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
  4. 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.

Cartercarteret answered 24/5, 2018 at 15:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.