Scaffolding controllers with repositories in Mvc5, EF6, VisualStudio 2013 - visual-studio-2013

In vs2012 I used to use Steve Sanderson's mvcScaffolding Package with this package I could scaffold Action Methods with unit tests and controllers with repositories and dependency injection.
My question is simple. Is there a way to do so in vs2013?
When I install the package in vs2013 I get the following errors:
Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At C:\dev\WebApplication2\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:\dev\WebApplication2\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:\dev\WebApplication2\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:\dev\WebApplication2\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:\dev\WebApplication2\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:\dev\WebApplication2\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:\dev\WebApplication2\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:\dev\WebApplication2\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:\dev\WebApplication2\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

We are moving to a new system for Scaffolding, but for now, run VS as admin and use this -pre version we've updated:
Install-Package MvcScaffolding -Version 1.0.8-vs2013 -Pre
I'll blog this.

The error you are getting is that it can't create instance of the VS IDE (EnvDTE.DTE). That scaffolding package is referencing an older version of the VS IDE and so it will not work in VS2013. That project will have to be updated to properly support VS2013.
The codeplex project looks like it has not been updated in quite sometime so my guess is that unless the project moved to a different open source repository, it is dead.
Since ASP.NET has its own scaffolding now built right in, I would suggest that it is time to convert over.

try this in command line:
cd C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\
devenv.exe /setup "Extensions\Microsoft\Web\Mvc\Scaffolding\Microsoft.AspNet.Scaffolding.Mvc.5.0.dll"

For solved this problem on VS2013 Update 4, I will have to uninstall from all modules, on .\packages directorie remove all T4*, Exit from VS.
Enter again, and use the solutions from witttness, do on package manager console:
Install-Package MvcMailer-vs2013 -pre, and voilá, its work since then...
Thanks for everything

I know this was posted a while ago, but, I came across this same bug in VS2015 whilst using MvcScaffolding. The actual bug lies in the T4Scaffolding.Core package. I pulled the source, fixed the bugs, and uploaded new NuGet packages with linked dependencies. The 3 new packages are:
MvcScaffolding.VS2015
T4Scaffolding.VS2015
T4Scaffolding.Core.VS2015
First uninstall MvcScaffolding and its dependencies, T4Scaffolding, & T4Scaffolding.Core. If you then simply install the MvcScaffolding package, the other packages will be pulled through. Hope this helps someone else.
Cheers.

Related

Error while trying to import 'oh-my-posh' with Import-Module in windows terminal

I installed the oh my posh module and am trying to import it with Import-Module oh-my-posh. But I'm getting the following error
Downloading oh-my-posh executable for 7.36.1
Get-CimInstance : Invalid class
At C:\Program Files\WindowsPowerShell\Modules\oh-my-posh\7.36.1\oh-my-posh.psm1:66 char:18
+ ... $arch = (Get-CimInstance -Class Win32_Processor -Property Architec ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : MetadataError: (:) [Get-CimInstance], CimException
+ FullyQualifiedErrorId : HRESULT 0x80041010,Microsoft.Management.Infrastructure.CimCmdlets.GetCimInstanceCommand
Import-Module : oh-my-posh: Unsupported architecture:
At line:1 char:1
+ Import-Module oh-my-posh
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (oh-my-posh: Unsupported architecture: :String) [Import-Module], Runti
meException
+ FullyQualifiedErrorId : oh-my-posh: Unsupported architecture: ,Microsoft.PowerShell.Commands.ImportModuleCommand
Why am I getting this? I ran Set-ExecutionPolicy Unrestricted before
The module is no longer supported, and this issue has been resolved in the meantime because of it. Have a look here to get you going again.

Delete elasticsearch template in Windows

I am trying to delete elasticsearch template in Windows, however, it keeps giving me error result like this.
PS C:\Users\Administrator> curl -XGET localhost:9200/_template/
Invoke-WebRequest : A parameter cannot be found that matches parameter name 'XGET'.
At line:1 char:6
+ curl -XGET localhost:9200/_template/
+ ~~~~~
+ CategoryInfo : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
PS C:\Users\Administrator\Downloads\curator> curl GET localhost:9200/_template/
Invoke-WebRequest : A positional parameter cannot be found that accepts argument 'localhost:9200/_template/'.
At line:1 char:1
+ curl GET localhost:9200/_template/
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Is there anyway to resolve the issues?
curl is an alias for the Invoke-WebRequest cmdlet:
get-command curl | select Name
Name
----
curl
-XGET is equivalent to -Method Get which is the default. So this should work:
Invoke-WebRequest 'http://localhost:9200/_template/'
Note: You probably have to adopt the scheme.

powershell behavior when host file handle is closed

I'm looking for an explanation (preferably documentation) of the following madness.
Say I have the following simple Perl script:
use strict;
use warnings;
my $output = "C:\\Temp\\aout.txt";
my $outpute = "C:\\Temp\\aoute.txt";
my $command = "powershell C:\\test.ps1";
close STDOUT;
close STDERR;
if ( (my $pid = fork()) == 0 ) {
open (STDOUT,">>$output") or die "cannot open $output as stdout: $!";
open (STDERR,">>$outpute") or die "cannot open $outpute as stderr: $!";
exec $command or die "couldn't exec $command: $!";
} else {
my $ret = waitpid($pid,0);
}
And that the Powershell script contains:
write-output "yay1";
write-error "nay2";
write-output "yay3";
write-error "nay4";
write-output "yay5";
write-error "nay6";
write-output "yay7";
write-error "nay8";
write-host "done!";
If I run the Perl script, it produces two files, as expected, with the following output:
aout.txt:
yay1
yay3
yay5
yay7
done!
aoute.txt:
C:\test.ps1 : nay2
At line:1 char:41
+ C:\test.ps1 <<<<
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,test.ps1
C:\test.ps1 : nay4
At line:1 char:41
+ C:\test.ps1 <<<<
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,test.ps1
C:\test.ps1 : nay6
At line:1 char:41
+ C:\test.ps1 <<<<
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,test.ps1
C:\test.ps1 : nay8
At line:1 char:41
+ C:\test.ps1 <<<<
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,test.ps1
If I modify the Perl script to keep STDERR closed before executing Powershell:
use strict;
use warnings;
my $output = "C:\\Temp\\aout.txt";
my $command = "powershell C:\\test.ps1";
close STDOUT;
close STDERR;
if ( (my $pid = fork()) == 0 ) {
open (STDOUT,">>$output") or die "cannot open $output as stdout: $!";
exec $command or die "couldn't exec $command: $!";
} else {
my $ret = waitpid($pid,0);
}
Then it produces one STDOUT file with all of the output:
yay1
C:\\test.ps1 : nay2
At line:1 char:41
+ C:\\test.ps1 <<<<
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,test.ps1
yay3
C:\\test.ps1 : nay4
At line:1 char:41
+ C:\\test.ps1 <<<<
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,test.ps1
yay5
C:\\test.ps1 : nay6
At line:1 char:41
+ C:\\test.ps1 <<<<
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,test.ps1
yay7
C:\\test.ps1 : nay8
At line:1 char:41
+ C:\\test.ps1 <<<<
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,test.ps1
done!
Is Powershell really realizing that STDERR is closed, and is doing a clean redirect onto STDOUT? Or is it the command line console? Or is it Perl?
For reference, this is on Windows Server 2003 x64 SP2 with:
C:\>perl --version
This is perl, v5.8.8 built for MSWin32-x64-multi-thread
(with 33 registered patches, see perl -V for more detail)
Copyright 1987-2006, Larry Wall
Binary build 819 [267479] provided by ActiveState http://www.ActiveState.com
Built Aug 27 2006 22:13:23
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
C:\>powershell get-host
Name : ConsoleHost
Version : 2.0
InstanceId : 1ac67afa-f020-414c-b47b-031bdc8cc703
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : en-US
CurrentUICulture : en-US
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
and this is part of an ongoing effort related to this and this.

powershell 2.0 command line redirection

I'm looking for an explanation of the following discrepancy:
Given the following powershell script foo.ps1:
write-host "normal"
write-error "error"
write-host "yay"
Running it with
C:\>powershell .\foo.ps1 > out.txt 2>&1
Produces:
normal
C:\foo.ps1 : error
At line:1 char:10
+ .\foo.ps1 <<<<
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,foo.ps1
Write-Host : The OS handle's position is not what FileStream expected. Do not use a handle simultaneously in one FileStream and in Win32 co
de or another FileStream. This may cause data loss.
At C:\foo.ps1:3 char:11
+ write-host <<<< "yay"
+ CategoryInfo : NotSpecified: (:) [Write-Host], IOException
+ FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.WriteHostCommand
But running with:
C:\>powershell .\foo.ps1 2>&1 > out.txt
Produces (correctly):
normal
C:\foo.ps1 : error
At line:1 char:10
+ .\foo.ps1 <<<<
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,foo.ps1
yay
I almost resolved myself into thinking that the order of the redirection mattered in Windows, however all of the examples in the TechNet usage page for command redirection show the file redirection preceding the stderr redirection.
Can someone please explain this to me?
For reference, this is being done on Server 2003 x64 SP2 with:
C:\>powershell get-host
Name : ConsoleHost
Version : 2.0
InstanceId : 53c90e87-ded1-44f9-8e8d-6baaa1335420
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : en-US
CurrentUICulture : en-US
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
and using write-output produces the same result.
(This question is related to my work in solving this.)
That looks like a bug in PowerShell 2.0. I tried reproducing with the PowerShell 3.0 preview and it now works as expected.

ASP.NET MVC 3 - Error adding a new Controller using the MvcScaffolding template

I'm trying to add a new controller with the following template specified:
MvcScaffolding: Controller with read/write action and views, using repositories
This has worked in a previous project, but I'm now getting the following output from the Package Manager:
Scaffolding SubjectsController...
LibraryContext already has a member called 'Subjects'. Skipping...
Add-ProjectItemViaTemplate : The term 'Find-ScaffolderTemplate' resolved to a cmdlet name that is ambiguous. Possible m
atches include: T4Scaffolding\Find-ScaffolderTemplate T4Scaffolding\Find-ScaffolderTemplate.
At C:\Development\packages\T4Scaffolding.1.0.0\tools\EFRepository\T4Scaffolding.EFRepository.ps1:47 char:27
+ Add-ProjectItemViaTemplate <<<< $outputPath -Template Repository -Model #{
+ CategoryInfo : NotSpecified: (:) [Add-ProjectItemViaTemplate], CommandNotFoundException
+ FullyQualifiedErrorId : T4Scaffolding.Cmdlets.AddProjectItemViaTemplateCmdlet
Add-ProjectItemViaTemplate : The term 'Find-ScaffolderTemplate' resolved to a cmdlet name that is ambiguous. Possible m
atches include: T4Scaffolding\Find-ScaffolderTemplate T4Scaffolding\Find-ScaffolderTemplate.
At C:\Development\packages\MvcScaffolding.1.0.0\tools\Controller\MvcScaffolding.Controller.ps1:106 char:27
+ Add-ProjectItemViaTemplate <<<< $outputPath -Template $templateName -Model #{
+ CategoryInfo : NotSpecified: (:) [Add-ProjectItemViaTemplate], CommandNotFoundException
+ FullyQualifiedErrorId : T4Scaffolding.Cmdlets.AddProjectItemViaTemplateCmdlet
Add-ProjectItemViaTemplate : The term 'Find-ScaffolderTemplate' resolved to a cmdlet name that is ambiguous. Possible m
atches include: T4Scaffolding\Find-ScaffolderTemplate T4Scaffolding\Find-ScaffolderTemplate.
At C:\Development\packages\MvcScaffolding.1.0.0\tools\RazorView\MvcScaffolding.RazorView.ps1:49 char:27
+ Add-ProjectItemViaTemplate <<<< $outputPath -Template $Template -Model #{
+ CategoryInfo : NotSpecified: (:) [Add-ProjectItemViaTemplate], CommandNotFoundException
+ FullyQualifiedErrorId : T4Scaffolding.Cmdlets.AddProjectItemViaTemplateCmdlet
Add-ProjectItemViaTemplate : The term 'Find-ScaffolderTemplate' resolved to a cmdlet name that is ambiguous. Possible m
atches include: T4Scaffolding\Find-ScaffolderTemplate T4Scaffolding\Find-ScaffolderTemplate.
At C:\Development\packages\MvcScaffolding.1.0.0\tools\RazorView\MvcScaffolding.RazorView.ps1:49 char:27
+ Add-ProjectItemViaTemplate <<<< $outputPath -Template $Template -Model #{
+ CategoryInfo : NotSpecified: (:) [Add-ProjectItemViaTemplate], CommandNotFoundException
+ FullyQualifiedErrorId : T4Scaffolding.Cmdlets.AddProjectItemViaTemplateCmdlet
Add-ProjectItemViaTemplate : The term 'Find-ScaffolderTemplate' resolved to a cmdlet name that is ambiguous. Possible m
atches include: T4Scaffolding\Find-ScaffolderTemplate T4Scaffolding\Find-ScaffolderTemplate.
At C:\Development\packages\MvcScaffolding.1.0.0\tools\RazorView\MvcScaffolding.RazorView.ps1:49 char:27
+ Add-ProjectItemViaTemplate <<<< $outputPath -Template $Template -Model #{
+ CategoryInfo : NotSpecified: (:) [Add-ProjectItemViaTemplate], CommandNotFoundException
+ FullyQualifiedErrorId : T4Scaffolding.Cmdlets.AddProjectItemViaTemplateCmdlet
Add-ProjectItemViaTemplate : The term 'Find-ScaffolderTemplate' resolved to a cmdlet name that is ambiguous. Possible m
atches include: T4Scaffolding\Find-ScaffolderTemplate T4Scaffolding\Find-ScaffolderTemplate.
At C:\Development\packages\MvcScaffolding.1.0.0\tools\RazorView\MvcScaffolding.RazorView.ps1:49 char:27
+ Add-ProjectItemViaTemplate <<<< $outputPath -Template $Template -Model #{
+ CategoryInfo : NotSpecified: (:) [Add-ProjectItemViaTemplate], CommandNotFoundException
+ FullyQualifiedErrorId : T4Scaffolding.Cmdlets.AddProjectItemViaTemplateCmdlet
Add-ProjectItemViaTemplate : The term 'Find-ScaffolderTemplate' resolved to a cmdlet name that is ambiguous. Possible m
atches include: T4Scaffolding\Find-ScaffolderTemplate T4Scaffolding\Find-ScaffolderTemplate.
At C:\Development\packages\MvcScaffolding.1.0.0\tools\RazorView\MvcScaffolding.RazorView.ps1:49 char:27
+ Add-ProjectItemViaTemplate <<<< $outputPath -Template $Template -Model #{
+ CategoryInfo : NotSpecified: (:) [Add-ProjectItemViaTemplate], CommandNotFoundException
+ FullyQualifiedErrorId : T4Scaffolding.Cmdlets.AddProjectItemViaTemplateCmdlet
Add-ProjectItemViaTemplate : The term 'Find-ScaffolderTemplate' resolved to a cmdlet name that is ambiguous. Possible m
atches include: T4Scaffolding\Find-ScaffolderTemplate T4Scaffolding\Find-ScaffolderTemplate.
At C:\Development\packages\MvcScaffolding.1.0.0\tools\RazorView\MvcScaffolding.RazorView.ps1:49 char:27
+ Add-ProjectItemViaTemplate <<<< $outputPath -Template $Template -Model #{
+ CategoryInfo : NotSpecified: (:) [Add-ProjectItemViaTemplate], CommandNotFoundException
+ FullyQualifiedErrorId : T4Scaffolding.Cmdlets.AddProjectItemViaTemplateCmdlet
Any ideas on what's happening?
When you install the T4Scaffolding package it registers it's assemblies and contained cmdlets in the powershell host. For some reason it may load T4Scaffolding package from two different locations and you get "resolved to a cmdlet name that is ambiguous" error as powershell cannot decide which package cmdlet to execute.
As I see you execute template from "C:\Development\packages\MvcScaffolding.1.0.0\tools\RazorView\MvcScaffolding.RazorView.ps1" which seems like a global package and if you have MvcsScaffolding installed locally in your solution - (SolutionFolder)\packages\MvcScaffolding.1.0.0 powershell may load both packages.
If you generate controller from Visual Studio -> Project-> right button -> Generate controller it will works as Visual Studio plug in for controller generation does not use T4Scaffolding powershell commands.

Resources