1

I installed the MvcMailer package in my project. So I was trying to do the scaffolding but it did not work. I googled on this. I got advices that I should install T4Scaffolding and MvcScaffolding

Which I did and restarted my visual studio. but unfortunately when start my project from vs some package dont get to load well. The scaffolding packages. Seem there is a conflict.

Error message is bellow

Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At C:\Users\sk\Documents\Visual Studio 2013\Projects\LiveChatPrototype\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:\Users\sk\Documents\Visual Studio 2013\Projects\LiveChatPrototype\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:\Users\sk\Documents\Visual Studio 2013\Projects\LiveChatPrototype\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:\Users\sk\Documents\Visual Studio 2013\Projects\LiveChatPrototype\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:\Users\sk\Documents\Visual Studio 2013\Projects\LiveChatPrototype\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:\Users\sk\Documents\Visual Studio 2013\Projects\LiveChatPrototype\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:\Users\sk\Documents\Visual Studio 2013\Projects\LiveChatPrototype\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:\Users\sk\Documents\Visual Studio 2013\Projects\LiveChatPrototype\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:\Users\sk\Documents\Visual Studio 2013\Projects\LiveChatPrototype\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

PM> 
TimG
  • 592
  • 2
  • 11

3 Answers3

1

I faced the same issue and I could get it working by these steps:

  1. Un-install MvcMailer.
  2. Un-install MvcScaffolding and T4Scaffolding.
  3. Set the correct Default Project in Package Manager Console.
  4. Run this from command Install-Package MvcScaffolding -Version 1.0.8-vs2013 -Pre as mentioned by Scott himself here.
  5. Install MvcMailer through Nuget.
  6. Run this command Scaffold Mailer.Razor UserMailer Welcome,PasswordReset
Community
  • 1
  • 1
gsk
  • 1,233
  • 15
  • 32
1

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. Please mark as answered if this resolves your issue.

Cheers.

  • how did you uninstall T4Scaffolding.Core? When I try to do that, it says that MvcMailer depends on it – jao Jan 13 '16 at 20:29
  • 1
    You will want to use Package Manager Console. Try typing: Uninstall-package T4Scaffolding.Core -Force It's the force option that will uninstall even if it has dependencies. If MvcMailer stops working after you've then installed the new version of scaffolding linked above, then I fear you may need to download the source of MvcMailer, change the dependency to point to the new package and rebuild the package. Then include that instead. Let me know how you get on.Cheers. – David Douglas Anderson Jan 14 '16 at 12:05
0

first Run

  1. Uninstall-Package MvcScaffolding -RemoveDependencies
  2. Close the VSTD and delete the packages folder (if you have restore missing packadges)
  3. Re-Open the project
  4. Install-Package MvcScaffolding -Version 1.0.8-vs2013 -Pre (if you have VSTD 2013)

And then let's Scaffolding Controller MyModel -Repository (oh God it's Working)

user2988717
  • 127
  • 3
  • 8