Skip to content

Commit

Permalink
Review the readme
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaomi7732 committed May 26, 2022
1 parent 383e23c commit a8ca158
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
11 changes: 8 additions & 3 deletions examples/ReReleaseNuGet/Readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Re-releasing Profiler.ASPNetCore package

It is common to have shared library in a solution. This example describes how to properly build a NuGet package of your own that carries profiler assets and could be shared across your own solution.
It is common to have shared library in a solution. This example describes how to properly build a NuGet package of your own that carries profiler assets and could be reused across your own solution.

In this example, there are 2 projects, `WebAPI` is client project, that's the project we turn profiler on. `SharedLib` will be built into a NuGet package to simulate whatever the common package your want to build, with Profiler enabled. As per the `PackageId` property in [SharedLib.csproj](./SharedLib/SharedLib.csproj), it will be built into `ProfilerExample.SharedLib.1.0.0.nupkg`.

Expand All @@ -12,7 +12,7 @@ ProfilerExample.SharedLib(NuGet) --> Microsoft.ApplicationInsights.Profiler.AspN
Microsoft.ApplicationInsights.Profiler.AspNetCore(NuGet) --> [*]
```

Here's a recommended way to enable Profiler in `ProfilerExample.SharedLib` package:
Here's a recommendation:

## Add reference to NuGet package

Expand All @@ -35,6 +35,8 @@ Here's a recommended way to enable Profiler in `ProfilerExample.SharedLib` packa
</PackageReference>
</ItemGroup>
```
Refer to [SharedLib.csproj](./SharedLib/SharedLib.csproj) for details. The key is to setup `<PrivateAssets>analyzers;build</PrivateAssets>` to exclude the `contentFiles` from private assets.

_Tips: You might want to reference `Microsoft.ApplicationInsights.AspNetCore` in your shared project as well._

## Verify it works
Expand Down Expand Up @@ -66,5 +68,8 @@ Here's a recommended way to enable Profiler in `ProfilerExample.SharedLib` packa

1. Check that the file of `TraceUpload.zip` is included in the header project output at: `bin/Debug/net6.0/TraceUploader.zip`

1. In any header project, you can follow the other instructions to enable profiler in your header project now. There is NO need to reference it again.
1. In any header project, without reference profiler package again, you can then follow the other instructions to enable profiler.

## Feedback

If you have suggestions or if there is any questions, problems, please [file an issue](https://github.com/microsoft/ApplicationInsights-Profiler-AspNetCore/issues).
11 changes: 3 additions & 8 deletions examples/ReReleaseNuGet/SharedLib/SharedLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,13 @@
</PropertyGroup>

<ItemGroup>
<!-- This will not pass the contentFiles through -->
<!-- <PackageReference Include="Microsoft.ApplicationInsights.Profiler.AspNetCore" Version="2.*" /> -->
<!-- ~~ -->

<!-- This will pass contentFiles through -->
<!-- Default is contentfiles;analyzers;build as per: -->
<!-- https://docs.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files#controlling-dependency-assets -->

<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.20.0" />

<PackageReference Include="Microsoft.ApplicationInsights.Profiler.AspNetCore" Version="2.*">
<PrivateAssets>analyzers;build</PrivateAssets>
</PackageReference>

<!-- This is not required. Decide by your scenario whether you want to carry the latest application insights for ASP.NET Core or not -->
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.20.0" />
</ItemGroup>
</Project>

0 comments on commit a8ca158

Please sign in to comment.