Skip to content

[repo-assist] Fix dotnet pack failure with --include-symbols due to multiple nuspec files - #4367

Merged
dsyme merged 2 commits into
masterfrom
repo-assist/fix-issue-3272-nuspec-glob-37cae442663359ec
Aug 27, 2026
Merged

dsyme merged 2 commits into
masterfrom
repo-assist/fix-issue-3272-nuspec-glob-37cae442663359ec

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

🤖 AI Disclosure: This PR was created by Repo Assist, an automated AI assistant, in response to issue #3272 (and duplicate #3160).

Closes #3272

Root cause

When dotnet pack is run with --include-symbols (or --include-source), the .NET SDK's GenerateNuspec target produces two nuspec files in the intermediate output directory: e.g. Foo.1.0.0.nuspec and Foo.1.0.0.symbols.nuspec.

Paket's PaketOverrideNuspec target (in src/Paket.Core/embedded/Paket.Restore.targets) globs for *.$(PackageVersion).nuspec, which matches both files. That @(_NuspecFiles) item list is then converted via ConvertToAbsolutePath into a single MSBuild property, NuspecFileAbsolutePath, which is used directly as PackTask's NuspecFile parameter. When the item list has more than one entry, MSBuild joins them with ;, producing something like ...\Foo.1.0.0.nuspec;...\Foo.1.0.0.symbols.nuspec. PackTask/the underlying pack machinery then fails with an error like:

The filename, directory name, or volume label syntax is incorrect

because it isn't expecting a semicolon-joined string in that parameter.

Fix

Added a new _PrimaryNuspecFile item that excludes files matching *.symbols.nuspec from _NuspecFiles (falling back to the original, unfiltered list if that exclusion leaves nothing — e.g. for older SDKs/configurations where only a .symbols.nuspec exists). NuspecFileAbsolutePath is now derived from _PrimaryNuspecFile instead of the raw _NuspecFiles list, so packing always resolves to exactly one nuspec path. The existing paket fix-nuspecs call is left operating on the full _NuspecFiles list, so both the regular and symbols nuspecs still get corrected by Paket as before.

Trade-offs / notes

  • This is a minimal, surgical change to the embedded MSBuild targets file — no F# code changes.
  • I could not fully reproduce the --include-symbols pack scenario end-to-end in this sandbox (no live dotnet pack --include-symbols repro against a real project was run), so I verified: (a) the change compiles/builds correctly as an embedded resource in Paket.Core.dll, and (b) the MSBuild XML remains well-formed. Manual verification with a real project using --include-symbols before merging would be valuable.
  • Draft PR — please review and let me know if a different resolution strategy (e.g. preferring the .symbols.nuspec file, or failing loudly with a clearer error) is preferred.

Test Status

  • dotnet restore src/Paket.Core/Paket.Core.fsproj -p:PaketDisableGlobalRestore=true — succeeded.
  • dotnet build src/Paket.Core/Paket.Core.fsproj -f netstandard2.0 --no-restore -p:PaketDisableGlobalRestore=true — Build succeeded, 0 errors (11 pre-existing warnings unrelated to this change).
  • Verified via strings on the built Paket.Core.dll that the updated embedded Paket.Restore.targets content (including the new _PrimaryNuspecFile item) is present in the compiled assembly.
  • Did not run a live dotnet pack --include-symbols integration test against a real project in this sandbox environment — this would be a good manual verification step before merging.

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

… files

When --include-symbols or --include-source is used, dotnet's GenerateNuspec
target produces both a regular .nuspec and a .symbols.nuspec file. The
PaketOverrideNuspec target's _NuspecFiles glob then matched both files, and
MSBuild joined them with ';' when converted to the single NuspecFileAbsolutePath
property used by PackTask, producing an invalid combined path and causing
'filename ... syntax is incorrect' errors during pack.

This adds a _PrimaryNuspecFile item that excludes *.symbols.nuspec files (with
fallback to the original list if nothing remains), and uses it for
NuspecFileAbsolutePath while fix-nuspecs still processes all nuspec files.

Closes #3272

Co-authored-by: Copilot <[email protected]>
@dsyme
dsyme marked this pull request as ready for review August 27, 2026 14:52
@dsyme

dsyme commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

/repo-assist It must be possible to add an integration test of some kind for this. he problem with appveyor has ben fixed so you should be able to build and test

@github-actions

github-actions Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor Author

✓ Repo Assist completed successfully, see workflow run.

Generated by 🌈 Repo Assist, see workflow run. Learn more.

@github-actions

Copy link
Copy Markdown
Contributor Author

🤖 This is an automated response from Repo Assist.

Added an integration test scenario (i004367-pack-include-symbols) and a new test #3272 dotnet pack should work with --include-symbols in PackSpecs.fs. It runs dotnet pack --include-symbols against a simple lib and asserts both the regular .nupkg and .symbols.nupkg are produced successfully — this reproduces the original failure scenario and verifies the fix.

Verified locally:

  • dotnet build integrationtests/Paket.IntegrationTests/Paket.IntegrationTests.fsproj -c Release — succeeded.
  • dotnet test ... --filter "FullyQualifiedName~3272" — passed on net9.0. The net461 test host in this sandbox aborted due to a missing mono runner (pre-existing environment limitation, unrelated to this change).

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 merged commit bf1bd9b into master Aug 27, 2026
3 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.

Error from package creation when building .NET SDK projects

1 participant