Skip to content

[repo-assist] Prefer MSBuild PackageId property when resolving pack id (fixes #3195) - #4360

Merged
dsyme merged 1 commit into
masterfrom
repo-assist/fix-issue-3195-packageid-01e07152c47db3b1
Aug 26, 2026
Merged

dsyme merged 1 commit into
masterfrom
repo-assist/fix-issue-3195-packageid-01e07152c47db3b1

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

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

Root cause

paket pack derives the package id from the assembly name (ProjectFile.GetAssemblyName()) when the paket.template file doesn't explicitly set an id. It never looked at the MSBuild PackageId property, so projects that set <PackageId> in the .csproj/.fsproj (e.g. to override an assembly name like AssemblyName with a WpfAnalyzers-clean name) still got a package named after the assembly, unlike dotnet pack which honors PackageId.

Fix

Added PackageProcess.resolveProjectId, used in merge, which resolves the id in this priority order:

  1. an id already present in the template (unchanged behavior — never overridden)
  2. the MSBuild PackageId property read via ProjectFile.GetProperty "PackageId"
  3. the assembly name (previous fallback, unchanged)

This is a minimal, additive change — no existing behavior changes unless PackageId is set and the template doesn't already specify an id.

Trade-offs

  • Only reads the PackageId MSBuild property as-is (no evaluation of MSBuild property functions/conditions beyond what ProjectFile.GetProperty already supports for other properties in this codebase).

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~PackagingProcess" — 3/3 new tests for resolveProjectId passed. The pre-existing Loading assembly metadata works test fails in this sandbox for both before/after this change (missing net461 build output at test time), unrelated to this fix.

Closes #3195

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

Closes #3195

Fixes 'paket pack' generating a nupkg named after the assembly instead
of respecting the MSBuild <PackageId> property, matching 'dotnet pack'
behavior.

Co-authored-by: Copilot <[email protected]>
@dsyme
dsyme marked this pull request as ready for review August 26, 2026 18:44
@dsyme
dsyme merged commit dffe65f into master Aug 26, 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.

Paket pack does not respect <PackageId>PackageId</PackageId>

1 participant