简体   繁体   中英

VSeWSS “An item with the same key has already been added”

During the package phase of a VSeWSS deployment, an exception is thrown. From the logs:

2009/11/02 11:59:46 Error System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary 2.Insert(TKey key, TValue value, Boolean add) at System.Collections.Generic.Dictionary 2.Add(TKey key, TValue value) at Microsoft.SharePoint.Tools.SharePointProxies.WSPViewFacade.CreateWebPartReferenceResolverClassMap(String[] paths) at VSeWSS.Server.Services.SPService.CreateWebPartReferenceResolverClassMap(String[] paths)

Has anyone seen this before? I have checked all my feature.xml files and my solution.xml to see if any id's have been duplicated, and they aren't. I've also checked the names of features, and they also have not been duplicated. Any hints?

It is probably a bug in vsewss. The problem is that it remembers that last time it added the same item.

Try:

  • Clean solution
  • Close and reopen Visual Studio

Edit: a few more things to try

  • Remove deployed code manually from Sharepoint
  • Do you have the latest version of the vsewss tool?
  • Do you have references between webpart projects?
  • Are any of the files in the pkg directory readonly

I too had this problem.

It came down to the fact that I had locally attached another DLL, that I was then referencing. This had already been deployed in a previous project.

When I excluded the DLL from the solution, the webpart deployed

检查失败的每个项目的manifest.xml文件-删除重复的程序集引用以解决此问题。

Could you try .NEt Reflector in the VSeWSS dll's and check the actual code that's beging executed by the CreateWebPartReferenceResolverClassMap method in the Microsoft.SharePoint.Tools.SharePointProxies.WSPViewFacade class? This might provide you with more indepth info on where to look in your own solution.

I finally ended up completely reconstituting the project, and all is well again. I would normally submit something like this to MS Connect, but there's no way they're going to fix this. VSeWSS as a VS2008 plugin is a completely dead product.

We'll just have to struggle along until we get VS2010, at which point I can start filing connect bugs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM