Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

T4 Scaffolding not working with visual studio 2015

I have created a library of T4 scaffolding templates that i've used successfully in previous versions of visual studio, but now having upgraded my projects to VS 2015 I get the following error when opening the "Package Manager Console":

Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At C:\MyPath\packages\T4Scaffolding.1.0.8\tools\init.ps1:7 char:1
+ Set-DefaultScaffolder -Name Repository -Scaffolder T4Scaffolding.EFRe    ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Set-DefaultScaffolder], InvalidOperationException
+ FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

It seems that EnvDTE.DTE may not be supported out of the box anymore?

Is there anyway of resolving this issue or is there a new mechanism in VS 2015 that can run my existing T4 templates files.

My projects build and run fine.

like image 727
Nick Ready Avatar asked Aug 08 '15 07:08

Nick Ready


1 Answers

FIX:

  1. Uninstall all 3 packages if you have them installed already
  2. Search NuGet Package Manager for 'MvcScaffolding.VS2015' and add it to the project
  3. Restart Visual Studio and the errors when starting up Package Manager Console will be gone.

For your interest the new packages can be found here:

  • MvcScaffolding.VS2015
  • T4Scaffolding.VS2015
  • T4Scaffolding.Core.VS2015

If you simply install the MvcScaffolding package, the other packages will be pulled through. Hope this helps Nick. Please mark as answered if this resolves your issue.

----------------------------------------------------------------------------------

Additional Info: I received an email from Steve Sanderson (one of the main authors of T4Scaffolding / MVC Scaffolding):

I’m afraid MvcScaffolding/T4Scaffolding are no longer supported or maintained, as they were superseded by the ASP.NET scaffolding feature a few years back.

In case it helps, the source for MvcScaffolding/T4Scaffolding is at https://mvcscaffolding.codeplex.com/.

There were 2 options:

  1. Port existing scripts over to Asp.Net Scaffolding
  2. Take the source for MvcScaffolding and T4Scaffolding and fix the bug introduced by VS2013 and above.
like image 120
David Douglas Anderson Avatar answered Oct 11 '22 10:10

David Douglas Anderson