Установка MvcScaffolding NuGet: «Элемент с тем же ключом уже добавлен» - PullRequest
1 голос
/ 08 июня 2011

Я получаю сообщение об ошибке при установке MvcScaffolding через NuGet. Кто-нибудь получил какие-либо предложения о том, как решить проблему?

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

Ответы [ 2 ]

2 голосов
/ 29 июня 2011

У меня тоже были проблемы с этой ошибкой.Для меня сработало удаление MvcScaffolding и каждой из его зависимостей с помощью отдельной команды для каждой деинсталляции, как в «Uninstall-Package T4Scaffolding».Я также удалил связанные с ними файлы и папки с моего диска и системы контроля версий.Затем я переустановил и все было хорошо.Это удаление файлов, казалось, было ключевым.

0 голосов
/ 13 июля 2011

Как уже упоминалось в комментариях к исходному вопросу, я считаю, что это ошибка в MVC Scaffolding, см .: http://mvcscaffolding.codeplex.com/workitem/27

...