check-bin-obj-clash

Detects MSBuild projects sharing conflicting OutputPath or IntermediateOutputPath directories.

Updated Sep 22, 2026
One-click install
npx skills add https://github.com/bytecakelake/Nurse-Scheduler --skill check-bin-obj-clash-bytecakelake
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: check-bin-obj-clash
Source: https://github.com/bytecakelake/Nurse-Scheduler/tree/main/.agents/plugins/dotnet-msbuild/skills/check-bin-obj-clash
Command: npx skills add https://github.com/bytecakelake/Nurse-Scheduler --skill check-bin-obj-clash-bytecakelake

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? MSBuild builds fail intermittently with errors like "Cannot create a file when that file already exists" or "file is being used by another process" when multiple project evaluations write to the same bin/obj output directories, and the root cause is hard to pinpoint without structured analysis. ## Core Features & Use Cases - Clash Detection via Binlog MCP: Query binary logs with MCP tools (evaluations, evaluation_global_properties, double_writes) to find evaluations sharing OutputPath or IntermediateOutputPath. - Text-Log Fallback Workflow: Replay the binlog to a diagnostic text log and grep for evaluation counts, output paths, and distinguishing global properties when the MCP server is unavailable. - Root-Cause Catalog with Fixes: Covers multi-targeting without TargetFramework in path, shared BaseIntermediateOutputPath across projects, RuntimeIdentifier clashes, multi-solution builds, extra global properties like PublishReadyToRun or _IsPublishing, and redundant SetTargetFramework on ProjectReference. - Use Case: A parallel build fails during NuGet restore with "Cannot create a file when that file already exists"; this skill inspects the binlog, finds two projects sharing one IntermediateOutputPath where project.assets.json is written, and prescribes unique per-project obj paths. ## Quick Start Generate a binary log of the failing build and use this skill to check whether any MSBuild project evaluations share the same OutputPath or IntermediateOutputPath.

Frequently Asked Questions about check-bin-obj-clash

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find MSBuild OutputPath conflicts in my build?▼

Generate a binary log of the build, then query project evaluations with the binlog MCP tools to compare OutputPath and IntermediateOutputPath values. Normalize paths to absolute form, group evaluations by path, and any group with more than one evaluation is a clash.

Why does NuGet restore fail with 'Cannot create a file when that file already exists'?▼

This error strongly indicates multiple projects share the same IntermediateOutputPath where project.assets.json is written. Each project must have a unique BaseIntermediateOutputPath; AppendTargetFrameworkToOutputPath cannot fix cross-project intermediate path clashes.

Can I analyze a binlog without the MCP server?▼

Yes, replay the binlog to a diagnostic text log with dotnet msbuild build.binlog -noconlog -fl -flp:v=diag, then grep for evaluation starts, OutputPath assignments, and distinguishing global properties. The binlog itself is binary and must never be read directly with cat or strings.

Does AppendTargetFrameworkToOutputPath fix shared output directories?▼

No, it only fixes multi-targeting clashes within the same project. Files like project.assets.json are written directly to IntermediateOutputPath without the TargetFramework suffix, so projects sharing BaseIntermediateOutputPath still clash during parallel restore.

When should SetTargetFramework on a ProjectReference be removed?▼

Remove it when it re-injects the same TFM a single-targeting project already declares, since that is path-neutral and forks a redundant instance sharing the output path. It remains legitimate for multi-targeting references or overriding to a different TFM.

Which project evaluations should be ignored when checking for clashes?▼

Ignore evaluations with BuildProjectReferences=false, which are P2P reference resolution queries that only read metadata via GetTargetPath and never write outputs. For OutputPath comparisons, also exclude restore-phase evaluations marked with MSBuildRestoreSessionId.