dotnet / dotnet/msbuild

Consider removing PublishTrimmed from p2p refs

Open
#9,415 0 comments 0 reactions 1 assignee Assigned to @rainersigwald View on GitHub
Area: Common Targets backlog Partner request Priority:2 triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

From @sbomer offline:

> global properties apply to all project references, specifically in the case of "dotnet publish /p:PublishTrimmed=true". It causes problems because not all projects support PublishTrimmed (it's meant to be set in the app project, not in libraries).

For example, dotnet/runtime#94406.

Common targets has a special case to avoid this problem for `OutputPath`

https://github.com/dotnet/msbuild/blob/74f7ebbb3dd2817dede9621a00ccb343c638be2d/src/Tasks/Microsoft.Common.CurrentVersion.targets#L807

We could consider extending it to include `PublishTrimmed` by default, or having the SDK extend `$(_GlobalPropertiesToRemoveFromProjectReferences)`.

A systemic solution could also be interesting (https://github.com/dotnet/msbuild/issues/9414) but this is to consider a targeted solution for this problem.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.