Update: After realizing that we still want access to it, the team has made the Beta 2 file available again. You can get it from their original blog post, not from the Visual Studio Gallery links but look for a zip file at the bottom of the post.
But there’s more! While I had managed to figure out one big difference (TemplateFileManager name changed) between the old include file and the new include file it wasn’t enough. which is why after a few hours I gave up and went back to the old include file. But Nikola Malovic figured out the second piece which was how to replace the WriteFiles method which is no longer there! Check out his blog post for the super secret trick!
————————————————–
Entity Framework’s T4 templates all have a dependency on a file that includes additional specialized methods.
If you look at the top of the templates (ENtityObject, POCO or Self-Tracking Entiteis) there is a pointer to a ttinclude file.
<#@ include file="EF.Utility.CS.ttinclude"#>
That file, however, changed after Beta 2. The new templates (EntityObject and STE’s both included in VS2010) work wtih the new version of this file. But the POCO template that was released in December doesn’t.
However, I have a trick to have your cake and eat it too until the new POCO template comes along.
This is just a temporary workaround until a new set of templates hits the airwaves. 🙂
The ttinclude files live here:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes
The new one has a file date of Jan 6, 1010.
You can grab the ttinclude file from Beta 2 and rename it. I’ve renamed mind:
EF.B2.Utility.CS.ttinclude
The file date on that one is Sept 15, 2009.
Then copy it into the Includes folder with the new includes.
Now when you create a new POCO template, you’ll first get error message about TemplateFileManager not existing. In the new include, that’s been renamed to EntityFrameworkTemplateFIleManager. But that’s not hte only change. Fixing that name in your template will not help.
Instead, just change the reference in the template file to read the Beta 2 include :
<#@ include file="EF.B2.Utility.CS.ttinclude"#>
Then the POCO template will use the Beta 2 version of the include and you can go on your merry way.
Thanks to Dane Morgridge for sending me the VSIX file from the Beta 2 POCO since I had installed directly rather than downloading it to my computer.