Re-run WriteVerifyAttributes when the values change - #1891
Merged
Conversation
The up-to-date check compared only $(MSBuildAllProjects) timestamps against the generated file, but the content comes from $(SolutionDir), $(SolutionName) and $(TargetFrameworks). So rebuilding with a different /p:SolutionDir or /p:SolutionName, which is exactly what the DiscoverSolutionInfo warnings tell users to pass, or building the same project from another solution, skipped the target and CoreCompile and left stale metadata in the assembly for AttributeReader and DerivePaths to read at test time. Only a full Rebuild or touching the csproj cleared it. The values are now written to a cache file with WriteOnlyWhenDifferent, and that file is an input, so its timestamp moves only on a real change. Same pattern as the SDK's GenerateAssemblyInfo. Verified by building, then rebuilding with /p:SolutionName=OtherSolution: before this the emitted Verify.SolutionName stayed at the old value, now it updates.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The up-to-date check compared only$(MSBuildAllProjects) timestamps against the generated file, but the content comes from $ (SolutionDir), $(SolutionName) and $ (TargetFrameworks). So rebuilding with a different /p:SolutionDir or /p:SolutionName, which is exactly what the DiscoverSolutionInfo warnings tell users to pass, or building the same project from another solution, skipped the target and CoreCompile and left stale metadata in the assembly for AttributeReader and DerivePaths to read at test time. Only a full Rebuild or touching the csproj cleared it.
The values are now written to a cache file with WriteOnlyWhenDifferent, and that file is an input, so its timestamp moves only on a real change. Same pattern as the SDK's GenerateAssemblyInfo.
Verified by building, then rebuilding with /p:SolutionName=OtherSolution: before this the emitted Verify.SolutionName stayed at the old value, now it updates.