Be smarter about PackFolder on project references#181
Merged
Conversation
Whenever we had `PrivateAssets=all` on a project reference (whether implicitly or explicitly), we used to unconditionally pass `PackFolder=$(PackFolder)` when resolving referenced content. This is correct whenever the calling project does indeed have a `PackFolder`, but not for packaging projects, since in that case, the packaging project itself doesn't have a value for that property (since it can pack any arbitrary content and has no primary output). So we switch to the mechanism used already by the .NET SDK (and common targets) of using a metadata item with the full property assignment syntax. This means that if the metadata isn't present (which we now condition to the presence of a value for `PackFolder`), when calling `GetPackageContents` on the project reference, no value will be passed at all for that property, meaning whichever value is there already, will be propagated to the referencing project, which is exactly what we want in a packaging project scenario. Fixes #139
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Whenever we had
PrivateAssets=allon a project reference (whether implicitly or explicitly), we used to unconditionally passPackFolder=$(PackFolder)when resolving referenced content. This is correct whenever the calling project does indeed have aPackFolder, but not for packaging projects, since in that case, the packaging project itself doesn't have a value for that property (since it can pack any arbitrary content and has no primary output).So we switch to the mechanism used already by the .NET SDK (and common targets) of using a metadata item with the full property assignment syntax. This means that if the metadata isn't present (which we now condition to the presence of a value for
PackFolder), when callingGetPackageContentson the project reference, no value will be passed at all for that property, meaning whichever value is there already, will be propagated to the referencing project, which is exactly what we want in a packaging project scenario.Fixes #139