Fix repeat builds with persisted source-generated files#27115
Open
powercode wants to merge 1 commit intoPowerShell:masterfrom
Open
Fix repeat builds with persisted source-generated files#27115powercode wants to merge 1 commit intoPowerShell:masterfrom
powercode wants to merge 1 commit intoPowerShell:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts the build configuration so source-generator emitted files can persist on disk across builds without being treated as project source, addressing issues seen on repeat builds.
Changes:
- Stop deleting
gen\SourceGeneratedat the start of the build (removesRemoveDirfrom the early build target). - Explicitly exclude
gen\SourceGenerated\**\*.csfrom compilation inSystem.Management.Automation.csproj.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/System.Management.Automation/System.Management.Automation.csproj |
Excludes persisted source-generator output under gen\SourceGenerated from Compile items to prevent it from being compiled as project source. |
PowerShell.Common.props |
Removes the build-time deletion of gen\SourceGenerated, allowing generator output to persist across builds. |
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.
PR Summary
Remove the removal of existing generated files by source generators to allow persisted generator output to remain visible on disk without compiling it as project source.
PR Context
This change addresses issues with repeat builds by ensuring that source-generated files are not deleted at the start of the build process, thus maintaining their availability for subsequent builds.
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright header