Repository navigation
v3.5.0 - LinqToXsd CLI changes, fixes several issues, nuget updates - #104
Conversation
1bd25c2 to
5d8961c
Compare
…irMembers() method - up by 4, doesn't seem too regressive.
There was a problem hiding this comment.
🔵 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.cscleanup under-a. - New
sumCLI verb plus aCodeSummariser, and default-config fallback forgen. - 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
… it was a draft version of AkomaNtoso. Redundant!
…0.0 and this throws NU1510.
…Use the new keyword if hiding was intended.
…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>
…XSD's were being processed.
… 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.


-aflag will now delete existing files with the.xsd.csextension (since v3.4.17, the default output extension is now.xsd-g.cs) when outputting codexs:schema\@versionattribute 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 causedlinqtoxsdto skip schemas that hadxs:schema\@versionvalues that were v1.1 or higher.-aargument when invoking thelinqtoxsd genCLI tool is now always applied i.e. it now always searches for a.xsd.configfile regardless. However, in previous versions, if a config file was not found,linqtoxsd genwould skip that XSD file - nowlinqtoxsd genwill 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.sumthat will emit a markdown file that summarises the generated code.global::is now prefixed to the generated methodGetRootType()when global:: is used in other places for namespaces with Xml in them.Assert.WarnwithAssert.Fail- fixed and updated some silently ignored tests as a result.Portable.System.DateTimeOnlyconsolidated tov9.0.2.Microsoft.CodeAnalysis.CSharpandMicrosoft.CodeAnalysis.CSharp.Workspaces.to5.9.0.v3.5.0