In working with Indigo (Jan CTP), if you try to generate metadata (WSDL, XSD) from an assembly, make sure it is a dll and not an exe, or you get a misleading error message like:
C:\Projects\Indigo>svcutil.exe "C:\Projects\Indigo\bin\Debug\MyIndigo.exe"
Microsoft (R) Service Model Metadata Tool
[Microsoftr .NET Framework, Version 2.0.50727.129]
c Microsoft Corporation. All rights reserved.
Error: There was an error exporting the ContractDescription loaded from the type: Foo.IBarService, MyIndigo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Duplicate contract QNames are not supported.
Another ContractDescription with the Name: IBarService and Namespace: http://services.foo.com/bar/v1 has already been exported.
This happened when I was writing a self-hosted service using a console application and for ease of initial development included the service, message and data contracts in the self-hosted service. I really wanted to get the WSDL out of the service so I could tweak it (that is a whole other post).
Long story short, I changed the project from a console application to a class library and reran svcutil.exe and all was well in Indigo-land again:
C:\Projects\Indigo>svcutil "C:\Projects\Indigo\bin\Debug\MyIndigo.dll"
Microsoft (R) Service Model Metadata Tool
[Microsoftr .NET Framework, Version 2.0.50727.129]
c Microsoft Corporation. All rights reserved.
Generating Metadata Files...
C:\Projects\Indigo\services.foo.com.bar.v1.wsdl
C:\Projects\Indigo\schemas.microsoft.com.2003.10.Serialization.xsd
C:\Projects\Indigo\services.foo.com.bar.v1.xsd
If this post saves even 1 person some debugging time, it was worth it! :)
I'm glad Indigo is (almost) here!
jk
No comments:
Post a Comment