Skip to content

Instantly share code, notes, and snippets.

@1eyewonder
Created February 18, 2025 21:36
Show Gist options
  • Save 1eyewonder/1352b7c9cd0873d468be9ff39d8b3342 to your computer and use it in GitHub Desktop.
Save 1eyewonder/1352b7c9cd0873d468be9ff39d8b3342 to your computer and use it in GitHub Desktop.
Script to detect why something is rebuilding
#r "nuget: MSBuild.StructuredLogger"
open Microsoft.Build.Logging.StructuredLogger
let build = Serialization.Read @"C:\Users\path-here\msbuild-editorconfig.binlog"
let (|Message|_|) (b : BaseNode) =
match b with
| :? Message as m -> Some m
| _ -> None
let causations = build.FindChildrenRecursive<Target>(fun t -> t.Name = "CoreCompile" && t.Children |> Seq.exists(function Message m -> m.ToString().Contains "is newer than" | _ -> false) )
causations
|> Seq.sortBy(fun t -> t.StartTime)
|> Seq.iter (fun t ->
printfn $"{t.Project} {t.Name}"
t.Children
|> Seq.iter(fun x -> printfn " %A" <| x)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment