none
svcutil.exe generating 2 partial classes RRS feed

  • Question

  • I'm writing a .NET 4.0 app and have control over both the WCF service and client.
    I'm using svcutil to generate proxy classes for my services, combining several services.
    svcutil /o:.\ServiceProxies\NavigatorServiceWCFProxy.cs /ct:System.Collections.Generic.List`1 /namespace:*,FIS.Navigator.Common.NavigatorService /noconfig http://localhost/NavigatorService/NavigatorService.svc?wsdl
    It generated two class look like:
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute(System.Runtime.Serialization, 4.0.0.0)]
    [System.Runtime.Serialization.DataContractAttribute(Name=RequestBase, Namespace=http://schemas.datacontract.org/Navigator/Base)]
    public partial class RequestBase : object, System.Runtime.Serialization.IExtensibleDataObject
    {

    }
    [System.CodeDom.Compiler.GeneratedCodeAttribute(svcutil, 4.0.30319.1)]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute(code)]
    [System.Xml.Serialization.XmlTypeAttribute(Namespace=http://schemas.datacontract.org/Navigator/Base)]
    public partial class RequestBase
    {
    }
    If we add a service reference only one partial class is generated in reference.cs Why it is creating two Classes?
    how can i generate only one partial class same as reference.cs using svcutil ?

    trinadh velchuri

    Monday, August 31, 2015 3:15 PM

Answers

  • Hi Triandh Velchuri,

    According to this case, I test it and generate one partial class. So, I suggest may be you can try

    add SvcUtil.exe tool in visual studio. Then you can generate proxy class and config file by it.

    Best Regards,

    Grady

    Tuesday, September 1, 2015 6:58 AM
    Moderator

All replies

  • If we add a service reference only one partial class is generated in reference.cs Why it is creating two Classes?
    how can i generate only one partial class same as reference.cs using svcutil ?

    You do know what a  partial class means, right? It means that the compiler is combining two or more partial class files with the same class name together to be one class.

    Clearly functionality is being extended for the class beyond its original intent.  Why? I don't know.

    Monday, August 31, 2015 4:09 PM
  • Hi Triandh Velchuri,

    According to this case, I test it and generate one partial class. So, I suggest may be you can try

    add SvcUtil.exe tool in visual studio. Then you can generate proxy class and config file by it.

    Best Regards,

    Grady

    Tuesday, September 1, 2015 6:58 AM
    Moderator