Starting with .NET 8 I'm observing broken incremental builds related to SourceLink and the generated assembly info file.
When the regular command-line build runs, EnableSourceControlManagerQueries is true, so InitializeSourceControlInformationFromSourceControlManager runs. Then the Git SHA is added to the informational version during AddSourceRevisionToInformationalVersion. Finally CoreGenerateAssemblyInfo runs, and writes the full sha such as 1.0.0+60002d5025224f2f2ffd0e1e159226e7c2ff61c3 into $(GeneratedAssemblyInfoFile).
However during design-time build, EnableSourceControlManagerQueries is false because DesignTimeBuild = true:
https://github.com/dotnet/sourcelink/blob/4ca4236c10047416251be48339d464f15a697e8b/src/SourceLink.Common/build/Microsoft.SourceLink.Common.props#L13
Then the target InitializeSourceControlInformationFromSourceControlManager doesn't run, so ultimately the generated assembly informational version is just 1.0.0.
Thus, the file Foo.AssemblyInfo.cs gets a different assembly informational attribute after regular and design-time builds, thus flip-flopping and breaking incrementality.
I don't think I've seen this before .NET 8 (maybe because SourceLink stuff wasn't on by default?).
@drewnoakes @tmat
Starting with .NET 8 I'm observing broken incremental builds related to SourceLink and the generated assembly info file.
When the regular command-line build runs,
EnableSourceControlManagerQueriesis true, soInitializeSourceControlInformationFromSourceControlManagerruns. Then the Git SHA is added to the informational version duringAddSourceRevisionToInformationalVersion. FinallyCoreGenerateAssemblyInforuns, and writes the full sha such as1.0.0+60002d5025224f2f2ffd0e1e159226e7c2ff61c3into$(GeneratedAssemblyInfoFile).However during design-time build,
EnableSourceControlManagerQueriesis false because DesignTimeBuild = true:https://github.com/dotnet/sourcelink/blob/4ca4236c10047416251be48339d464f15a697e8b/src/SourceLink.Common/build/Microsoft.SourceLink.Common.props#L13
Then the target
InitializeSourceControlInformationFromSourceControlManagerdoesn't run, so ultimately the generated assembly informational version is just1.0.0.Thus, the file
Foo.AssemblyInfo.csgets a different assembly informational attribute after regular and design-time builds, thus flip-flopping and breaking incrementality.I don't think I've seen this before .NET 8 (maybe because SourceLink stuff wasn't on by default?).
@drewnoakes @tmat