[repo-assist] Fix paket pack failing when TargetFramework(s) are in conditional PropertyGroups - #4413
Open
github-actions[bot] wants to merge 2 commits into
Conversation
…ps (fixes #3799) Closes #3799 getOutputDirectory evaluated TargetFramework/TargetFrameworks with an empty Configuration/Platform property map, so conditional PropertyGroups keyed on Configuration/Platform (e.g. Condition="'$(Configuration)'=='Release'") were never matched and no target framework was found, causing: 'Unable to find Release output path node ... for any known platforms'. Fix: evaluate TargetFramework/TargetFrameworks with the requested Configuration and Platform values already available in getOutputDirectory, via new getTargetFrameworkWithDefaults/getTargetFrameworksParsedWithDefaults helpers that reuse the existing conditional-property evaluator. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dsyme
marked this pull request as ready for review
August 30, 2026 20:51
Contributor
|
/repo-assist expand the test matrix for this fix by pushing to this PR and also advise of any possible negative consequences of this change |
Contributor
Author
|
✓ Repo Assist completed successfully, see workflow run.
|
- Add MicrosoftNetSdkWithConditionalTargetFrameworksOnly.csprojtest fixture that reproduces the exact original issue shape (no unconditional TargetFramework/TargetFrameworks fallback element). - Add case-insensitive configuration coverage (dEbUg/rElEaSe) for the conditional-frameworks fixture. - Add a test asserting the correct default framework (first listed) is picked per configuration. - Add a test asserting GetOutputDirectory resolves the output path for a specific requested TargetProfile (net45) inside conditional PropertyGroups. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Author
|
🤖 This is an automated response from Repo Assist. Test matrix expanded — pushed a new commit with 4 additional test cases:
All net9.0 tests pass (47/47, up from 39/39). net461 still can't run in this sandbox ( Possible negative consequences of this change:
Add this agentic workflow to your repoTo install this agentic workflow, run |
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.
🤖 This is an automated response from Repo Assist.
Closes #3799
Root cause
ProjectFile.getOutputDirectorylooked upTargetFramework/TargetFrameworksusinggetTargetFramework/getTargetFrameworksParsed, which evaluate the project's conditionalPropertyGroups against an empty property map (noConfiguration/Platform). When a project puts itsTargetFrameworksinside aPropertyGroupconditioned onConfiguration(a common and MSBuild-valid pattern), the condition never matches, no framework is found, andpaket pack/paket restorefails with:Fix
Added
getTargetFrameworkWithDefaults/getTargetFrameworksParsedWithDefaultshelpers that reuse the existing conditional-property evaluator (getPropertyWithDefaults) but seed it with theConfiguration/PlatformvaluesgetOutputDirectoryalready has.getOutputDirectorynow uses these instead of the unconditioned variants, so conditionalPropertyGroups keyed on Configuration/Platform are correctly evaluated.This is a minimal, surgical change — the unconditioned
getTargetFramework/getTargetFrameworksParsedfunctions are left untouched since they're used elsewhere (e.g.getTargetProfiles) where evaluating without Configuration/Platform context is intentional.Test Status
MicrosoftNetSdkWithConditionalTargetFrameworks.csprojtestreproducing the issue'sCondition="'$(Configuration)'=='Release'"pattern.GetOutputDirectoryno longer throws for Debug/Release configurations.dotnet build src/Paket.Core/Paket.Core.fsproj -c Release: succeeds (0 errors).dotnet test tests/Paket.Tests/Paket.Tests.fsproj -c Release --filter "FullyQualifiedName~OutputSpecs": net9.0 — 39/39 passed. The net461 target host failed to launch in this sandbox only becausemonoisn't installed here (Could not find 'mono' host), an environment limitation unrelated to the change — no code-caused failures.As an AI assistant, I may make mistakes. Please review carefully before merging.
Add this agentic workflow to your repo
To install this agentic workflow, run