Skip to content

[repo-assist] Fix exclude directive not suppressing build targets/props import (#3193) - #4368

Merged
dsyme merged 1 commit into
masterfrom
repo-assist/fix-issue-3193-exclude-targets-8afa7e42915a11bc
Aug 27, 2026
Merged

dsyme merged 1 commit into
masterfrom
repo-assist/fix-issue-3193-exclude-targets-8afa7e42915a11bc

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Closes #3193

Root cause

InstallModel.filterExcludes (used by ReferencesFile's exclude <PackageName> directive) only filtered CompileLibFolders (assembly references). It never touched TargetsFileFolders, which holds each package's .targets/.props build files. As a result, using exclude on a transitive package stopped its assemblies from being referenced, but its MSBuild .targets/.props files were still imported into the project — exactly the symptom reported in #3193 (custom build targets from an excluded package still landing in the project).

Fix

Updated filterExcludes in src/Paket.Core/PaketConfigFiles/InstallModel.fs to also filter TargetsFileFolders, matching the file name/path against the exclude patterns (matching both MsBuildFile.Name and .Path for robustness, since these are .targets/.props file names without extension).

Trade-offs

  • Matching is a simple substring Contains check against both file name and path, consistent with how filterExcludes already matches assembly references — this could match more broadly than intended if a substring collides with an unrelated file, but this mirrors the existing behavior for compile references so it stays consistent.
  • Only affects packages referenced via exclude in paket.references; does not change import_targets: false handling, which was already correct.

Test Status

  • ✅ Added unit test should exclude targets files when filtering excludes in tests/Paket.Tests/InstallModel/ProcessingSpecs.fs.
  • ✅ Build: dotnet build src/Paket.Core/Paket.Core.fsproj -f netstandard2.0 succeeded (0 errors).
  • ✅ Tests: dotnet test tests/Paket.Tests/Paket.Tests.fsproj -f net9 --filter "FullyQualifiedName~InstallModel.ProcessingSpecs" — 45/45 passed.

Generated by 🌈 Repo Assist, see workflow run. Learn more.
Comment /repo-assist to run again

Add this agentic workflow to your repo

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@ae8d551f07c7ed7619f8c58c7bb4c3ac89395d38

@dsyme
dsyme marked this pull request as ready for review August 27, 2026 14:54
@dsyme
dsyme merged commit 1788749 into master Aug 27, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom build targets cannot be excluded

1 participant