Question

I have VisualStudio 2012 and I'm trying to follow the following tutorial http://msdn.microsoft.com/en-us/library/hh674270.aspx

But I couldn't find the option Schema Definition from the WCF pane of the Templates dialog.

Do I have to install something? What would that be? An extension, perhaps?

Thanks in advance.

Was it helpful?

Solution

You don't need to install it - it's already there. What might be catching you out is that it's only available in the "WCF Service Library" template.

VS 2012 correct WCF project

Once you then add a schema file as shown: Adding an XML schema

You then get an additional option on the project properties:

enter image description here

OTHER TIPS

I want to add my findings.

I too wanted the Contract-First tool and didn't find the setting mentioned in the msdn link.

However I found out how to add it to any project type as I wanted my iis-hosted services to use contract first aswell.

What you do is to create a "WCF Service Library" as mentioned above.

Then open the csproj-file for the project in a text editor.

Then copy paste the entries that looks something like this into the other project-file

  <FlavorProperties GUID="{3D9AD99F-2412-4246-B90B-4EAA41C64699}">
    <WcfProjectProperties>
      <AutoStart>True</AutoStart>
    </WcfProjectProperties>
  </FlavorProperties>

Also you need to change the guid:s in the target project to something like this:

<ProjectTypeGuids>{3D9AD99F-2412-4246-B90B-4EAA41C64699};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>

The FlavorProperties tag with its guids are from vs2012 update 3 so it may change in the future.

So with this hack you're able to deploy contract first services directly to the iis.

The question however is why it wasn't working like this out of the box in visual studio 2012

You don't need to add the XSD from the WCF pane, just take the XML Schema item from the Data pane.

If VS 2012 has the option "Enable XSD as type definition language" on, it will generate the types under the namespace of your solution + ".ContractTypes".

Check the output windows to see what the build process is doing with the XSDs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top