From c2fb8e1b029cf8a602b19ffd580e97110768cd15 Mon Sep 17 00:00:00 2001 From: Daniel Cazzulino Date: Wed, 24 Jun 2026 16:34:39 -0300 Subject: [PATCH] fix: occasional build failures with shared GitInfo.cache under parallel builds (#390) When using a shared \ (e.g. solution-level obj/) with msbuild /m, multiple projects can race on clearing/writing GitInfo.cache, leading to MSB3491 'file is being used by another process'. - Add ContinueOnError=true to Delete (clear), MakeDir, and WriteLinesToFile for the shared cache (consistent with prior race fixes for IsDirty.cache and read paths). - This makes the write failure non-fatal; one concurrent writer succeeds, values are already computed in-memory for all, and the marker is updated. - Updated changelog. Fixes #390 --- changelog.md | 1 + src/GitInfo/build/GitInfo.targets | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/changelog.md b/changelog.md index a45a48f..00d07ea 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,7 @@ :bug: Fixed bugs: - Assemblies of transitive nuget dependencies are placed into the build folder [\#389](https://github.com/devlooped/GitInfo/issues/389) +- Build occasionally fails when using shared GitInfo.cache with parallel builds (msbuild /m) [\#390](https://github.com/devlooped/GitInfo/issues/390) ## [v3.6.0](https://github.com/devlooped/GitInfo/tree/v3.6.0) (2025-10-17) diff --git a/src/GitInfo/build/GitInfo.targets b/src/GitInfo/build/GitInfo.targets index 7c7e6bf..9331171 100644 --- a/src/GitInfo/build/GitInfo.targets +++ b/src/GitInfo/build/GitInfo.targets @@ -337,12 +337,12 @@ - + - + @@ -859,9 +859,9 @@ <_GitInfoFileDir>$([System.IO.Path]::GetDirectoryName('$(_GitInfoFile)')) - + - +