When i right click a folder and click "Add Controller" i get this error:
Object reference not set to an instance of an object
This error also started to appear in Package Manager Console when i open the project.
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
This is question is the exact same.
Cannot add a MVC controller VS2012 gives "object reference not set to an instance of an object"
The solution is to install PowerShell 3, However when i run the installer i get another error:
The update is not applicable to your computer.
Another thing worth mentioning, is that this error only accures in a specific project, it works fine if i create a new MVC project.
I't would be awesome if i could avoid moveing everything to a new project. Any suggestions?
Update
The error accours when trying to install MvcScaffolding from package manager console
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.