I have installed the latest Entity Framework version (EntityFramework.6.1.3) in VS2015. I have added the EF in the project and deleted the 2 .tt files (edmx_file_name.tt and edmx_file_name.Context.tt) as they were from the DBContext.
Now I am trying to add the EF 6.x code generation template by open the model in the EF Designer, right-click on the design surface and select Add Code Generation Item.
To add the Code Generation in ObjectContext i need to install the EF 6.x EntityObject Generator. I downloaded it from here.
But it I couldn't install it in VS 2015.
How do I solve this?
Well, for all those poor souls like me that no longer have VS2013 installed, there's much easier option. You can just install the EF 6.x EntityObject Generator for C# for VS2015.
Sure, the VSIX will shout at you that it's not meant for 2015. Just ignore it :)
The fact that it is not supported or advertised as "compatible with VS2015" does not imply that it does not work. It's a pack of T4 templates. Their syntax or features have not changed much since then.
Download the VSIX from marketplace, save it somewhere, unzip it (that's just a ZIP archive) and then edit file called: extension.vsixmanifest. Inside you will find such block:
<SupportedProducts>
<VisualStudio Version="10.0">
<Edition>VCSExpress</Edition>
<Edition>VWDExpress</Edition>
<Edition>Pro</Edition>
</VisualStudio>
<VisualStudio Version="11.0">
<Edition>VCSExpress</Edition>
<Edition>VWDExpress</Edition>
<Edition>Pro</Edition>
</VisualStudio>
<VisualStudio Version="12.0">
<Edition>VCSExpress</Edition>
<Edition>VWDExpress</Edition>
<Edition>Pro</Edition>
</VisualStudio>
</SupportedProducts>
Copy, paste, add a block for Version="13.0"
, and maybe futher too (14.0=VS2017?), save, ZIP it back, change extension to .vsix and try to install.
Worked for me on VS2015, installed with no problems, added EntityObject T4 templates, and generated code from EDMX as it was supposed to.
Since until now, no EntityObject Generator Template is supported in Visual Studio 2015, the alter solution is, open your solution with Visual Studio 2013, then open your edmx diagram, right click, select "Add Code generation Item", you will see "EF 6.X EntityObject Generator", if you cannot see it, go to "online" menu, and you will see "EF 6.x EntityObject Generator For C#" display. Select the EntityObject Generator and click "Add" button to add it to you data access layer project. The tt will auto generate EntityObject classes for you. Save the project, exit visual studio 2013. Reopen the solution with visual studio 2015. Done.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With