Skip to content

[dotnet-svcutil] Implement command switch for separating type files#5896

Open
mr-sven wants to merge 7 commits intodotnet:mainfrom
mr-sven:separateTypeFiles
Open

[dotnet-svcutil] Implement command switch for separating type files#5896
mr-sven wants to merge 7 commits intodotnet:mainfrom
mr-sven:separateTypeFiles

Conversation

@mr-sven
Copy link
Copy Markdown

@mr-sven mr-sven commented Feb 4, 2026

Implemented command line switch (-separateFiles|-sf) to implement requested feature #3512
Tested using current Cisco AXL 15 successfully: dotnet-svcutil.exe *.wsdl *.xsd -n "*,Cisco.UCM.AXL15" -sf.
Created around 5623 separate files.

@mr-sven
Copy link
Copy Markdown
Author

mr-sven commented Feb 4, 2026

@dotnet-policy-service agree

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new --separateFiles / -sf command-line switch to dotnet-svcutil to emit generated proxy types into separate files, addressing large single-file generation scenarios (e.g., very large WSDLs that degrade IDE performance).

Changes:

  • Introduces a new command switch (separateFiles / sf) and exposes it through options/serialization.
  • Updates help text and resource strings to document the new switch.
  • Implements per-type file emission during CodeDOM serialization when the switch is enabled.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 19 comments.

Show a summary per file
File Description
src/dotnet-svcutil/lib/src/Tool.cs Implements the per-type file generation path when SeparateFiles is enabled.
src/dotnet-svcutil/lib/src/CommandProcessorOptions.cs Adds the SeparateFiles command switch (-sf).
src/dotnet-svcutil/lib/src/HelpGenerator.cs Adds help entry for --separateFiles.
src/dotnet-svcutil/lib/src/Shared/Options/UpdateOptions.cs Adds SeparateFiles option key/property and serialization support.
src/dotnet-svcutil/lib/src/SR.resx Adds the English help resource string for the new switch.
src/dotnet-svcutil/lib/src/xlf/SR.zh-Hant.xlf Adds localized resource entry for help text (currently untranslated).
src/dotnet-svcutil/lib/src/xlf/SR.zh-Hans.xlf Adds localized resource entry for help text (currently untranslated).
src/dotnet-svcutil/lib/src/xlf/SR.tr.xlf Adds localized resource entry for help text (currently untranslated).
src/dotnet-svcutil/lib/src/xlf/SR.ru.xlf Adds localized resource entry for help text (currently untranslated).
src/dotnet-svcutil/lib/src/xlf/SR.pt-BR.xlf Adds localized resource entry for help text (currently untranslated).
src/dotnet-svcutil/lib/src/xlf/SR.pl.xlf Adds localized resource entry for help text (currently untranslated).
src/dotnet-svcutil/lib/src/xlf/SR.ko.xlf Adds localized resource entry for help text (currently untranslated).
src/dotnet-svcutil/lib/src/xlf/SR.ja.xlf Adds localized resource entry for help text (currently untranslated).
src/dotnet-svcutil/lib/src/xlf/SR.it.xlf Adds localized resource entry for help text (currently untranslated).
src/dotnet-svcutil/lib/src/xlf/SR.fr.xlf Adds localized resource entry for help text (currently untranslated).
src/dotnet-svcutil/lib/src/xlf/SR.es.xlf Adds localized resource entry for help text (currently untranslated).
src/dotnet-svcutil/lib/src/xlf/SR.de.xlf Adds localized resource entry for help text (currently untranslated).
src/dotnet-svcutil/lib/src/xlf/SR.cs.xlf Adds localized resource entry for help text (currently untranslated).

Comment thread src/dotnet-svcutil/lib/src/Tool.cs Outdated
Comment thread src/dotnet-svcutil/lib/src/Tool.cs Outdated
Comment on lines +248 to +264
if (options.SeparateFiles == true)
{
foreach (CodeNamespace @namespace in importModule.CodeCompileUnit.Namespaces)
{
foreach (CodeTypeDeclaration type in @namespace.Types)
{
options.OutputFile = new FileInfo(Path.Combine(options.OutputDir.FullName, $"{type.Name}{CodeSerializer.GetOutputFileExtension(options)}"));
CodeSerializer codeSerializer = new CodeSerializer(options, serviceDescriptor.MetadataDocuments);
CodeCompileUnit compileUnit = new CodeCompileUnit();
CodeNamespace splitNamespace = new CodeNamespace(@namespace.Name);
compileUnit.Namespaces.Add(splitNamespace);
splitNamespace.Types.Add(type);
var filePath = codeSerializer.Save(compileUnit);
ToolConsole.WriteLine(filePath, LogTag.Important);
}
}
}
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When SeparateFiles is enabled, the tool writes many .cs files but does not appear to clean up previously generated type files in the output directory. This can leave stale types behind on reruns/updates and cause compilation conflicts. Consider deleting previously generated type files (or generating into a dedicated subfolder and managing it) before writing the new set.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mconnew I'm not sure about this, cleaning up the output directory is nothing I would recommend. That should be a user task.

Comment thread src/dotnet-svcutil/lib/src/Tool.cs Outdated
Comment on lines +248 to +264
if (options.SeparateFiles == true)
{
foreach (CodeNamespace @namespace in importModule.CodeCompileUnit.Namespaces)
{
foreach (CodeTypeDeclaration type in @namespace.Types)
{
options.OutputFile = new FileInfo(Path.Combine(options.OutputDir.FullName, $"{type.Name}{CodeSerializer.GetOutputFileExtension(options)}"));
CodeSerializer codeSerializer = new CodeSerializer(options, serviceDescriptor.MetadataDocuments);
CodeCompileUnit compileUnit = new CodeCompileUnit();
CodeNamespace splitNamespace = new CodeNamespace(@namespace.Name);
compileUnit.Namespaces.Add(splitNamespace);
splitNamespace.Types.Add(type);
var filePath = codeSerializer.Save(compileUnit);
ToolConsole.WriteLine(filePath, LogTag.Important);
}
}
}
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New separate-files behavior is introduced here, but there’s no accompanying test coverage verifying (1) multiple files are produced, (2) names are deterministic/collision-safe, and (3) update/rerun behavior doesn’t leave stale files. Since this repo has an existing baseline/E2E test harness, it would be good to add a targeted test case for --separateFiles/-sf.

Copilot uses AI. Check for mistakes.
Comment thread src/dotnet-svcutil/lib/src/xlf/SR.fr.xlf
Comment thread src/dotnet-svcutil/lib/src/xlf/SR.es.xlf
Comment thread src/dotnet-svcutil/lib/src/xlf/SR.de.xlf
Comment thread src/dotnet-svcutil/lib/src/xlf/SR.cs.xlf
Comment thread src/dotnet-svcutil/lib/src/Tool.cs Outdated
@mconnew
Copy link
Copy Markdown
Member

mconnew commented Apr 10, 2026

@mr-sven, copilot has raised some genuine gaps in the implementation. If you have any questions about any of its feedback, feel free to mention me with your question and I'll do my best to answer them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants