dotnet / diagnostics

This repository contains the source code for various .NET Core runtime diagnostic tools and documents.
MIT License
1.18k stars 354 forks source link

Publish self-contained Diagnostic Tools #2277

Open calanchenlins opened 3 years ago

calanchenlins commented 3 years ago

We publish DotNetCore App on production environments with self-contained. In order to use diagnostic tools we must install runtime on PROD server or client computer. Any plans to release these tools with self-contained mode?

mikem8361 commented 3 years ago

@hoyosjs @josalem where is the doc on our self-contained tool install?

josalem commented 3 years ago

All the current shipping vehicles for the diagnostics tools require an externally installed runtime.

We've looked at doing a self-contained version of the tools, but the size per tool started to get large even with trimming.

I don't think this will be done in the immediate future due to our existing backlog, but it is something we want to do at some point.

In the meantime, you can build the tools from source as self-contained deployments and copy/paste the output to your production environment. Let me know if you want some guidance on that 😄

calanchenlins commented 3 years ago

All the current shipping vehicles for the diagnostics tools require an externally installed runtime.

We've looked at doing a self-contained version of the tools, but the size per tool started to get large even with trimming.

I don't think this will be done in the immediate future due to our existing backlog, but it is something we want to do at some point.

In the meantime, you can build the tools from source as self-contained deployments and copy/paste the output to your production environment. Let me know if you want some guidance on that 😄

It's complicated for me to publish from source code. When I run command: dotnet publish /p:BundleTools=false -c Release -r linux-x64 in /src/Tools/dotnet-counters directory, it shows error NETSDK1053: pack as tool don't support self-contained. If I copy Microsoft.Diagnostics.NETCore.Client、dotnet-counters project and relevant document to other directory, Specify the package version,edit .csproj file. publish command with self-contained will Execute successfully. It would be good if you could give me some guidance.

hoyosjs commented 3 years ago

@calanchenlins counters is an easier one to do in that sense. dotnet-dump and dotnet-sos might require a little more work.

Mind you, each one is 70 mb.

For example, patch for Windows x64 tools except for dotnet-sos and dotnet-dump ```diff diff --git a/src/Tools/Directory.Build.props b/src/Tools/Directory.Build.props index 0a0925bf..faa1d9d6 100644 --- a/src/Tools/Directory.Build.props +++ b/src/Tools/Directory.Build.props @@ -10,10 +10,10 @@ - false + true $(BundledToolsPath)$(Configuration)\$(RuntimeIdentifier)\ true - $(SelfContained) + false diff --git a/src/singlefile-tools.proj b/src/singlefile-tools.proj index 5435072a..89896e08 100644 --- a/src/singlefile-tools.proj +++ b/src/singlefile-tools.proj @@ -2,7 +2,7 @@ netcoreapp3.1 - win-x64;win-x86;win-arm;win-arm64;linux-x64;linux-musl-arm64;osx-x64;linux-arm64;linux-musl-x64;linux-arm + win-x64 $([System.IO.Path]::GetDirectoryName('$(ArcadeSdkBuildTasksAssembly)'))\..\ $(ArcadeSdkMSBuildProjectDir)Sign.proj $(BundledToolsPath)$(Configuration)/zips/ @@ -10,7 +10,7 @@ - <_ProjectToBundle Include="$(RepoRoot)src/Tools/**/*.csproj" Exclude="$(RepoRoot)src/Tools/dotnet-monitor/**/*.csproj;$(RepoRoot)src/Tools/dotnet-analyze/**/*.csproj" /> + <_ProjectToBundle Include="$(RepoRoot)src/Tools/**/*.csproj" Exclude="$(RepoRoot)src/Tools/dotnet-sos/**/*.csproj;$(RepoRoot)src/Tools/dotnet-dump/**/*.csproj" /> ```
calanchenlins commented 3 years ago

@hoyosjs Thanks for your guidance! Through your method I have published successfully.