check-bin-obj-clash

Detects MSBuild projects sharing conflicting OutputPath or IntermediateOutputPath directories.

Updated Jul 12, 2026
One-click install
npx skills add https://github.com/Patrick-Rex/DotNetTechSamples --skill check-bin-obj-clash-patrick-rex
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: check-bin-obj-clash
Source: https://github.com/Patrick-Rex/DotNetTechSamples/tree/main/.agents/plugins/dotnet-msbuild/skills/check-bin-obj-clash
Command: npx skills add https://github.com/Patrick-Rex/DotNetTechSamples --skill check-bin-obj-clash-patrick-rex

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 directories. This Skill diagnoses those OutputPath and IntermediateOutputPath clashes in multi-project, multi-targeting, or multi-solution builds. ## Core Features & Use Cases - Binary log analysis: Queries .binlog files through MCP tools (evaluations, global properties, double writes) to find evaluations sharing output paths, with a text-log replay fallback when MCP is unavailable. - Root cause identification: Distinguishes clash causes such as missing AppendTargetFrameworkToOutputPath, shared BaseIntermediateOutputPath, extra global properties like PublishReadyToRun or _IsPublishing, and redundant SetTargetFramework metadata on ProjectReference. - Actionable fixes: Provides concrete MSBuild XML fixes for each cause, including path-neutral property detection and guidance on which evaluations to ignore (BuildProjectReferences=false P2P queries). - Use Case: A solution build fails randomly during NuGet restore with "Cannot create a file when that file already exists". Use this Skill to generate a binlog, compare IntermediateOutputPath across evaluations, and discover two projects share the same obj directory where project.assets.json is written. ## Quick Start Ask the AI to analyze the build binlog for projects with conflicting OutputPath or IntermediateOutputPath values causing the intermittent build failure.

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 diagnose 'Cannot create a file when that file already exists' MSBuild errors?

This error during NuGet restore typically means multiple projects share the same IntermediateOutputPath where project.assets.json is written. Generate a binary log, then compare IntermediateOutputPath values across all project evaluations to find the collision.

How to find projects sharing the same bin or obj output directory?

Generate a .binlog of the build, then query OutputPath and IntermediateOutputPath for each project evaluation using binlog MCP tools or a diagnostic text log. Normalize paths to absolute form and group evaluations by path; any group with more than one real build evaluation is a clash.

Does AppendTargetFrameworkToOutputPath fix shared output path clashes?

It fixes multi-targeting clashes within a single project, but not cross-project clashes. Files like project.assets.json are written directly to IntermediateOutputPath without the TargetFramework suffix, so each project needs a unique BaseIntermediateOutputPath.

Why does my build fail intermittently but succeed on retry?

Intermittent failures that succeed on retry indicate parallel builds racing to write the same output files. Common causes include shared output directories, redundant project instances from extra global properties like PublishReadyToRun, or SetTargetFramework re-injecting a single-targeting project's own TFM.

When should I ignore project evaluations in clash analysis?

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