Some Creativity

Weblog of Siddharth Uppal

“Add Service Reference” option not appearing in Visual Studio 2008

with 7 comments

Had to do a bit of head-scratching on this one. New projects created in Visual Studio 2008 did show the “Add Service Reference” when right-clicking on a project in Solution Explorer while some existing ones didn’t.

Using “Add Web Reference” instead of “Add Service Reference” has its own set of issues in that WCF services are meant to be used with DataContractSerializer. “Add Web Reference” utilizes XmlSerializer which might lead to some surprises when consuming WCF web-services. The way the two serializers handle WSDL is different. This article explains why you might find that property values of your complex types in web-services do not reach all the way to the web-service from the client.

Somebody logged a Microsoft Connect ticket on this but didn’t receive an answer because the issue couldn’t be reproduced.

Anyway, if you’re facing this issue – make sure that the target framework for your project is .NET 3.0 or later (you can do this in the Application tab of your project’s properties). You need to do this extra step if you upgrade your project to Visual Studio 2008 from older versions otherwise “Add Service Reference” wouldn’t appear. You can target .NET 2.0 from Visual Studio 2008 projects and that’s the default behavior during upgrade.

Update: This didn’t fix the issue for you? Check the comments for more alternatives.

Written by Sid

July 22, 2008 at 4:11 pm

Posted in .NET, Tech/Hacks

Tagged with ,

7 Responses to '“Add Service Reference” option not appearing in Visual Studio 2008'

Subscribe to comments with RSS or TrackBack to '“Add Service Reference” option not appearing in Visual Studio 2008'.

  1. I’ve run into some interesting issues regarding this as well, especially when doing WF or WCF projects. A lot of times it boils down to a missing line in the .csproj file, where it needs to have something like:

    {14822709-B5A1-4724-98CA-57A101D1B079};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}

    Those GUIDs are defined inside Visual Studio and turn on/off certain features of Visual Studio. I think those two deal with workflow projects, so try and generate a brand new WCF project with Visual Studio and then open up the .csproj file in Notepad to see which GUIDs it uses.

    If anyone runs across a list of GUIDs and what features they turn on/off, I’d like to see it. Right now it borders on an “undocumented feature” :)

    Matt

    24 Jul 08 at 8:22 am

  2. Your comment system ate my tags. It should read:

    <ProjectTypeGuids>{14822709-B5A1-4724-98CA-57A101D1B079};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

    :)

    Matt

    24 Jul 08 at 8:23 am

  3. In your webproject properties Application section set Target Framework to 3.5.
    Then you will see Add Service Reference.

    GeneV

    Gene

    8 Aug 08 at 9:16 am

  4. My project properties definitely are targeting framework 3.5, but Add Service Reference still does not appear on a particular project.

    I’ll try working with the thing… maybe that will fix it.

  5. Comment system ate my tags too!
    What I said was “I’ll try working with the ProjectTypeGuids thing”

  6. Hey thanks for that. THAT WORKED.

    Switching the project Guids I had for the ones you listed above fixed it. I now have the “Add Service Reference” context menu item. The second ProjectTypeGuid I had was already the same but the first was different. Trying running the project and it doesn’t seem to have adversely effected anything else.

    Like I say, I already had the project properties set to Target framework 3.5 so that by itself wasn’t enough. But manually editing the ProjectTypeGuids as Matt specified fixed it.

    CHEERS!

  7. Thanks Matt for mentioning the ProjectTypeGuid workaround. And thanks Andrew for confirming that it works.

    Sid

    7 Nov 08 at 11:08 am

Leave a Reply