VSeWSS "An item with the same key has already been added"

1.9k views Asked by At

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.Dictionary2.Insert(TKey key, TValue value, Boolean add) at System.Collections.Generic.Dictionary2.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?

5

There are 5 answers

0
Ben Collins On BEST ANSWER

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.

0
Colin On

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.

1
Shiraz Bhaiji On

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
0
AudioBubble On

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

0
Warren Barton On

Check your manifest.xml file for each project that's failing - remove duplicate assembly references to resolve this issue.