我无法通过Nuget软件包管理器解决此错误。

我尝试卸载T4脚手架,然后重新安装。我使用3个更新在Visual Studio 2012中开发了该程序,现在已将该程序迁移到VS Express2013。该程序在2012版本中没有错误。我已经搜索了Internet,Nuget和此站点,但无法解决该问题。我应该提到我的软件包中包含MvcMailer,它似乎依赖于T4脚手架。并且答案将不胜感激。

 Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At E:\Visual Studio
2012\Projects\ArtsProject\packages\T4Scaffolding.Core.1.0.0\tools\init.ps1:50
char:9
+         Set-DefaultScaffolder -Name CustomTemplate -Scaffolder
T4Scaffolding.Cus ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
    + CategoryInfo          : NotSpecified: (:) [Set-DefaultScaffolder], Inval
   idOperationException
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At E:\Visual Studio
2012\Projects\ArtsProject\packages\T4Scaffolding.Core.1.0.0\tools\init.ps1:51
char:9
+         Set-DefaultScaffolder -Name CustomScaffolder -Scaffolder
T4Scaffolding.C ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
    + CategoryInfo          : NotSpecified: (:) [Set-DefaultScaffolder], Inval
   idOperationException
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At E:\Visual Studio
2012\Projects\ArtsProject\packages\T4Scaffolding.1.0.8\tools\init.ps1:6 char:1
+ Set-DefaultScaffolder -Name DbContext -Scaffolder T4Scaffolding.EFDbContext
-Sol ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
    + CategoryInfo          : NotSpecified: (:) [Set-DefaultScaffolder], Inval
   idOperationException
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At E:\Visual Studio
2012\Projects\ArtsProject\packages\T4Scaffolding.1.0.8\tools\init.ps1:7 char:1
+ Set-DefaultScaffolder -Name Repository -Scaffolder
T4Scaffolding.EFRepository -S ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
    + CategoryInfo          : NotSpecified: (:) [Set-DefaultScaffolder], Inval
   idOperationException
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At E:\Visual Studio
2012\Projects\ArtsProject\packages\MvcScaffolding.1.0.9\tools\init.ps1:47
char:1
+ Set-DefaultScaffolder -Name Controller -Scaffolder MvcScaffolding.Controller
-So ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
    + CategoryInfo          : NotSpecified: (:) [Set-DefaultScaffolder], Inval
   idOperationException
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At E:\Visual Studio
2012\Projects\ArtsProject\packages\MvcScaffolding.1.0.9\tools\init.ps1:48
char:1
+ Set-DefaultScaffolder -Name Views -Scaffolder MvcScaffolding.Views
-SolutionWide ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
    + CategoryInfo          : NotSpecified: (:) [Set-DefaultScaffolder], Inval
   idOperationException
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At E:\Visual Studio
2012\Projects\ArtsProject\packages\MvcScaffolding.1.0.9\tools\init.ps1:49
char:1
+ Set-DefaultScaffolder -Name Action -Scaffolder MvcScaffolding.Action
-SolutionWi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
    + CategoryInfo          : NotSpecified: (:) [Set-DefaultScaffolder], Inval
   idOperationException
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At E:\Visual Studio
2012\Projects\ArtsProject\packages\MvcScaffolding.1.0.9\tools\init.ps1:50
char:1
+ Set-DefaultScaffolder -Name UnitTest -Scaffolder
MvcScaffolding.ActionUnitTest - ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
    + CategoryInfo          : NotSpecified: (:) [Set-DefaultScaffolder], Inval
   idOperationException
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At E:\Visual Studio
2012\Projects\ArtsProject\packages\MvcScaffolding.1.0.9\tools\init.ps1:54
char:1
+ Set-DefaultScaffolder -Name View -Scaffolder $viewScaffolder -SolutionWide
-DoNo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
    + CategoryInfo          : NotSpecified: (:) [Set-DefaultScaffolder], Inval
   idOperationException
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

