2011-05-16 30 views
0

我試圖與指定的以下模板添加一個新的控制器,新的控制器:ASP.NET MVC 3 - 錯誤添加使用MvcScaffolding模板

MvcScaffolding:控制器,具有讀/寫操作和視圖,使用存儲庫

這在以前的項目工作,但現在我越來越從包管理器的輸出如下:

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 

上發生了什麼任何想法?

回答

0

當您安裝T4Scaffolding包時,它會在powershell主機中註冊它的程序集和包含的cmdlet。出於某種原因,它可能會從兩個不同的位置加載T4Scaffolding軟件包,並且由於powershell無法確定要執行哪個軟件包cmdlet,因此會「解析爲不明確的cmdlet名稱」錯誤。 正如我看到你執行「C:\ Development \ packages \ MvcScaffolding.1.0.0 \ tools \ RazorView \ MvcScaffolding.RazorView.ps1」中的模板,這看起來像是一個全局包,如果你的解決方案中本地安裝了MvcsScaffolding - ( SolutionFolder)\ p​​ackages \ MvcScaffolding.1.0.0 powershell可能會加載這兩個包。

如果您從Visual Studio生成控制器 - >項目 - >右鍵 - >生成控制器,它將工作,因爲Visual Studio插入控制器生成不使用T4Scaffolding powershell命令。