Direct answer
A multi-targeted .NET project builds against several target frameworks, and each framework resolves its own dependency graph. A package version that supports one target may not support another, so the review unit is a framework-by-package matrix rather than a single version list. Before changing a dependency, record which frameworks the project targets, which packages carry conditions, and which versions each condition selects. The concrete win is a build where every framework-specific exception is visible beside the shared source. The concrete loss is that a green compile on one framework proves nothing about the others, and a version that restores on every target still may not be supported on all of them. The practical implication is that framework compatibility is evidence you collect per target, not an assumption you flatten into one version. Ask Claude Code to build the matrix from TargetFrameworks and the conditional PackageReference and PackageVersion items before proposing any simplification.
Why flattening conditions costs a release cycle
A multi-targeted project carries more than one contract. A library that ships for .NET 8 and .NET Standard 2.0 has two consumers with different expectations, and a package that exists on both may have different versions with different APIs on each. The instinct to simplify the project file by removing a condition is the mistake this post exists to prevent.
The failure is quiet. The condition is removed, the project restores, and one target compiles against a version whose API differs from what the shared source expects. The defect appears on the framework nobody built locally, which is usually the older one, and usually in CI or in a consumer’s hands.
Evidence and its limits
Official, F033: NuGet’s Central Package Management documentation shows conditional PackageVersion entries that select different versions for different TargetFramework values. The example illustrates a supported pattern and does not establish compatibility for any specific package.
Official: PackageReference in project files documents the reference item form and its condition support.
Official: .NET Standard target frameworks documents the target framework monikers and their meaning.
Official: Multi-targeting for NuGet packages documents building a package that targets several frameworks.
Official, agent loop: Claude Code best practices recommends pairing an edit with a pass-or-fail check. For multi-targeting that check is a restore and build per target framework.
Derived, F034: The framework-by-package matrix and the shared-source compatibility map below are an editorial review artifact. The PackageReference page was not full-page fetched in the research pass, so recheck exact attribute names before drafting.
No claim here depends on a specific SDK version, a package support timeline, or a benchmark.
Read TargetFrameworks
The plural property lists every framework the project builds for. Each is a separate compilation and a separate dependency resolution.
<PropertyGroup>
<TargetFrameworks>net8.0;netstandard2.0</TargetFrameworks>
</PropertyGroup>Look at the list as the axes of the matrix. Two frameworks means two columns of evidence for every package question. A project that targets three frameworks has three, and the review cost grows with the count, not with the number of packages.
The target framework monikers page documents what each value means. Read it before interpreting a condition, because a moniker’s compatibility surface is what the condition is selecting against.
Understand per-framework dependency graphs
Each target framework resolves its own graph. The same PackageReference can resolve to different versions, or to nothing, depending on the framework and the package’s supported frameworks.
| Concern | Single target | Multi-target | Review question |
|---|---|---|---|
| Dependency graphs resolved | One | One per framework | Which graph did you check? |
| Package version | One | Possibly one per framework | Does this version support every target? |
| Compile success | One evidence point | One per framework | Did every target build? |
| Runtime compatibility | One runtime | One per supported runtime | Was each runtime exercised? |
Take the table as a scope statement. A single build proves one column. Multi-targeting is not satisfied by one green build.
Inventory conditional PackageReference items
The project file is the first source of conditions. A PackageReference with a Condition attribute applies only when the condition matches, and TargetFramework is the common axis.
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="System.Text.Json" />
</ItemGroup>Inventory every conditional reference with the condition and the frameworks it applies to. The condition syntax is documented in the MSBuild conditions reference, and the PackageReference page documents the item itself.
| Package | Condition | Applies to | Why it exists |
|---|---|---|---|
System.Text.Json |
TargetFramework == netstandard2.0 |
netstandard2.0 | Provided in-box on net8.0 |
System.Net.Http |
TargetFramework == netstandard2.0 |
netstandard2.0 | Older surface on the older target |
xunit |
none | All targets | Test-only, framework-neutral |
The last column is the part that makes the inventory durable. A condition with no recorded reason is a condition a future reader will remove to simplify the file, which is exactly the defect described in the opening section.
Compare package framework support
A version that restores is not a version that is supported. Support is a property of the package’s own framework list, and it is per version. The multi-targeting page documents building a package that publishes framework-specific assets, which is the producer side of the same question.
| Package and version | net8.0 | netstandard2.0 | Evidence |
|---|---|---|---|
Foo 2.1.0 |
Supported | Supported | Package framework list |
Foo 3.0.0 |
Supported | Not supported | Package framework list |
Bar 1.4.0 |
Supported | Supported, older API | Package framework list |
Treat the table as a record of what the package declares, not as a compatibility guarantee. Whether a version actually works on a target is evidence collected by restoring and building that target, which is the check below. This post does not claim any specific package supports any specific framework.
Ask Claude Code to record the framework list for each candidate version from the package metadata rather than from memory. The NuGet central package management guide covers where central versions live, and conditional central entries are where a framework split is usually recorded.
Map CPM conditions
When the project uses central package management, the framework split moves into Directory.Packages.props as conditional PackageVersion entries. F033 records that this is a supported pattern.
| Central entry | Condition | Selects for | Project reference |
|---|---|---|---|
System.Text.Json 8.0.0 |
TargetFramework == net8.0 |
net8.0 | Unconditional reference |
System.Text.Json 6.0.10 |
TargetFramework == netstandard2.0 |
netstandard2.0 | Unconditional reference |
The conditional central entry and the unconditional project reference are the intended shape. Flattening either side removes the framework split. Review the central file with the same framework-by-package matrix, because the conditions are where the per-target intent lives once versions are centralized.
Review shared source impact
Shared source compiles against every target, which means every target’s API surface has to satisfy it. The review question is not whether the source is correct in the abstract but whether it is correct against each framework’s available APIs.
| Shared source usage | net8.0 | netstandard2.0 | Review action |
|---|---|---|---|
| API present in both | Compiles | Compiles | No action |
| API newer on one target | Compiles | Compile error or shim | Record the difference |
| API only on one target | Compiles | Compile error | Conditional source or package |
A version difference between targets is often the cause of a shared-source defect. Two versions of the same package can expose different API surfaces, and the shared source sees whichever one the framework’s condition selected. The matrix is what makes that visible before the build fails.
Document framework exceptions
A framework exception is a contract with the repository. Record four things next to each condition: the package, the frameworks that differ, the versions each framework gets, and the reason.
The reason is the part that survives an upgrade. A condition recorded as “older package on netstandard2.0” invites removal during a cleanup. The same condition recorded as “netstandard2.0 cannot take 3.0.0 because the API used by Serializer no longer exists” survives, because a future reader can check the claim.
A worked walkthrough of one matrix
Consider a library targeting net8.0;netstandard2.0 whose shared source uses System.Text.Json. On net8.0 the type is in the box. On netstandard2.0 it is not, so the project carries a conditional PackageReference that applies only to netstandard2.0. Under central package management the version lives in a conditional PackageVersion entry per framework.
The instinctive simplification is removing the condition so one version covers both targets. On net8.0 nothing changes. On netstandard2.0 the package disappears from the graph and the shared source stops compiling, because the in-box type it relied on has no package bringing it in.
The correct sequence starts with the matrix, not the simplification.
Read TargetFrameworks and write the columns. Inventory every conditional PackageReference and every conditional central entry with its condition and reason. For each package, record the version each target receives and the framework list that version declares. This is the matrix, and F033 records conditional entries per framework as a supported pattern rather than a workaround.
dotnet build -f net8.0
dotnet build -f netstandard2.0Build every target separately. A single green build is one column of evidence, and the defect this post exists to prevent lives in the column nobody built. The per-target build is the check that turns the matrix from a document into verified evidence.
Record the reason next to each condition. A condition noted as “netstandard2.0 cannot take the newer package because the API the shared source uses no longer exists” survives a cleanup pass. A condition with no reason is removed at the first opportunity, which is how the opening failure happens.
Anti-patterns that look like simplification
Four patterns recur around multi-targeting, and each one hides a decision a reviewer needs to see.
| Pattern | What it looks like | Why it hurts | Do instead |
|---|---|---|---|
| Removing a condition to simplify | One version for every target | Changes resolution on at least one target | Keep the condition, record the reason |
| Building one target | Green on net8.0, calling it done | The other columns are unverified | Build every target |
| Assuming version support | One version supports every target | Support is per-version, per-framework | Check the package’s framework list |
| Claiming runtime compatibility | Compile succeeds, behavior assumed | Compile is not runtime evidence | Separate executed check |
Assuming version support deserves the most caution. A version that restores on every target can still lack a framework in its supported list, and support is declared by the package per version. The matrix records what the package declares; the per-target build verifies what actually happens.
None of these is a NuGet defect. They are review hazards, and the matrix plus the per-target build are what catch them.
A runbook for the next multi-target change
The checklist earlier in this post is the pass condition. The runbook below is the sequence to follow before changing a dependency in a multi-target project.
Read TargetFrameworks and write the columns of the matrix. A change reviewed against one column is not a multi-target review.
Inventory every conditional PackageReference and conditional central entry with its condition and recorded reason. A condition with no reason is the first thing to investigate, because it may be load-bearing.
For each package in the change, check the framework list the candidate version declares per target. Record the evidence rather than assuming support.
Build every target separately and record the result per column. Paste the per-target results into the change description.
Review the shared source against each target’s API surface. A version difference between targets can expose different APIs, and the shared source sees whichever one the condition selected.
The runbook takes minutes and produces the two artifacts a reviewer needs: the framework-by-package matrix and the per-target build results. Skipping it produces a change that is green in one column and broken in another.
Where this habit pays across the batch
The per-column habit in this post is the same one the rest of the batch applies to different constructs. NuGet central package management asks for a props and override inventory before centralizing, and C# source generators asks for the generator’s input change before reading its output. Maven optional dependencies asks for an import scan before a declaration.
The JVM posts apply the same discipline to version and variant policy. Gradle constraints vs dependencies asks for a resolved-graph diff, Gradle capability conflicts asks for a component inventory, and Gradle variant attributes asks for the consumer request before a notation change.
The C++ posts apply it to configure inputs and dependency boundaries. CMake presets asks for the resolved preset inputs before a configure, CMake find_package vs FetchContent asks for a resolution trace before choosing a path, and Conan CMakeDeps asks for the target contract before a layout change.
That consistency is deliberate. The constructs differ, but the shape is the same: read the evidence the tool already produces, then make the smallest change the evidence supports.
The same shape extends to the ecosystems covered in earlier batches. On the Python side, dependency groups versus extras separates local workflow requirements from published optional features, and stub drift audits a package’s declared types against its documented runtime surface. TypedDict boundaries covers separating truly optional keys from missing data before replacing broad dictionary annotations.
On the Go side, module compatibility covers keeping an exported API change inside an import contract, and graph pruning covers why an indirect dependency entry is graph metadata rather than something to delete. Workspace boundaries covers deciding what belongs in go.work versus what stays a module requirement.
On the Rust side, feature unification covers mapping which optional APIs a workspace build actually exposes, and workspace inheritance covers centralizing metadata without hiding crate-local exceptions. Profile boundaries covers separating diagnostic and optimization settings from options that change observable program behavior.
Per-framework selection has a direct analog in Cargo feature unification, where the same “which surface does each build expose” question applies to features rather than target frameworks. Both are matrix questions, and both reward building every column rather than one.
Reading a per-target build matrix
The matrix is only evidence once every column has a recorded result, and a build run per target is worth capturing deliberately rather than reconstructing from memory.
Run each target as a separate invocation and record the result per column. A single command that builds all targets reports one aggregate outcome, which hides which column failed. Separate invocations give you a cell per framework, and the cell is what the matrix needs.
| Target | Build result | Package versions | Notes |
|---|---|---|---|
| net8.0 | Success | central, unconditional | Baseline column |
| netstandard2.0 | Success | conditional, older package | Condition preserved |
| net6.0 | Not built | not recorded | Column missing, run it |
A missing cell is a finding, not a detail. The framework nobody built is the framework where a framework-specific break lives, and the matrix exists precisely to make that gap visible rather than assume it.
Keep the recorded matrix next to the change that touches a conditional entry. A reviewer reading the cells can tell which targets were verified and which were assumed, which is the difference between a multi-target review and a single-target one with extra columns.
Working alongside the review bottleneck
A multi-target change with a pasted matrix and per-target builds is cheap to review. A change described as “bumped the package” is a reviewer reproducing the work, and reproduction is the expensive part. The Claude Code code review bottleneck covers what happens when generation outpaces the review that has to accept it.
The same reasoning appears in Claude Code cost per verified change, which treats verified work as a separate unit from generated output. A per-target build is a verified unit. A “trust me, it works on every target” description is not.
When the review queue is long enough that verification slips, the failure mode is a merge that nobody actually checked. Prevent false success from passing tests covers the case where one green build is the only evidence, and a framework-specific break is exactly the case where green proves less than it appears to.
The concrete win, loss, and implication
The concrete win is a repository where framework-specific intent is explicit. A new contributor reading the matrix can tell which package versions each target receives and why, without restoring every framework to find out.
The concrete loss is the cost of evidence per target. Every framework is a build to run and a graph to inspect, and the matrix is only as current as the last restore on each target. A project that targets four frameworks pays four times for the review.
The practical implication is that framework compatibility is a per-target fact, not a package property you can assume. Teams that keep the matrix next to the project file resolve fewer “why does this only fail on the old target” incidents. Teams that flatten conditions to simplify the file trade a visible exception for an invisible defect.
Related reading on framework and version boundaries
Version boundaries continue across ecosystems. NuGet central package management covers which central version wins and where overrides live. Gradle variant attributes covers how a consumer request selects a producer variant, and Gradle constraints vs dependencies covers version policy without graph edges.
For generated-code boundaries in the same ecosystem, C# source generators covers reviewing a generator’s contract rather than its output.
For C++ builds, CMake presets covers making configure inputs explicit, CMake find_package vs FetchContent covers choosing a dependency boundary, and Conan CMakeDeps covers keeping consumer target names stable.
Review habits sit upstream of every target-framework change. Ask what Claude Code verification requires before calling a multi-target change done, and prevent false success from passing tests when one green build is the only evidence.
Checklist before changing a multi-target dependency
Run this list against the diff. Each row is a pass condition.
| Check | Pass condition | If it fails |
|---|---|---|
| Target list | Every framework in TargetFrameworks recorded |
Read the property first |
| Condition inventory | Every conditional reference and central entry listed | Complete the scan |
| Reason per condition | Recorded next to the condition | Add the reason before merging |
| Framework support | Version’s framework list checked per target | Record the evidence |
| Per-target build | Every target restored and built | Build the remaining targets |
| Shared source | Usages checked against each target’s API | Record the difference |
| Conditions kept | No condition removed only to simplify | Restore the condition |
Working with Claude Code on multi-targeting
Give the agent the project file and the central props file if the repo uses CPM. Ask for the framework list and the condition inventory before any edit. The agent session works best when the check is a restore and build per target framework, which is the shape the official best-practices guidance recommends.
Ask the agent to report four things when it finishes. The frameworks targeted. The conditional references and central entries with their reasons. The framework support evidence for each candidate version. The per-target build results. A report that omits any target’s build has not finished, because one green framework is not multi-targeting evidence.
Reviewing whether a condition is still needed is the reviewer’s job. The agent reads project files and can build, but deciding whether the shared source can tolerate one version is a design decision. The Claude Code verification guide covers the review questions: what changed, what proves it, and what was not checked.
Data gap and future update
F033 illustrates a supported pattern without establishing compatibility for any specific package, and F034 rests on a PackageReference page that was not full-page fetched. This post does not claim any package supports any framework, and it does not invent support timelines. A future update should record, per repository, which packages carry framework conditions and which versions each target receives, plus the SDK version the observations were taken at.
No benchmark, build-time measurement, or runtime compatibility claim is made here. Whether a selected version behaves correctly on a target requires executed evidence per target.
One AI API Key option for OpenAI-format agents
Claude Code uses an Anthropic-format route, so the One AI free model IDs are not a Claude Code model source. The packet records Claude IDs as unavailable on 2026-11-27.
OpenAI-format agents have a separate route: One AI API Key offers https://api.oneaiapikey.com/v1, one key, and 46 live free IDs. It is a different client and request format, not a workaround for Claude Code authentication. Check the free model list and eligibility notes before choosing an agent route, or read the quickstart for the request shape.
FAQ
Does one package version support every target framework?
Not necessarily. Support is a per-version, per-framework property declared by the package. A version that restores on every target may still lack a framework in its supported list. Check the package’s framework list per version rather than assuming.
Why does the build fail only on the older target?
Usually because the version that target’s condition selects exposes a different API surface than the shared source expects, or because a package lacks that framework entirely. The framework-by-package matrix makes the split visible before the build.
Can central package management vary versions by framework?
Yes. F033 records conditional PackageVersion entries that select different versions for different TargetFramework values. The NuGet central package management guide covers where those entries live.
Should I remove a condition to simplify the project file?
Only if the condition is no longer true. A condition records framework-specific intent, and removing it to shorten the file changes what the build resolves on at least one target. Record the reason next to the condition instead.
Does a green build on one framework prove the others?
No. Each target resolves its own graph and compiles its own assets. Multi-targeting evidence is one build per framework, and runtime compatibility is a further check this post does not claim.
Related reading in this batch
This post is one of ten build-system and dependency guides written together. NuGet Central Package Management and C# Source Generators complete the .NET set.
The JVM posts cover version and variant selection: Gradle Constraints vs Dependencies, Gradle Capability Conflicts, Gradle Variant Attributes, and Maven Optional Dependencies.
The C++ posts cover build inputs and dependency boundaries: CMake Presets, CMake find_package vs FetchContent, and Conan CMakeDeps.
More from this batch
- NuGet Central Package Management: Plan a Cross-Project Migration
- C# Source Generators: Review Generated Contracts With Claude Code
- Gradle Variant Attributes: Match Consumers to the Right Artifact
- Maven Optional Dependencies: Keep Transitive Expectations Explicit
- CMake find_package vs FetchContent: Choose a Dependency Boundary
More Claude Code troubleshooting
- Python Protocols vs ABCs: Preserve Interface Contracts With Claude Code
- Cargo Build Scripts: Define Generated-Artifact Contracts for Claude Code
- pnpm Peer Diagnostics: Read Resolution Reports Before Claude Code Pins
- TypeScript Project References: A Claude Code Boundary Guide
- OpenAPI Generator Customization: Keep Templates and Config in Sync
- GraphQL Code Generator Client Presets: Review Generated Boundaries
- Protocol Buffer Reserved Fields: A Claude Code Wire Compatibility Guide
- sqlc Query Annotations: Align SQL and Generated Types With Claude Code
- Django Deprecation Runway: Plan Framework Maintenance With Claude Code
- Rails Upgrade Sequence: Order Major Changes With Claude Code
- Angular Update Guide: Build a Migration Plan With Claude Code
Sources
- Official: Microsoft Learn: Central Package Management, supporting F033 on conditional PackageVersion entries per framework.
- Official: Microsoft Learn: PackageReference in Project Files, reference item form and conditions.
- Official: Microsoft Learn: .NET Standard Target Frameworks, target framework monikers.
- Official: Microsoft Learn: Multi-targeting for NuGet Packages, producer side of multi-targeting.
- Official: Claude Code Docs: Best Practices, supporting the per-target build check.