MvcScaffolding NuGet 安装:“已添加具有相同密钥的项目”
我通过 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
I'm getting an error when installing MvcScaffolding through NuGet. Has anyone got any suggestions for how to fix the problem?
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
I've tried uninstalling the re-installing using this command:
Uninstall-Package MvcScaffolding -RemoveDependencies
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我也遇到了这个错误的问题。对我有用的是卸载 MvcScaffolding 及其每个依赖项,每次卸载时使用单独的命令,如“Uninstall-Package T4Scaffolding”中所示。我还从我的驱动器和源代码管理中删除了它们的关联文件和文件夹。然后,我重新安装,一切正常。文件的删除似乎是关键。
I had problems with this error as well. What worked for me was to uninstall MvcScaffolding and each of its dependencies with a separate command for each uninstall as in 'Uninstall-Package T4Scaffolding'. I also deleted their associated files and folders from my drive and source control. Then, I re-installed and all was fine. That deletion of the files seemed to be key.
正如对原始问题的评论中提到的,我相信这是 MVC Scaffolding 中的一个错误,请参阅: http:// /mvcscaffolding.codeplex.com/workitem/27
As mentioned in the comments on the original question, I believe this is a bug in MVC Scaffolding, see: http://mvcscaffolding.codeplex.com/workitem/27