PM> Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At E:\Visual Studio
2012\Projects\ArtsProject\packages\T4Scaffolding.Core.1.0.0\tools\init.ps1:50
char:9
+         Set-DefaultScaffolder -Name CustomTemplate -Scaffolder
T4Scaffolding.Cus ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
    + CategoryInfo          : NotSpecified: (:) [Set-DefaultScaffolder], Inval
   idOperationException
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At E:\Visual Studio
2012\Projects\ArtsProject\packages\T4Scaffolding.Core.1.0.0\tools\init.ps1:51
char:9
+         Set-DefaultScaffolder -Name CustomScaffolder -Scaffolder
T4Scaffolding.C ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
    + CategoryInfo          : NotSpecified: (:) [Set-DefaultScaffolder], Inval
   idOperationException
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At E:\Visual Studio
2012\Projects\ArtsProject\packages\T4Scaffolding.1.0.8\tools\init.ps1:6 char:1
+ Set-DefaultScaffolder -Name DbContext -Scaffolder T4Scaffolding.EFDbContext
-Sol ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
    + CategoryInfo          : NotSpecified: (:) [Set-DefaultScaffolder], Inval
   idOperationException
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At E:\Visual Studio
2012\Projects\ArtsProject\packages\T4Scaffolding.1.0.8\tools\init.ps1:7 char:1
+ Set-DefaultScaffolder -Name Repository -Scaffolder
T4Scaffolding.EFRepository -S ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
    + CategoryInfo          : NotSpecified: (:) [Set-DefaultScaffolder], Inval
   idOperationException
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At E:\Visual Studio
2012\Projects\ArtsProject\packages\MvcScaffolding.1.0.9\tools\init.ps1:47
char:1
+ Set-DefaultScaffolder -Name Controller -Scaffolder MvcScaffolding.Controller
-So ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
    + CategoryInfo          : NotSpecified: (:) [Set-DefaultScaffolder], Inval
   idOperationException
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At E:\Visual Studio
2012\Projects\ArtsProject\packages\MvcScaffolding.1.0.9\tools\init.ps1:48
char:1
+ Set-DefaultScaffolder -Name Views -Scaffolder MvcScaffolding.Views
-SolutionWide ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
    + CategoryInfo          : NotSpecified: (:) [Set-DefaultScaffolder], Inval
   idOperationException
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At E:\Visual Studio
2012\Projects\ArtsProject\packages\MvcScaffolding.1.0.9\tools\init.ps1:49
char:1
+ Set-DefaultScaffolder -Name Action -Scaffolder MvcScaffolding.Action
-SolutionWi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
    + CategoryInfo          : NotSpecified: (:) [Set-DefaultScaffolder], Inval
   idOperationException
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At E:\Visual Studio
2012\Projects\ArtsProject\packages\MvcScaffolding.1.0.9\tools\init.ps1:50
char:1
+ Set-DefaultScaffolder -Name UnitTest -Scaffolder
MvcScaffolding.ActionUnitTest - ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
    + CategoryInfo          : NotSpecified: (:) [Set-DefaultScaffolder], Inval
   idOperationException
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

Exception calling "EnumerateFiles" with "3" argument(s): "The path is not of a
legal form."
At E:\Visual Studio
2012\Projects\ArtsProject\packages\MvcScaffolding.1.0.9\tools\init.ps1:35
char:8
+         | %{ [System.IO.Directory]::EnumerateFiles($_, "*." + $extension,
[System.IO.S ...
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ArgumentException

Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At E:\Visual Studio
2012\Projects\ArtsProject\packages\MvcScaffolding.1.0.9\tools\init.ps1:54
char:1
+ Set-DefaultScaffolder -Name View -Scaffolder $viewScaffolder -SolutionWide
-DoNo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
    + CategoryInfo          : NotSpecified: (:) [Set-DefaultScaffolder], Inval
   idOperationException
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

最佳答案

不幸的是,微软在VS2013中犯了一个严重的错误。他们用一种叫做动脉的东西代替了“旧的”脚手架方式...我在所有的nuget包中都使用了T4scaffolding,现在在VS2013中都无法使用它们了:(

我已经问过几个MS人员,包括T4scaffolding的开发人员,却没有得到满意的答复。

他们从事这一“动脉”工作真是太好了,但是当他们失去对Env.DTE的支持时,他们犯了一个大错误:(

现在唯一的解决方案是使用VS2012,直到修复此错误为止:(

关于nuget - Nuget PM Visual Studio Express v2013中的错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/19699563/

10-16 22:34