包装不好装

时间:2014-03-04 12:54:12

标签: asp.net visual-studio-2013 t4scaffolding

我在我的项目中安装了MvcMailer包。所以我试图做脚手架,但它没有用。我用Google搜索了这个。我得到了应该安装的建议  T4Scaffolding 和MvcScaffolding

我做了哪些并重新启动了我的视觉工作室。但不幸的是从vs开始我的项目 一些包不能很好地加载。脚手架包。 似乎存在冲突。

错误消息如下:

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> 

3 个答案:

答案 0 :(得分:1)

我遇到了同样的问题,我可以按照以下步骤开展工作:

  1. 卸载 MvcMailer
  2. 卸载 MvcScaffolding T4Scaffolding
  3. 在程序包管理器控制台中设置正确的默认项目。
  4. 从Scott自己here提到的命令 Install-Package MvcScaffolding -Version 1.0.8-vs2013 -Pre 运行此命令。
  5. 通过Nuget安装 MvcMailer
  6. 运行此命令 Scaffold Mailer.Razor UserMailer Welcome,PasswordReset

答案 1 :(得分:1)

我知道这是在不久前发布的,但是,我在使用MvcScaffolding时在VS2015中遇到了同样的错误。实际的错误在于T4Scaffolding.Core包。我删除了源代码,修复了错误,并上传了带有链接依赖项的新NuGet包。 3个新包装是:

首先卸载MvcScaffolding及其依赖项,T4Scaffolding,& T4Scaffolding.Core。如果您只是安装MvcScaffolding包,其他包将被拉过来。希望这有助于其他人。如果这可以解决您的问题,请标记为已回答。

干杯。

答案 2 :(得分:0)

首先运行

  1. Uninstall-Package MvcScaffolding -RemoveDependencies
  2. 关闭VSTD并删除packages文件夹(如果还原了丢失的包裹)
  3. 重新打开项目
  4. 安装包MvcScaffolding -Version 1.0.8-vs2013 -Pre(如果您有VSTD 2013)
  5. 然后让我们的脚手架控制器MyModel -Repository(天啊,它正在工作)