Skip to content

v3.5.0 - LinqToXsd CLI changes, fixes several issues, nuget updates - #104

Merged
mamift merged 122 commits into
masterfrom
testing/dublincore-xhtml
Oct 20, 2026
Merged

mamift merged 122 commits into
masterfrom
testing/dublincore-xhtml

Conversation

@mamift

@mamift mamift commented Sep 16, 2026 •

Copy link
Copy Markdown
Owner
  • the -a flag will now delete existing files with the .xsd.cs extension (since v3.4.17, the default output extension is now .xsd-g.cs) when outputting code
    • fixed a bug with getting the actual XML Schema version, the xs:schema\@version attribute is a user defined attribute for the schema version, it does not specify which W3C XSD specification version to validate against (i.e. v1.0 or v1.1). This has inadvertently caused linqtoxsd to skip schemas that had xs:schema\@version values that were v1.1 or higher.
    • the behaviour of the -a argument when invoking the linqtoxsd gen CLI tool is now always applied i.e. it now always searches for a .xsd.config file regardless. However, in previous versions, if a config file was not found, linqtoxsd gen would skip that XSD file - now linqtoxsd gen will simply apply default config values for those XSD files and proceed to generate code. This fixes LinqToXsd global tool bug when -a encounters an XSD with no config #8.
  • added a new CLI verb sum that will emit a markdown file that summarises the generated code.
  • codegen: global:: is now prefixed to the generated method GetRootType() when global:: is used in other places for namespaces with Xml in them.
  • Fix duplicated shared-schema types across multiple XSDs (fixes Double includes are not ignored. #14) - when several entry-point schemas xs:import/xs:include the same shared schemas, the shared schemas' types were regenerated into every importing file, producing duplicate (and for non-partial types, uncompilable) C#.
  • Removed all uses of Assert.Warn with Assert.Fail - fixed and updated some silently ignored tests as a result.
  • Nuget dependency updates:
    • Portable.System.DateTimeOnly consolidated to v9.0.2.
    • Microsoft.CodeAnalysis.CSharp and Microsoft.CodeAnalysis.CSharp.Workspaces. to 5.9.0.
    • A bunch of test-only dependencies updated

v3.5.0

…ut its presence does not throw an error to enable backward compatibility with existing scripts.
… (since 3.4.17, the default output extension is now .xsd-g.cs).
@mamift mamift changed the title Testing/dublincore xhtml LinqToXsd CLI changes (v3.4.24) Sep 22, 2026
@mamift mamift changed the title LinqToXsd CLI changes (v3.4.24) v3.4.24 - LinqToXsd CLI changes, fixes another codegen bug with xs:choice Sep 22, 2026
@mamift mamift changed the title v3.4.24 - LinqToXsd CLI changes, fixes another codegen bug with xs:choice v3.4.24 - LinqToXsd CLI changes, fixes a bug with xs:choice Sep 22, 2026
@mamift
mamift force-pushed the testing/dublincore-xhtml branch from 1bd25c2 to 5d8961c Compare September 22, 2026 03:31
@mamift
mamift marked this pull request as ready for review October 19, 2026 02:34
Copilot AI balanced review requested due to automatic review settings October 19, 2026 02:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

It spans core code-generation changes, a partial version-detection fix that may still drop user schemas with version="1.1", and broad framework/dependency upgrades that need human validation.

3 open issues
What changed in this PR

This PR cuts the v3.5.0 release of the LinqToXsdCore CLI, bundling several bug fixes, a new sum verb, and a large dependency/target-framework bump (net8.0 → net10.0, NUnit 5, MSTest 4.5.1, etc.). The most substantive logic changes fix duplicated shared-schema type generation across multiple XSDs (issue #14), correct XSD version detection so user-defined xs:schema@version values no longer cause schemas to be skipped, make the -a flag resilient when no .xsd.config exists (issue #8), and prefix global:: more consistently in generated using directives. Tests were hardened (replacing silently-passing Assert.Warn with Assert.Fail) and made cross-platform.

Changes:

  • Code-generation fixes: merge-then-split shared schemas to avoid duplicate types, corrected GetXmlSchemaVersion, global::-qualified using directives, legacy .xsd.cs cleanup under -a.
  • New sum CLI verb plus a CodeSummariser, and default-config fallback for gen.
  • Wide NuGet/target-framework upgrades and cross-platform test corrections.
File Description
XObjectsCore/​Extensions/​GeneralExtensionMethods.cs Rewrites XSD version detection; introduces namespace/version constants (flagged: mutable statics + version="1.1" fallback).
XObjectsCode/​Src/​XObjectsCoreGenerator.cs Implements issue #14 merge/split generation and v1.1 exclusion (flagged: misleading "Schemas to process" log).
XObjectsCode/​Src/​EnumFacet.cs /​ CompiledFacets.cs Defers enum facet creation so member names are uniquified across the whole enumeration.
XObjectsTests/​XObjectsTests.csproj Bumps target frameworks and test/package dependencies.
XObjectsTests/​TestExtensionsMethods.cs Adds diagnostics helper and normalises mock-FS path separators for Unix.
XObjectsTests/​GraphTests.cs Adds graph build/entry-point tests over generated schema libraries.
XObjectsTests/​GlobalPrefixUsingDirectivesTests.cs New tests for global:: using-directive qualification.
XObjectsTests/​FileSystemUtilitiesTests.cs Makes SCC entry-point assertions OS-order-independent; adjusts test-case source signature.
XObjectsTests/​NestedChoiceCodeGenTests.cs Uses explicit types, Single, and the new diagnostics helper.
XObjectsTests/​Extensions/​XmlSchemaExtensionsTests.cs Removes leading backslashes from test paths; replaces Assert.Warn with Assert.Fail.

Review effort: Balanced

Comment thread XObjectsCore/Extensions/GeneralExtensionMethods.cs Outdated
Comment thread XObjectsCore/Extensions/GeneralExtensionMethods.cs Outdated
Comment thread XObjectsCode/Src/XObjectsCoreGenerator.cs Outdated
mamift and others added 21 commits October 19, 2026 12:55
… it was a draft version of AkomaNtoso. Redundant!
…eserve this for another release.

This reverts commit fb92c2c.
`dotnet build/test -f <tfm>` passes TargetFramework as a global property,
which NuGet restore otherwise treats as "restore only this TFM" for every
project in the graph. Multi-targeted projects (XObjectsCore,
XObjectsCodeGen) were therefore restored for net10.0 only, while LinqToXsd
and LinqToXsd.Schemas still build them as netstandard2.0 via
SetTargetFramework, producing NETSDK1005.

- Disable NuGet's restore TFM override so all TargetFrameworks are restored.
- Use the plural TargetFrameworks property for the netstandard2.0-only
  projects (LinqToXsd.Schemas and the generated schema libraries) so they
  are restored for their declared TFM rather than the global one. The
  generated libraries shadow the root Directory.Build.props, so repeat the
  switch there.
- Fix CS8604 in FileSystemUtilities.PreLoadXmlSchemas by deriving the
  directory from the FileInfo instead of passing a possibly-null path to
  DirectoryInfo.

Verified with:
  dotnet test ./XObjectsTests/XObjectsTests.csproj -c release -f net10.0
    -restore:true --logger trx
  (385 passed, 9 skipped, 0 failed)

Co-Authored-By: Claude Code <noreply@anthropic.com>
copilot suggested fix.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
… the attribute that users/schema authors use to version their schema instance, it is not the XSD spec version.
…s - @Version="1.1" is technically spec-compliant, but for LinqToXsd purposes, we only recognise vc:minVersion or vc:maxVersion.
@mamift
mamift merged commit 0445a46 into master Oct 20, 2026
5 checks passed
@mamift
mamift deleted the testing/dublincore-xhtml branch October 20, 2026 09:50
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.

Double includes are not ignored. LinqToXsd global tool bug when -a encounters an XSD with no config

2 participants