开发者

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

开发者 https://www.devze.com 2023-03-05 22:37 出处:网络
I\'m trying to add a new controller with the following template specified: MvcScaffolding: Controller with read/write action and views, using repositories

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消