通过NuGet安装MvcScaffolding时遇到错误。有没有人对如何解决问题有任何建议?
PM> install-Package MvcScaffolding -Verbose
Dependency 'T4Scaffolding (≥ 1.0.0)' already installed.
Dependency 'EntityFramework (≥ 4.1.10311.0)' already installed.
Added file 'InstallationDummyFile.txt' to folder 'MvcScaffolding.1.0.0\content'.
Added file 'Action.cs.t4' to folder 'MvcScaffolding.1.0.0\tools\Action'.
Added file 'Action.vb.t4' to folder 'MvcScaffolding.1.0.0\tools\Action'.
Added file 'ActionPost.cs.t4' to folder 'MvcScaffolding.1.0.0\tools\Action'.
Added file 'ActionPost.vb.t4' to folder 'MvcScaffolding.1.0.0\tools\Action'.
Added file 'MvcScaffolding.Action.ps1' to folder 'MvcScaffolding.1.0.0\tools\Action'.
Added file 'ViewModel.cs.t4' to folder 'MvcScaffolding.1.0.0\tools\Action'.
Added file 'ViewModel.vb.t4' to folder 'MvcScaffolding.1.0.0\tools\Action'.
Added file 'MvcScaffolding.ActionUnitTest.ps1' to folder 'MvcScaffolding.1.0.0\tools\ActionUnitTest'.
Added file 'TestClass.cs.t4' to folder 'MvcScaffolding.1.0.0\tools\ActionUnitTest'.
Added file 'TestClass.vb.t4' to folder 'MvcScaffolding.1.0.0\tools\ActionUnitTest'.
Added file 'TestMethod.cs.t4' to folder 'MvcScaffolding.1.0.0\tools\ActionUnitTest'.
Added file 'TestMethod.vb.t4' to folder 'MvcScaffolding.1.0.0\tools\ActionUnitTest'.
Added file 'MvcScaffolding.ActionWithUnitTest.ps1' to folder 'MvcScaffolding.1.0.0\tools\ActionWithUnitTest'.
Added file 'Create.cs.t4' to folder 'MvcScaffolding.1.0.0\tools\AspxView'.
Added file 'Create.vb.t4' to folder 'MvcScaffolding.1.0.0\tools\AspxView'.
Added file 'CreateOrEdit.cs.t4' to folder 'MvcScaffolding.1.0.0\tools\AspxView'.
Added file 'CreateOrEdit.vb.t4' to folder 'MvcScaffolding.1.0.0\tools\AspxView'.
Added file 'Delete.cs.t4' to folder 'MvcScaffolding.1.0.0\tools\AspxView'.
Added file 'Delete.vb.t4' to folder 'MvcScaffolding.1.0.0\tools\AspxView'.
Added file 'Details.cs.t4' to folder 'MvcScaffolding.1.0.0\tools\AspxView'.
Added file 'Details.vb.t4' to folder 'MvcScaffolding.1.0.0\tools\AspxView'.
Added file 'Edit.cs.t4' to folder 'MvcScaffolding.1.0.0\tools\AspxView'.
Added file 'Edit.vb.t4' to folder 'MvcScaffolding.1.0.0\tools\AspxView'.
Added file 'Empty.cs.t4' to folder 'MvcScaffolding.1.0.0\tools\AspxView'.
Added file 'Empty.vb.t4' to folder 'MvcScaffolding.1.0.0\tools\AspxView'.
Added file 'Index.cs.t4' to folder 'MvcScaffolding.1.0.0\tools\AspxView'.
Added file 'Index.vb.t4' to folder 'MvcScaffolding.1.0.0\tools\AspxView'.
Added file 'MvcScaffolding.AspxView.ps1' to folder 'MvcScaffolding.1.0.0\tools\AspxView'.
Added file 'ControllerWithContext.cs.t4' to folder 'MvcScaffolding.1.0.0\tools\Controller'.
Added file 'ControllerWithContext.vb.t4' to folder 'MvcScaffolding.1.0.0\tools\Controller'.
Added file 'ControllerWithRepository.cs.t4' to folder 'MvcScaffolding.1.0.0\tools\Controller'.
Added file 'ControllerWithRepository.vb.t4' to folder 'MvcScaffolding.1.0.0\tools\Controller'.
Added file 'MvcScaffolding.Controller.ps1' to folder 'MvcScaffolding.1.0.0\tools\Controller'.
Added file 'MvcScaffolding.ControllerWithRepository.ps1' to folder 'MvcScaffolding.1.0.0\tools\Controller'.
Added file 'init.ps1' to folder 'MvcScaffolding.1.0.0\tools'.
Added file 'install.ps1' to folder 'MvcScaffolding.1.0.0\tools'.
Added file 'Create.cs.t4' to folder 'MvcScaffolding.1.0.0\tools\RazorView'.
Added file 'Create.vb.t4' to folder 'MvcScaffolding.1.0.0\tools\RazorView'.
Added file 'Delete.cs.t4' to folder 'MvcScaffolding.1.0.0\tools\RazorView'.
Added file 'Delete.vb.t4' to folder 'MvcScaffolding.1.0.0\tools\RazorView'.
Added file 'Details.cs.t4' to folder 'MvcScaffolding.1.0.0\tools\RazorView'.
Added file 'Details.vb.t4' to folder 'MvcScaffolding.1.0.0\tools\RazorView'.
Added file 'Edit.cs.t4' to folder 'MvcScaffolding.1.0.0\tools\RazorView'.
Added file 'Edit.vb.t4' to folder 'MvcScaffolding.1.0.0\tools\RazorView'.
Added file 'Empty.cs.t4' to folder 'MvcScaffolding.1.0.0\tools\RazorView'.
Added file 'Empty.vb.t4' to folder 'MvcScaffolding.1.0.0\tools\RazorView'.
Added file 'Index.cs.t4' to folder 'MvcScaffolding.1.0.0\tools\RazorView'.
Added file 'Index.vb.t4' to folder 'MvcScaffolding.1.0.0\tools\RazorView'.
Added file 'MvcScaffolding.RazorView.ps1' to folder 'MvcScaffolding.1.0.0\tools\RazorView'.
Added file '_CreateOrEdit.cs.t4' to folder 'MvcScaffolding.1.0.0\tools\RazorView'.
Added file '_CreateOrEdit.vb.t4' to folder 'MvcScaffolding.1.0.0\tools\RazorView'.
Added file 'registerWithMvcTooling.ps1' to folder 'MvcScaffolding.1.0.0\tools'.
Added file 'MvcScaffolding.Views.ps1' to folder 'MvcScaffolding.1.0.0\tools\Views'.
Added file 'MvcScaffolding.1.0.0.nupkg' to folder 'MvcScaffolding.1.0.0'.
Successfully installed 'MvcScaffolding 1.0.0'.
Executing script file 'C:\MyProject\packages\MvcScaffolding.1.0.0\tools\init.ps1'.
Added file 'InstallationDummyFile.txt'.
Added file 'InstallationDummyFile.txt' to project 'ReinsuranceManagementWebUI'
Added file 'packages.config'.
Added file 'packages.config' to project 'ReinsuranceManagementWebUI'
Successfully added 'MvcScaffolding 1.0.0' to ReinsuranceManagementWebUI.
Executing script file 'C:\MyProject\packages\MvcScaffolding.1.0.0\tools\install.ps1'.
Get-ProjectItem : An item with the same key has already been added.
At C:\MyProject\packages\MvcScaffolding.1.0.0\tools\install.ps1:22 char:16
+ Get-ProjectItem <<<< "InstallationDummyFile.txt" -Project $projectName | %{ $_.Delete() }
+ CategoryInfo : NotSpecified: (:) [Get-ProjectItem], ArgumentException
+ FullyQualifiedErrorId : T4Scaffolding.Cmdlets.GetProjectItemCmdlet
Set-DefaultScaffolder : An item with the same key has already been added.
At C:\MyProject\packages\MvcScaffolding.1.0.0\tools\install.ps1:24 char:22
+ Set-DefaultScaffolder <<<< -Name Controller -Scaffolder MvcScaffolding.Controller -SolutionWide -DoNotOverwriteExistingSetting
+ CategoryInfo : NotSpecified: (:) [Set-DefaultScaffolder], ArgumentException
+ FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet
Set-DefaultScaffolder : An item with the same key has already been added.
At C:\MyProject\packages\MvcScaffolding.1.0.0\tools\install.ps1:25 char:22
+ Set-DefaultScaffolder <<<< -Name Views -Scaffolder MvcScaffolding.Views -SolutionWide -DoNotOverwriteExistingSetting
+ CategoryInfo : NotSpecified: (:) [Set-DefaultScaffolder], ArgumentException
+ FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet
Set-DefaultScaffolder : An item with the same key has already been added.
At C:\MyProject\packages\MvcScaffolding.1.0.0\tools\install.ps1:26 char:22
+ Set-DefaultScaffolder <<<< -Name Action -Scaffolder MvcScaffolding.Action -SolutionWide -DoNotOverwriteExistingSetting
+ CategoryInfo : NotSpecified: (:) [Set-DefaultScaffolder], ArgumentException
+ FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet
Set-DefaultScaffolder : An item with the same key has already been added.
At C:\MyProject\packages\MvcScaffolding.1.0.0\tools\install.ps1:27 char:22
+ Set-DefaultScaffolder <<<< -Name UnitTest -Scaffolder MvcScaffolding.ActionUnitTest -SolutionWide -DoNotOverwriteExistingSetting
+ CategoryInfo : NotSpecified: (:) [Set-DefaultScaffolder], ArgumentException
+ FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet
Set-DefaultScaffolder : An item with the same key has already been added.
At C:\MyProject\packages\MvcScaffolding.1.0.0\tools\install.ps1:31 char:22
+ Set-DefaultScaffolder <<<< -Name View -Scaffolder $viewScaffolder -SolutionWide -DoNotOverwriteExistingSetting
+ CategoryInfo : NotSpecified: (:) [Set-DefaultScaffolder], ArgumentException
+ FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet
我尝试使用此命令卸载重新安装:
Uninstall-Package MvcScaffolding -RemoveDependencies
答案 0 :(得分:2)
我也遇到了这个错误的问题。对我来说有用的是在每次卸载时使用单独的命令卸载MvcScaffolding及其每个依赖项,如“卸载 - 软件包T4Scaffolding&#39;”。我还从驱动器和源代码控制中删除了相关的文件和文件夹。然后,我重新安装,一切都很好。删除文件似乎很关键。
答案 1 :(得分:0)
正如对原始问题的评论所述,我认为这是MVC脚手架中的一个错误,请参阅:http://mvcscaffolding.codeplex.com/workitem/27