Question

In vs2012 I used to use Steve Sanderson's mvcScaffolding Package with this package I could scaffold Action Methods with unit tests and controllers with repositories and dependency injection. My question is simple. Is there a way to do so in vs2013? When I install the package in vs2013 I get the following errors:

Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At C:\dev\WebApplication2\packages\T4Scaffolding.Core.1.0.0\tools\init.ps1:50 char:9
+         Set-DefaultScaffolder -Name CustomTemplate -Scaffolder T4Scaffolding.Cus ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Set-DefaultScaffolder], InvalidOperationException
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At C:\dev\WebApplication2\packages\T4Scaffolding.Core.1.0.0\tools\init.ps1:51 char:9
+         Set-DefaultScaffolder -Name CustomScaffolder -Scaffolder T4Scaffolding.C ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Set-DefaultScaffolder], InvalidOperationException
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At C:\dev\WebApplication2\packages\T4Scaffolding.1.0.8\tools\init.ps1:6 char:1
+ Set-DefaultScaffolder -Name DbContext -Scaffolder T4Scaffolding.EFDbContext -Sol ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Set-DefaultScaffolder], InvalidOperationException
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

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

Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At C:\dev\WebApplication2\packages\MvcScaffolding.1.0.9\tools\init.ps1:47 char:1
+ Set-DefaultScaffolder -Name Controller -Scaffolder MvcScaffolding.Controller -So ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Set-DefaultScaffolder], InvalidOperationException
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At C:\dev\WebApplication2\packages\MvcScaffolding.1.0.9\tools\init.ps1:48 char:1
+ Set-DefaultScaffolder -Name Views -Scaffolder MvcScaffolding.Views -SolutionWide ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Set-DefaultScaffolder], InvalidOperationException
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At C:\dev\WebApplication2\packages\MvcScaffolding.1.0.9\tools\init.ps1:49 char:1
+ Set-DefaultScaffolder -Name Action -Scaffolder MvcScaffolding.Action -SolutionWi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Set-DefaultScaffolder], InvalidOperationException
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At C:\dev\WebApplication2\packages\MvcScaffolding.1.0.9\tools\init.ps1:50 char:1
+ Set-DefaultScaffolder -Name UnitTest -Scaffolder MvcScaffolding.ActionUnitTest - ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Set-DefaultScaffolder], InvalidOperationException
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At C:\dev\WebApplication2\packages\MvcScaffolding.1.0.9\tools\init.ps1:54 char:1
+ Set-DefaultScaffolder -Name View -Scaffolder $viewScaffolder -SolutionWide -DoNo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Set-DefaultScaffolder], InvalidOperationException
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet
Was it helpful?

Solution

We are moving to a new system for Scaffolding, but for now, run VS as admin and use this -pre version we've updated:

Install-Package MvcScaffolding -Version 1.0.8-vs2013 -Pre

I'll blog this.

OTHER TIPS

The error you are getting is that it can't create instance of the VS IDE (EnvDTE.DTE). That scaffolding package is referencing an older version of the VS IDE and so it will not work in VS2013. That project will have to be updated to properly support VS2013.

The codeplex project looks like it has not been updated in quite sometime so my guess is that unless the project moved to a different open source repository, it is dead.

Since ASP.NET has its own scaffolding now built right in, I would suggest that it is time to convert over.

try this in command line: cd C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ devenv.exe /setup "Extensions\Microsoft\Web\Mvc\Scaffolding\Microsoft.AspNet.Scaffolding.Mvc.5.0.dll"

For solved this problem on VS2013 Update 4, I will have to uninstall from all modules, on .\packages directorie remove all T4*, Exit from VS.

Enter again, and use the solutions from witttness, do on package manager console: Install-Package MvcMailer-vs2013 -pre, and voilá, its work since then...

Thanks for everything

I know this was posted a while ago, but, I came across this same bug in VS2015 whilst using MvcScaffolding. The actual bug lies in the T4Scaffolding.Core package. I pulled the source, fixed the bugs, and uploaded new NuGet packages with linked dependencies. The 3 new packages are:

First uninstall MvcScaffolding and its dependencies, T4Scaffolding, & T4Scaffolding.Core. If you then simply install the MvcScaffolding package, the other packages will be pulled through. Hope this helps someone else.

Cheers.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top