Repository navigation
[repo-assist] Fix #3209: preserve Paket.Restore.targets import position - #4364
Merged
dsyme merged 2 commits intoAug 27, 2026
Merged
Conversation
Root cause: installForDotnetSDK unconditionally removed and re-appended the <Import Project="...Paket.Restore.targets" /> node on every install/restore, moving it to the end of the project file even when it was already present at the same location. This broke projects that rely on a specific import order. Fix: skip the remove+re-add when an Import node with the same relative path already exists, so the node's original position is preserved. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dsyme
marked this pull request as ready for review
August 26, 2026 22:15
Contributor
|
/repo-assist Add a test for this |
Contributor
Author
|
✓ Repo Assist completed successfully, see workflow run. Command mode: responded to /repo-assist "Add a test for this" on PR #4364. Added tests/Paket.Tests/ProjectFile/InstallForDotnetSDKSpecs.fs with 2 unit tests covering InstallProcess.installForDotnetSDK's #3209 fix (import position preserved when already present; import still added when missing), registered in Paket.Tests.fsproj, and pushed the commit to the PR branch via push_to_pull_request_branch. Verified: dotnet test --filter "FullyQualifiedName~ProjectFile" — 111/111 passed. Per command-mode instructions, exiting without running the normal scheduled workflow tasks.
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
17 tasks
This was referenced Oct 5, 2026
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 PR is submitted by Repo Assist, an automated AI assistant for this repository. 🤖
Closes #3209
Root cause
installForDotnetSDK(insrc/Paket.Core/Installation/InstallProcess.fs) unconditionally calledRemoveImportForPaketTargets()followed byAddImportForPaketTargets(...)on everypaket install/restore, regardless of whether the correct<Import Project="...Paket.Restore.targets" />node was already present.AddImportForPaketTargetsalways appends the new node at the end of the project file, so any project whose import was not already last got it moved there on every run.Fix
Before removing/re-adding, check whether an
Importnode with the same relative path already exists. If it does, skip the remove/re-add entirely, leaving the existing node (and its position) untouched. This preserves import ordering for projects/tooling that depend on it, while still fixing/adding the import when it's missing or points at a different (stale) path.Trade-offs
ProjectFile/installForDotnetSDKtest fixture; existingProjectFiletest suite (109 tests) still passes unmodified, confirming no regressions.Test Status
dotnet build src/Paket.Core/Paket.Core.fsproj -f netstandard2.0— succeeded (0 errors).dotnet test tests/Paket.Tests/Paket.Tests.fsproj -f net9 --filter "FullyQualifiedName~ProjectFile"— 109/109 passed.ci.appveyor.com); Main-group restore and targeted netstandard2.0/net9 build+test were used instead (documented workaround from prior runs).Add this agentic workflow to your repo
To install this agentic workflow, run