Programming

C# build fails with duplicate assembly attributes in CI only

Environment

Environment

.NET 9 solution built in Azure Pipelines with cached obj directories.

What happens

What happens

CI reports duplicate TargetFrameworkAttribute although local clean builds succeed.

What I have tried

What I have tried

Removed custom AssemblyInfo attributes and rebuilt the solution.

I would appreciate advice on how to identify the root cause without risking existing data or configuration.

COMMUNITY RESPONSES

Verified community troubleshooting

0 replies

No answers yet..

Showing 0 of 0 community responses
AI DIAGNOSTICS

Incident analysis

Updated 3w ago• Trouble ID

Most likely causes

Stale generated files from another target framework are restored from the build cache. 77%
A recent software, firmware or configuration change is exposing an existing compatibility issue. 29%

Summary

The reported behaviour is consistent with stale generated files from another target framework are restored from the build cache. The safest next step is to verify that hypothesis with a reversible test before making permanent configuration changes.

Suggested Fixes

Verify the likely cause
Exclude bin and obj from caching, delete them before restore and key caches on SDK plus project files rather than workspace output.
Validate and monitor
Reproduce the issue once after the change, review relevant logs or metrics, and keep a rollback path until the system has remained stable.