Skip to content

Multi-target net8.0 and net10.0 - #23

Open
henrikottesorensen wants to merge 1 commit into
mainfrom
feature/dotnet10-multitarget
Open

Multi-target net8.0 and net10.0#23
henrikottesorensen wants to merge 1 commit into
mainfrom
feature/dotnet10-multitarget

Conversation

@henrikottesorensen

Copy link
Copy Markdown
Collaborator

#6 has merged, so this now targets main directly and the diff is only this change.

LibLouis.NET and the test project build for both target frameworks.

Scope changed

This originally also moved the build container to sdk:10.0-noble. That has been dropped from this PR. The container compiles C and runs dotnet pack, and which SDK does the packing barely affects the output — these are netstandard2.0 metadata around an already-compiled binary, with IncludeBuildOutput off. The container's SDK now moves as part of the Dockerfile restructure that separates compiling from packing, where it belongs. This PR is purely the multi-targeting.

The change

The extensions packages are referenced per target framework — 8.0.2 for net8.0, 10.0.10 for net10.0 — so a net10 consumer does not drag an older set into its dependency graph. The package ends up with lib/net8.0/ and lib/net10.0/ and matching per-TFM dependency groups.

The runtime packages stay on netstandard2.0. They carry no managed code, and netstandard2.0 is the widest thing to be compatible with.

Microsoft.NET.Test.Sdk moves to 18.8.1, the first version supporting net10.0. setup-dotnet installs both SDKs.

A bug this change introduced, and its fix

Packing a multi-targeted project runs the cross-targeting outer build, which has no default None items. The existing <None Update="LICENSE"> therefore matched nothing there, and the licence silently never reached the package — NU5030, at pack time rather than build time. The inner builds do have the item, where a second Include would be a duplicate. Both forms are now present, conditioned on whether TargetFramework is set.

Worth knowing generally: Update on a multi-targeted project is a trap, because it behaves differently in the outer and inner builds.

Verified

Both target frameworks build and pass the tests, and the packed .nupkg carries both lib/ folders with the right dependency groups.

🤖 Generated with Claude Code


Recreated from #7 to move the head branch onto Notalib/LibLouis.NET, which GitHub stacked PRs require (stacks cannot span forks).

LibLouis.NET and the test project build for both.

The extensions packages are referenced per target framework, 8.0.2 for
net8.0 and 10.0.10 for net10.0, so a net10.0 consumer does not drag an
older set into its dependency graph. The runtime packages stay on
netstandard2.0: they carry no managed code, and netstandard2.0 is the
widest thing to be compatible with. Microsoft.NET.Test.Sdk moves to
18.8.1, the first version that supports net10.0.

Packing a multi-targeted project runs the cross-targeting outer build,
which has no default None items, so the existing <None Update="LICENSE">
matched nothing there and the licence silently never reached the package
(NU5030). The inner builds do have the item, where a second Include would
be a duplicate, so both forms are present and conditioned on whether
TargetFramework is set.

The container's own SDK version is deliberately not touched here. It
compiles C and runs dotnet pack, and which SDK does the packing barely
affects the output; moving it belongs with the Dockerfile restructure
that separates compiling from packing, not with the multi-targeting.

Verified: both target frameworks build and pass, and the package carries
lib/net8.0 and lib/net10.0 with matching per-TFM dependency groups.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

2 participants