Skip to content

Add SuppressDependenciesWhenPacking to MSBuild package#30

Merged
Malcolmnixon merged 2 commits into
mainfrom
fix/msbuild-package-private-assets
Jun 24, 2026
Merged

Add SuppressDependenciesWhenPacking to MSBuild package#30
Malcolmnixon merged 2 commits into
mainfrom
fix/msbuild-package-private-assets

Conversation

@Malcolmnixon

@Malcolmnixon Malcolmnixon commented Jun 24, 2026

Copy link
Copy Markdown
Member

This pull request updates the MSBuild integration for the ApiMark tool, clarifying how dependencies are handled and ensuring that no unnecessary NuGet dependencies propagate to consumers. The changes document and enforce that the package acts as a build plugin, not a traditional library, and that all required tooling is bundled directly.

Dependency handling and packaging improvements:

  • Updated documentation to specify that Microsoft.Build.* dependencies are declared with ExcludeAssets="runtime", ensuring they are only used for compilation and not included in the build output, as the MSBuild host provides them at runtime.
  • Added SuppressDependenciesWhenPacking=true to the project file and documented it, guaranteeing that no NuGet dependencies from this package will flow into consumers' dependency graphs, since all necessary tools are bundled directly. [1] [2]

Microsoft.Build.Framework and Microsoft.Build.Utilities.Core were
declared with ExcludeAssets="runtime" only, which prevents the DLLs
from being copied to the build output but does NOT suppress them from
the packed .nuspec. As a result, every consumer of
DemaConsulting.ApiMark.MSBuild received these as transitive NuGet
dependencies, pulling in unintended transitive packages such as
System.Memory 4.6.3.

Since the MSBuild host provides these assemblies at runtime, they have
no business appearing in consumers' NuGet graphs. Adding
PrivateAssets="all" suppresses them from the .nuspec entirely, matching
the existing treatment of SourceLink.GitHub and Polyfill.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 24, 2026 22:05
@Malcolmnixon Malcolmnixon added the bug Something isn't working label Jun 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts MSBuild-related PackageReference metadata in ApiMark.MSBuild.csproj so MSBuild assemblies remain compile-time only and are not flowed as transitive NuGet dependencies when packing the MSBuild integration package.

Changes:

  • Added PrivateAssets="all" to Microsoft.Build.Framework and Microsoft.Build.Utilities.Core package references to suppress transitive dependency propagation during packing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ApiMark.MSBuild/ApiMark.MSBuild.csproj Outdated
…ependenciesWhenPacking

ApiMark.MSBuild is a build-plugin package, not a library. The MSBuild
host provides Microsoft.Build.* at runtime, and ApiMark.Tool with its
dependencies is bundled directly in the package under tools/. No NuGet
dependency should ever propagate to a consumer's dependency graph.

Replace the per-reference PrivateAssets approach with the project-level
SuppressDependenciesWhenPacking=true property, which encodes this
architectural intent directly and guards against future references
inadvertently leaking into consumers' NuGet graphs.

Document the rationale in the MSBuild design doc under Dependencies
and Design Constraints.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Malcolmnixon Malcolmnixon changed the title Add PrivateAssets=all to MSBuild package references to suppress transitive dependencies Add SuppressDependenciesWhenPacking to MSBuild package Jun 24, 2026
@Malcolmnixon Malcolmnixon requested a review from Copilot June 24, 2026 22:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@Malcolmnixon Malcolmnixon merged commit f2946b5 into main Jun 24, 2026
16 checks passed
@Malcolmnixon Malcolmnixon deleted the fix/msbuild-package-private-assets branch June 24, 2026 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants