Skip to content

Add project capabilities when PublishAot, PublishTrimmed, PublishSingleFile, and PublishReadyToRun are set to true #46185

@DamianEdwards

Description

@DamianEdwards

We currently have very little visibility into the usage of the following features that relate to how projects will be published:

  • PublishAot
  • PublishTrimmed
  • PublishSingleFile
  • PublishReadyToRun

In order to help us gauge use of these features at the project level (e.g. for console app projects vs. web projects, etc.) and that the feature is being used in the intended fashion (i.e. the properties are set in the project file such that they are evaluated at design-time to enable the relevant design-time features), we should add project capabilities from the appropriate target so that they're included in the set of project capabilities reported for the project by existing telemetry streams in the VS family of products, e.g. when the project is initialized in VS Code with C# Dev Kit installed.

Not sure which target is the right one, but I imagine the addition will be fairly straightforward, along the lines of:

<ItemGroup>
  <ProjectCapability Condition=" 'PublishAot' == 'true' " Include="PublishAot" />
  <ProjectCapability Condition=" 'PublishTrimmed' == 'true' " Include="PublishTrimmed" />
  <ProjectCapability Condition=" 'PublishSingleFile' == 'true' " Include="PublishSingleFile" />
  <ProjectCapability Condition=" 'PublishReadyToRun' == 'true' " Include="PublishReadyToRun" />
<ItemGroup>

It's important to ensure these items are added early enough in the core targets such that by the time the C# and C# Dev Kit extensions in VS Code report the relevant "project initialized" events, the project capabilities are included in the set reported for the project.

/Cc @agocke @baronfel

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions