Solution:
Root Cause: Minifilter File-System Locking during Compilation
During software compilation (using MSBuild, GCC, Rust Cargo, or PyInstaller), compiler toolchains rapidly generate, write, rename, and delete temporary binaries (
.tmp,
.obj,
.exe). Defender's real-time minifilter driver intercepts each file write event to inspect signatures, causing file lock contention, build failures, or false-positive script triggers.
Step-by-Step Fix:
1Add Build Output Extension Exclusions:
Open PowerShell as Administrator and exclude temporary build extensions: Add-MpPreference -ExclusionExtension ".tmp", ".obj", ".pdb"
2Add Project Repository Exclusion Directory:
Exclude your primary development workspace directory: Add-MpPreference -ExclusionPath "C:\Users\YourUsername\source\repos"
3Enable Asynchronous Performance Mode on Dev Drives (Windows 11):
If running Windows 11, configure a dedicated ReFS Dev Drive for project source code.Verify Defender Async Performance Mode status: Get-MpPreference | Select-Object -ExpandProperty EnableDevDriveProtection