Last friday, I was updating my WCF Service Reference on a Silverlight Project in Visual Studio 2008 and I came across following error / warning:
Custom tool warning: An item with the same key has already been added.

Custom tool warning: An item with the same key has already been added
Okay, it’s a warning, so what’s the point? Well it results in an incomplete generation of your WCF Code. So if you’re trying to build Visual Studio will say: Are you missing a using directive or an assembly reference? In fact we do…
After a lot of research, I didn’t find any good solution to get rid of the problem, but after a while I was getting the point. If you are returning an type that has not been build by the Silverlight Framework, you’ll get this error.
This code proves it:
A DataSet is not known by the Silverlight Framework, so if we include it as a return type in our service, it will fail to add the service correctly.
service.svc.cs
public DataSet GetTrackingTableDS(String TableName)
{
return new DataSet();
}
service Interface:
[OperationContract]
DataSet GetTrackingTableDS(String TableName);
Most posts I found about this error state that it went away after deletion of a method in the WCF Service. Well it’s correct but this should clarify some things for you!
Solution, just add another WCF Service in your project only for the methods that Silverlight recognize and call it from your silverlight project.
UPDATE
As you can have this error in serveral occasions, sometimes it helps to turn off “Reuse Types in referenced assemblies”
