Skip to content

Commit

Permalink
Ensure contentFiles are unobtrusive in code editors (#3538)
Browse files Browse the repository at this point in the history
Ensure contentFiles are unobtrusive in code editors

This ensures the instrumentation scripts are not visible users projects when they reference `OpenTelemetry.AutoInstrumentation`.

This makes the manual installation route slightly less unobtrusive as we don't clutter anyones editor with instrumentation.sh and instrumentation.cmd.

These files will still be published to output and publish directories.

The props file is only necessary until NuGet/Home#4856 gets resolved.

See: https://learn.microsoft.com/en-us/nuget/concepts/msbuild-props-and-targets for more background on how $PROJECT.props file affect nuget installations.
  • Loading branch information
Mpdreamz authored Jul 26, 2024
1 parent 1b4a9ab commit 2279c0f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ This component adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.h

### Changed

- Referencing `OpenTelemetry.AutoInstrumentation` manually no longer visibly injects
instrumentation scripts into projects in an editor's solution window.

#### Dependency updates

- Following packages updated
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Hide the shipped content files VS project tree.
Can be removed once https://github.com/NuGet/Home/issues/4856 is resolved -->
<ItemGroup>
<Content Update="@(Content)">
<Visible Condition="'%(NuGetItemType)' == 'Content' and '%(NuGetPackageId)' == 'opentelemetry.autoinstrumentation'">False</Visible>
<CopyToOutputDirectory Condition="'%(NuGetItemType)' == 'Content' and '%(NuGetPackageId)' == 'opentelemetry.autoinstrumentation'">Always</CopyToOutputDirectory>
<CopyToPublishDirectory Condition="'%(NuGetItemType)' == 'Content' and '%(NuGetPackageId)' == 'opentelemetry.autoinstrumentation'">Always</CopyToPublishDirectory>
</Content>
</ItemGroup>
</Project>

0 comments on commit 2279c0f

Please sign in to comment.