microsoft / ApplicationInsights-Profiler-AspNetCore

Application Insights Profiler sample and documentation
MIT License
66 stars 23 forks source link

Trace Uploader is not located in .NET Core 5.0 application #143

Closed xiaomi7732 closed 2 years ago

xiaomi7732 commented 2 years ago

TraceUploader.zip has been supposed to be flatten into the target bin folder by design.

It appears that flatten wasn't honored pre .NET 5.0, and the TraceUploader.zip has been extracted to bin/**ServiceProfiler**/, and the search of the file has been using that; However, in late version of .NET 5.0, it is honored, and thus TraceUploader.zip can't be found anymore.

2.3.0-beta3 addressed the issue by searching both bin and bin/ServiceProfiler for zipped uploader. Any higher version will have the fix.

Workaround for packages before 2.3.0-beta3 on .NET 5, please manually copy TraceUploader.zip to bin/ServiceProfiler folder.

xiaomi7732 commented 2 years ago

Thanks to my colleague. Here's an MSBuild post build trick for a work-around:

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
    <Copy SourceFiles="$(OutputPath)\TraceUpload.zip" DestinationFolder="$(OutputPath)\ServiceProfiler\"/>
</Target>