Nuget PM Visual Studio Express v2013 中的错误

Posted

技术标签:

【中文标题】Nuget PM Visual Studio Express v2013 中的错误【英文标题】:Error in Nuget PM Visual Studio Express v2013 【发布时间】:2013-10-31 06:12:19 【问题描述】:

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

我已尝试卸载 T4 Scaffolding 并重新安装。我在 Visual Studio 2012 中开发了这个程序并进行了 3 次更新,现在已经将该程序迁移到 VS Express 2013 该程序在 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:Postal。 这里相同...VS2013 MVC 脚手架在尝试执行和/或使用 nuget 安装替代版本时遇到麻烦。 对此有什么好处吗?解决问题,还是放弃? 【参考方案1】:

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

我曾就此向包括 T4scaffolding 的开发人员在内的几位 MS 人员询问过,但没有得到满意的答复。

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

目前唯一的解决方案是使用 VS2012 直到修复此错误:(

【讨论】:

我真的不认为这与 Microsoft 及其策略有关 - 这是与 nuget 包及其与各种扩展的兼容性有关的问题。 你可以想你所想,它适用于 VS2013 之前的所有版本。看一下 T4Scaffolding 包,你会发现有一个 VS2013 的预发布包...nuget.org/packages/T4Scaffolding.Core/1.0.0-vs2013MS f?*&%ed T4 在 VS2013 上已经很长时间了..

以上是关于Nuget PM Visual Studio Express v2013 中的错误的主要内容,如果未能解决你的问题,请参考以下文章

为啥 Visual Studio 2015 控制台运行程序无法识别 MSpec?

如何在Visual Studio工具栏中添加WebView2控件?

Visual Studio NuGet离线安装

如何下载没有 nuget.exe 或 Visual Studio 扩展的 Nuget 包?

VS(Visual Studio)中Nuget的使用

Visual Studio 2013 更新 NuGet 包管理器