0

After I updated the version of Visual Studio from 17.5 to 17.6, I have an issue with the model.edmx update from model. When I try to update a model.edmx and update entity, I get an error:

Error
Running transformation: System.NullReferenceException: Object reference not set to an instance of an object.

at Microsoft.VisualStudio.TextTemplating6321A08787B1D16A13C9C3F3FC61C02BFC9187AEBE1F7DFA4EC2C0ABCCB03E262501680949A5260B34002E23AA53CF4409BFEBFDF5677EBCCC3EFBFB2CD6FDD8.GeneratedTextTransformation.DynamicTextTransformation.get_GenerationEnvironment() at Microsoft.VisualStudio.TextTemplating6321A08787B1D16A13C9C3F3FC61C02BFC9187AEBE1F7DFA4EC2C0ABCCB03E262501680949A5260B34002E23AA53CF4409BFEBFDF5677EBCCC3EFBFB2CD6FDD8.GeneratedTextTransformation.EntityFrameworkTemplateFileManager..ctor(Object textTransformation) at Microsoft.VisualStudio.TextTemplating6321A08787B1D16A13C9C3F3FC61C02BFC9187AEBE1F7DFA4EC2C0ABCCB03E262501680949A5260B34002E23AA53CF4409BFEBFDF5677EBCCC3EFBFB2CD6FDD8.GeneratedTextTransformation.EntityFrameworkTemplateFileManager.VsEntityFrameworkTemplateFileManager..ctor(Object textTemplating) at Microsoft.VisualStudio.TextTemplating6321A08787B1D16A13C9C3F3FC61C02BFC9187AEBE1F7DFA4EC2C0ABCCB03E262501680949A5260B34002E23AA53CF4409BFEBFDF5677EBCCC3EFBFB2CD6FDD8.GeneratedTextTransformation.EntityFrameworkTemplateFileManager.Create(Object textTransformation) at Microsoft.VisualStudio.TextTemplating6321A08787B1D16A13C9C3F3FC61C02BFC9187AEBE1F7DFA4EC2C0ABCCB03E262501680949A5260B34002E23AA53CF4409BFEBFDF5677EBCCC3EFBFB2CD6FDD8.GeneratedTextTransformation.TransformText()

EF6 inside model.tt doesn't update the existing entity.cs, but creates an only empty class named model.cs.

I tried to run custom tool but return the same problem.

How I can resolve this?

Thanks for support

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
enrico
  • 1
  • See following : https://learn.microsoft.com/en-us/ef/efcore-and-ef6/porting/port-edmx?force_isolation=true – jdweng Jun 01 '23 at 14:30
  • I think you need to check this thread: https://stackoverflow.com/questions/76352688/entity-framework-6-t4-code-generation-not-working-in-vs2022 – KeiserSoze Jun 01 '23 at 17:05
  • KeiserSoze provided a very valuable lead, It's a known bug of Visual Studio 2022 v17.6+ – wenbingeng-MSFT Jun 02 '23 at 09:59

0 Answers0