Damian's Blog .NET from Geneva, Switzerland

4Dec/084

Dealing with WCF Error: Cannot create a service reference with namespace X because the name is already in use by an existing service reference, folder or file

If you get the above error when trying to add a WCF service reference that you have previously deleted then try:

  • deleting the Service References.DeviceService.Reference.cs.dll file you'll find under obj\Debug\TempPE. 
  • deleting the service folder you'll still find under Service References on disk, even though you deleted the reference in Visual Studio.
  • commenting out all references to the service's namespace in your code
  • rebuilding
Filed under: WCF Leave a comment
Comments (4) Trackbacks (0)
  1. I had the same issue but I solved it in a different way:

    When adding the “Service Reference” click on the “Advanced…” button on the lower left side and by default the option “Reuse types in referenced assemblies” is selected, Deselect it, press “Ok” and that should do it ;)

    …Ok, I know almost a year later lol

  2. Thankyou, you helped me out. But in addition to your steps, I also removed my entire obj folder, also I removed my ‘Release’ folder from bin (leaving just the ‘Debug’).

  3. Hi
    The four steps above surely helped but the error still ocurred. I had to restart Visual Studio 2010 with the cleaned up project.

  4. Hi,

    The workaround mentioned above didn’t work for me. However, if I leave VS2010 and open my solution in Phone Studio Express (C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\VPDExpress.exe) a valid reference is made that can then be used back in VS2010.

    Cheers,

    Jon


Leave a comment

(required)

No trackbacks yet.