Share via

getting build issues after adding existed WCF service to the dotnet core project

Gopisetty, Saraswathi 0 Reputation points
2026-04-16T05:04:53.7066667+00:00

I have added the WCF service reference to my dotnet core project and included dependency packages servicemodel.premitive, http ,security . But i am getting lot of build error like <clientbase>.

Developer technologies | C#
Developer technologies | C#

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Varsha Dundigalla(INFOSYS LIMITED) 4,865 Reputation points Microsoft External Staff
    2026-04-16T10:53:50.37+00:00

    Thank you for reaching out.

    The build errors occur because the WCF service reference was added in a way that is not compatible with .NET Core / modern .NET.

    In .NET Core and later versions, manually adding NuGet packages such as System.ServiceModel.Primitives, System.ServiceModel.Http, or System.ServiceModel.Security is not sufficient by itself. The WCF client proxy code (which uses types like ClientBase<T>) must be generated specifically for .NET Core. If proxy code generated for .NET Framework is reused, or if the code is added manually, it leads to multiple build errors including ClientBase<T>-related issues.

    This typically happens when:

    • A WCF service reference generated for .NET Framework is reused in a .NET Core / .NET 5+ project, or
    • The service proxy code is copied or added manually instead of being generated using the supported tooling.

    For .NET Core and later, the supported approach is to generate the WCF client proxy using Connected Services → Microsoft WCF Web Service Reference Provider in Visual Studio, or by using the dotnet-svcutil tool. These tools generate compatible proxy code and automatically add the correct WCF client dependencies, which avoids these build errors.

    The issue is with how the WCF client proxy was added, not with the WCF service itself.

    References

    Please let us know if you require any further assistance, we’re happy to help. If you found this information useful, kindly mark this as "Accept Answer". So that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    0 comments No comments

  2. Q&A Assist
    2026-04-16T05:05:04.41+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    ClientBase<T> and other WCF client types are not defined by the System.ServiceModel.Primitives, Http, or Security packages alone. They are generated and referenced as part of a WCF client proxy, and the recommended way to add them to a .NET Core / .NET 5+ project is to use the WCF tooling rather than manually adding a legacy reference.

    To resolve build errors after adding an existing WCF service to a .NET Core project:

    1. Remove any old .NET Framework-style “Add Service Reference” artifacts that may have been copied from another project (such as a .svcmap folder or generated reference code that targets full .NET Framework APIs).
    2. In Visual Studio (for .NET Core / .NET 5+):
      • Right-click the project → Connected Services.
      • Use Microsoft WCF Web Service Reference Provider to add the WCF service. This tool reads the WSDL/metadata and generates a compatible proxy class that derives from ClientBase<T> and references the correct System.ServiceModel.* packages for .NET Core.
    3. If using the command line instead of Visual Studio, use the dotnet-svcutil tool to generate or update the proxy:
      • Initial generation (from a WSDL or service URL):
             dotnet-svcutil http://your-service/wsdl
        
      • If a service reference already exists and needs to be refreshed, use the update option:
             dotnet-svcutil -u ./path/to/reference/folder
        
        The folder must contain the ConnectedService.json created when the reference was first added.
    4. Ensure the generated proxy file is included in the project and compiles without modification. The generated code will bring in the correct ClientBase<T> usage and required namespaces.
    5. Keep the WCF-related packages aligned with what the tooling expects (do not mix older System.ServiceModel assemblies from .NET Framework with the newer System.ServiceModel.* packages for .NET Core).

    Using the supported WCF Web Service Reference tooling or dotnet-svcutil ensures that ClientBase<T> and related types are generated correctly and that the right dependencies are added, which should eliminate the build errors.


    References:

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.