Skip to content

Commit ff172e2

Browse files
DotNetDumpComponent: add global .NET tools dir to PATH
The `dotnet tool install --global` shim is placed in %USERPROFILE%\.dotnet\tools, which was not on PATH, so `dotnet-dump` was not callable by name during container runs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d3afddd commit ff172e2

5 files changed

Lines changed: 32 additions & 18 deletions

File tree

eng/docker/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ RUN & .\dotnet-install.ps1 -Version 9.0.310 -InstallDir 'C:\Program Files\dotnet
6565
# .NET Dump Tool
6666
RUN dotnet tool install --global dotnet-dump;
6767

68+
ENV PATH="C:\Users\ContainerAdministrator\.dotnet\tools;${PATH}"
69+
6870

6971
# Epilogue
7072
# Create directories for mountpoints

eng/docker/Dockerfile.claude

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ RUN & .\dotnet-install.ps1 -Version 9.0.310 -InstallDir 'C:\Program Files\dotnet
6565
# .NET Dump Tool
6666
RUN dotnet tool install --global dotnet-dump;
6767

68+
ENV PATH="C:\Users\ContainerAdministrator\.dotnet\tools;${PATH}"
69+
6870

6971
# Install Node.js
7072
RUN Invoke-WebRequest -Uri "https://nodejs.org/dist/v22.0.0/node-v22.0.0-win-x64.zip" -OutFile node.zip; `

eng/docker/Dockerfile.claude.win2022

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ RUN & .\dotnet-install.ps1 -Version 9.0.310 -InstallDir 'C:\Program Files\dotnet
6565
# .NET Dump Tool
6666
RUN dotnet tool install --global dotnet-dump;
6767

68+
ENV PATH="C:\Users\ContainerAdministrator\.dotnet\tools;${PATH}"
69+
6870

6971
# Install Node.js
7072
RUN Invoke-WebRequest -Uri "https://nodejs.org/dist/v22.0.0/node-v22.0.0-win-x64.zip" -OutFile node.zip; `

eng/docker/Dockerfile.win2022

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ RUN & .\dotnet-install.ps1 -Version 9.0.310 -InstallDir 'C:\Program Files\dotnet
6565
# .NET Dump Tool
6666
RUN dotnet tool install --global dotnet-dump;
6767

68+
ENV PATH="C:\Users\ContainerAdministrator\.dotnet\tools;${PATH}"
69+
6870

6971
# Epilogue
7072
# Create directories for mountpoints
Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
1-
// Copyright (c) SharpCrafters s.r.o. See the LICENSE.md file in the root directory of this repository root for details.
2-
3-
using JetBrains.Annotations;
4-
using System.IO;
5-
6-
namespace PostSharp.Engineering.BuildTools.Docker;
7-
8-
[PublicAPI]
9-
public sealed class DotNetDumpComponent : ContainerComponent
10-
{
11-
public override string Name => ".NET Dump Tool";
12-
13-
public override ContainerComponentKind Kind => ContainerComponentKind.DotNetDump;
14-
15-
public override void WriteDockerfile( TextWriter writer, ContainerOperatingSystem operatingSystem )
16-
{
17-
writer.WriteLine( "RUN dotnet tool install --global dotnet-dump;" );
18-
}
1+
// Copyright (c) SharpCrafters s.r.o. See the LICENSE.md file in the root directory of this repository root for details.
2+
3+
using JetBrains.Annotations;
4+
using System.IO;
5+
6+
namespace PostSharp.Engineering.BuildTools.Docker;
7+
8+
[PublicAPI]
9+
public sealed class DotNetDumpComponent : ContainerComponent
10+
{
11+
public override string Name => ".NET Dump Tool";
12+
13+
public override ContainerComponentKind Kind => ContainerComponentKind.DotNetDump;
14+
15+
public override void WriteDockerfile( TextWriter writer, ContainerOperatingSystem operatingSystem )
16+
{
17+
writer.WriteLine( "RUN dotnet tool install --global dotnet-dump;" );
18+
19+
// The `dotnet tool install --global` shim is placed in %USERPROFILE%\.dotnet\tools, which is
20+
// not on PATH by default. Add it so the tool (and any other globally installed .NET tools)
21+
// is callable by name during container runs.
22+
writer.WriteLine();
23+
writer.WriteLine( """ENV PATH="C:\Users\ContainerAdministrator\.dotnet\tools;${PATH}" """.TrimEnd() );
24+
}
1925
}

0 commit comments

Comments
 (0)