views:

465

answers:

5

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?

A: 

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.

Colin
+1  A: 

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
Shiraz Bhaiji
This didn't work for me. I tried your suggestion - deleting the solution folder, cleaning the solution, retracting, etc. Then I closed VS. I even checked out the solution from SVN again in a different directory, and still got the same result.
Ben Collins
A: 

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.

Ben Collins
+1  A: 

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

kepath
+1  A: 

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

Warren Barton