Dienstag, 27. Januar 2009

WCF: custom tool error when adding a service reference in Visual Studio 2008

When adding a service reference in Visual Studio 2008, I came across a weird error. The reference was created successfully, but when I tried to build the project (a c# class library project), I always get a custom tool error ("the global element ... was defined in both ... and ..."). Thus I could not compile. Everything I tried didn't work. After reloading Visual Studio I got another error (Class ... is already defined in another namespace).

I finally solved this problem by deleting the Visual Studio project, creating a new project and adding the same service reference a second time.

I don't really know, what caused this error, but maybe it has something to do with changing the namespace or the service reference name after the first creation.

1 Kommentar:

Olaf hat gesagt…

I regularly get a similar error when I try to update a service reference - Visual Studio complains about not defined classes even if the xml-file of the service delivers all definitions. The only solution is to delete the service reference, quit visual studio and then delete the .suo-file of this project. Then I can re-add the wcf-reference without troubles. But after that my DAL won't compile to unknown reasons. This can be solved by hard-cleaning the binaries and restart visual studio... hope VS 2010 will solve this problem.

Reach me via Live Messenger