当我右键单击一个文件夹并单击“”时,我会得到以下错误:
Object reference not set to an instance of an object打开项目时,软件包管理器控制台中也会出现此错误。
New-Object : Could not load file or assembly 'System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
At C:\Users\b\Desktop\Git\EyeglassShop\packages\MvcScaffolding.1.0.9\tools\registerWithMvcTooling.ps1:163 char:27
+ $newProvider = New-Object <<<< $powerShellScaffolderProviderType($mvcScaffoldingProvider)
+ CategoryInfo : NotSpecified: (:) [New-Object], FileNotFoundException
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.NewObjectCommand这个问题是完全一样的。
Cannot add a MVC controller VS2012 gives "object reference not set to an instance of an object"
解决方案是安装PowerShell 3,但是当我运行安装程序时,会得到另一个错误:
The update is not applicable to your computer.另外值得一提的是,这个错误只发生在一个特定的项目中,如果我创建了一个新的MVC项目,它可以正常工作。
如果我能避免把所有的东西都搬到一个新的项目上,我就不太棒了。有什么建议吗?
更新
尝试从包管理器控制台安装MvcScaffolding时会发生错误。
PM> install-package MvcScaffolding
Attempting to resolve dependency 'T4Scaffolding'.
Attempting to resolve dependency 'T4Scaffolding.Core'.
Attempting to resolve dependency 'EntityFramework'.
Successfully installed 'T4Scaffolding.Core 1.0.0'.
Successfully installed 'T4Scaffolding 1.0.8'.
Successfully installed 'MvcScaffolding 1.0.9'.
New-Object : Could not load file or assembly 'System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
At C:\Users\b\Desktop\EyeglassShop\EyeglassShop\packages\MvcScaffolding.1.0.9\tools\registerWithMvcTooling.ps1:163 char:27
+ $newProvider = New-Object <<<< $powerShellScaffolderProviderType($mvcScaffoldingProvider)
+ CategoryInfo : NotSpecified: (:) [New-Object], FileNotFoundException
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.NewObjectCommand
Successfully added 'T4Scaffolding.Core 1.0.0' to EyeglassShop.
Successfully added 'T4Scaffolding 1.0.8' to EyeglassShop.
Successfully added 'MvcScaffolding 1.0.9' to EyeglassShop.发布于 2013-10-21 11:52:26
我需要安装SP 1才能安装Powershell。现在我有了它:
https://stackoverflow.com/questions/19487831
复制相似问题