dotnet / dotnet/project-system

Support TargetPath and Link metadata on CopyToOutputDirectory items in Properties window

Open
#9,419 0 comments 1 reaction 0 assignees View on GitHub
Feature-Rules/Properties Triage-Approved
Dominant language
C#
Stars
1k
Forks
415
PR merge metrics
No merged PRs in 30d

Description

Any browse object rule that defines editable `CopyToOutputDirectory` metadata should also have `TargetPath` and possibly `Link`.

This will allow users to modify these values from the properties tool window in VS.

From https://learn.microsoft.com/en-us/visualstudio/msbuild/common-msbuild-item-metadata:

> The Visual Studio project system uses `Link` metadata (if present) to alter what shows up in the project tree; you can put a file in a different logical folder structure in Solution Explorer.
>
> In addition, the `AssignTargetPath` task looks at `Link` to determine where in the output directory to copy a file to, if it’s one of the items that gets copied.

From https://learn.microsoft.com/en-us/visualstudio/msbuild/common-msbuild-project-items:

> `TargetPath` is the output path (relative to the configuration- and/or platform-specific output directory) of an item, including the filename. This respects the `Link` metadata, if provided. If `TargetPath` isn't provided, it's computed during the build process. See [AssignTargetPath](https://learn.microsoft.com/en-us/visualstudio/msbuild/assigntargetpath-task?view=vs-2022).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.