Reputation: 2907
I'm working with MS Visual Studio 2012 Update 1 on Win 7 Ultimate SP1 and EF Power Tools.
I am trying to use the Reverse Engineer Code First functionality of entity framework on a MySql DB. I can successfully connect to the DB, but when it tries to complete the code gen I get the following errors:
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.DbContextPackage.Extensions.ProjectExtensions.InstallPackage(Project project, String packageId)
at Microsoft.DbContextPackage.Handlers.ReverseEngineerCodeFirstHandler.ReverseEngineerCodeFirst(Project project)
One or more errors occurred while processing template 'Entity.tt'.
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\EF.Utility.CS.ttinclude(1,4) : error : A processor named 'T4VSHost' could not be found for the directive named 'CleanupBehavior'. The transformation will not be run. The following Exception was thrown:
System.InvalidOperationException: Cannot find processor for directive 'T4VSHost'.
at Microsoft.DbContextPackage.Utilities.EfTextTemplateHost.Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngineHost.ResolveDirectiveProcessor(String processorName)
at Microsoft.VisualStudio.TextTemplating.Engine.ProcessCustomDirectives(ITextTemplatingEngineHost host, TemplateProcessingSession session, IEnumerable`1 directivesToBeProcessed)
I have been unable to find any information using my google foo.
Upvotes: 2
Views: 3355
Reputation: 2907
This is currently an Active bug with entity framework. The bug details can be seen here.
There are currently 2 work-arounds and the one that I used is below.
Open the File for C#:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\EF.Utility.CS.ttinclude
or for VB.net:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\EF.Utility.VB.ttinclude
And Remove the First Line:
<#@ CleanupBehavior Processor="T4VSHost" CleanupAfterProcessingTemplate="true" #>
Upvotes: 4