SmartWsdlKit.SourceGenerators 1.0.2

Prefix Reserved
dotnet add package SmartWsdlKit.SourceGenerators --version 1.0.2
                    
NuGet\Install-Package SmartWsdlKit.SourceGenerators -Version 1.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SmartWsdlKit.SourceGenerators" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SmartWsdlKit.SourceGenerators" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="SmartWsdlKit.SourceGenerators" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SmartWsdlKit.SourceGenerators --version 1.0.2
                    
#r "nuget: SmartWsdlKit.SourceGenerators, 1.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SmartWsdlKit.SourceGenerators@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SmartWsdlKit.SourceGenerators&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=SmartWsdlKit.SourceGenerators&version=1.0.2
                    
Install as a Cake Tool

SmartWsdlKit.SourceGenerators

NuGet Version License

SmartWsdlKit.SourceGenerators is a companion Roslyn Incremental Source Generator package for the core SmartWsdlKit SDK.

It automatically parses local WSDL files at compile-time and generates strongly-typed, modern C# SOAP client proxies, service interfaces, and DTO record models. This eliminates the need for legacy Visual Studio Connected Services, svcutil command line tools, and dynamic reflection overhead entirely.

Why Use Source Generators?

  1. Zero Runtime Reflection: All XML serialization and method mapping code is generated during compilation, providing maximum execution speed.
  2. Instant IntelliSense: Generated proxies are available immediately in your IDE as soon as you save your WSDL file.
  3. Compile-Time Safety: If the service contract changes or the WSDL is malformed, compiler warnings/errors are reported directly in your build output or error list.
  4. Modern C# Code: Generates immutable C# 9.0 Records for DTOs and clean asynchronous interfaces.

Installation

Add both the core runtime package and the source generator package to your C# project:

dotnet add package SmartWsdlKit
dotnet add package SmartWsdlKit.SourceGenerators

How to Configure

1. Add your WSDL File

Add your WSDL file (e.g. Calculator.wsdl) to your project structure (for example, in a Services/ directory).

2. Register WSDL as AdditionalFiles

Open your project's .csproj file and register the WSDL file inside an <ItemGroup> using the <AdditionalFiles> build action:

<ItemGroup>
  
  <AdditionalFiles Include="Services/Calculator.wsdl" />
</ItemGroup>

3. Build & Run

When you build your project, the Incremental Source Generator will automatically run and output strongly typed classes under the SmartWsdlKit.Generated namespace.


Consumption Example

Assuming your Calculator.wsdl defines a Calculator service with an Add operation, you can consume the generated client directly:

using System;
using System.Threading.Tasks;
using SmartWsdlKit;
using SmartWsdlKit.Generated; // Generated namespace

class Program
{
    static async Task Main()
    {
        var options = new SoapClientOptions
        {
            BaseAddress = new Uri("http://www.dneonline.com/calculator.asmx"),
            Timeout = TimeSpan.FromSeconds(10)
        };

        // Instantiating the generated client proxy
        using var client = new CalculatorSoapClient(options);

        // Calling the generated asynchronous method
        var response = await client.AddAsync(new AddRequest
        {
            intA = 15,
            intB = 25
        });

        Console.WriteLine($"Result: {response.AddResult}"); // Outputs: 40
    }
}

Configuration Customizations

By default, the source generator:

  • Places generated code in the SmartWsdlKit.Generated namespace.
  • Emits DTOs as C# 9.0 record types.
  • Enables C# Nullable Reference Types (#nullable enable).

Diagnostic Rules

The generator analyzes the WSDL structure during compilation and reports validation issues directly to the compiler output:

Diagnostic ID Severity Title Description
SWK001 Warning WSDL Parsing Failed Reported when the WSDL file is malformed, cannot be parsed, or imports cannot be resolved recursively.

License

This project is licensed under the MIT License.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 100 6/26/2026
1.0.1 101 6/26/2026
1.0.0 100 6/25/2026