SmartWsdlKit.SourceGenerators
1.0.3
Prefix Reserved
dotnet add package SmartWsdlKit.SourceGenerators --version 1.0.3
NuGet\Install-Package SmartWsdlKit.SourceGenerators -Version 1.0.3
<PackageReference Include="SmartWsdlKit.SourceGenerators" Version="1.0.3" />
<PackageVersion Include="SmartWsdlKit.SourceGenerators" Version="1.0.3" />
<PackageReference Include="SmartWsdlKit.SourceGenerators" />
paket add SmartWsdlKit.SourceGenerators --version 1.0.3
#r "nuget: SmartWsdlKit.SourceGenerators, 1.0.3"
#:package SmartWsdlKit.SourceGenerators@1.0.3
#addin nuget:?package=SmartWsdlKit.SourceGenerators&version=1.0.3
#tool nuget:?package=SmartWsdlKit.SourceGenerators&version=1.0.3
SmartWsdlKit.SourceGenerators
SmartWsdlKit.SourceGenerators is a high-performance Roslyn Incremental Source Generator package for the 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 legacy Visual Studio Connected Services, svcutil command line tools, and dynamic runtime reflection overhead completely.
Key Benefits
- Zero Runtime Reflection: All XML serialization and method mapping logic is generated during compilation for maximum throughput.
- Instant IDE IntelliSense: Generated proxies are available immediately in your IDE as soon as you save your
.wsdlfile. - Compile-Time Safety & Diagnostics: If the service contract changes or the WSDL is malformed, compiler warnings (
SWK001) are reported directly in your build output or IDE error list. - Modern C# Code Output: Generates immutable C# 9.0
recordtypes for DTOs and clean async interfaces.
Installation
Add both the core runtime package (SmartWsdlKit) and the source generator package (SmartWsdlKit.SourceGenerators) to your project:
dotnet add package SmartWsdlKit
dotnet add package SmartWsdlKit.SourceGenerators
Setup & Configuration
1. Add your WSDL File
Place your WSDL file (e.g., Calculator.wsdl or CountryInfo.wsdl.xml) in your project directory (e.g., under a Wsdl/ folder).
2. Register WSDL as AdditionalFiles in .csproj
Edit your .csproj file and add the WSDL file inside an <ItemGroup> using the <AdditionalFiles> build action:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SmartWsdlKit" Version="1.0.3" />
<PackageReference Include="SmartWsdlKit.SourceGenerators" Version="1.0.3" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<AdditionalFiles Include="Wsdl/Calculator.wsdl" />
</ItemGroup>
</Project>
3. Build Project
When you build your project (dotnet build), Roslyn will execute the generator and output generated proxy classes under the SmartWsdlKit.Generated namespace.
Consumption Example
using System;
using System.Threading.Tasks;
using SmartWsdlKit;
using SmartWsdlKit.Generated; // Generated namespace containing DTO records & clients
class Program
{
static async Task Main()
{
var options = new SoapClientOptions
{
BaseAddress = new Uri("http://www.dneonline.com/calculator.asmx"),
Timeout = TimeSpan.FromSeconds(10),
EnableDiagnostics = true
};
// Instantiating the generated client proxy
using var client = new CalculatorSoapClient(options);
// Invoking the strongly-typed generated operation
var response = await client.AddAsync(new AddRequest
{
intA = 100,
intB = 250
});
Console.WriteLine($"Calculated Result: {response.AddResult}"); // Outputs: 350
}
}
Diagnostic Rules
The generator analyzes WSDL structures during compilation and reports validation issues directly to the compiler output:
| Diagnostic ID | Severity | Title | Description |
|---|---|---|---|
| SWK001 | Warning | WSDL Parsing Failed | Reported when a registered WSDL file is malformed, cannot be read, or imports cannot be resolved. |
License
This project is licensed under the MIT License.
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.