diff --git a/src/dotnet/commands/dotnet-tool/list/LocalizableStrings.resx b/src/dotnet/commands/dotnet-tool/list/LocalizableStrings.resx
index 852ca839b..0ae133e98 100644
--- a/src/dotnet/commands/dotnet-tool/list/LocalizableStrings.resx
+++ b/src/dotnet/commands/dotnet-tool/list/LocalizableStrings.resx
@@ -144,4 +144,7 @@
Commands
+
+ Tool path '{0}' does not exist.
+
diff --git a/src/dotnet/commands/dotnet-tool/list/ToolListCommand.cs b/src/dotnet/commands/dotnet-tool/list/ToolListCommand.cs
index df7616089..ca899c047 100644
--- a/src/dotnet/commands/dotnet-tool/list/ToolListCommand.cs
+++ b/src/dotnet/commands/dotnet-tool/list/ToolListCommand.cs
@@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
using Microsoft.DotNet.Cli;
using Microsoft.DotNet.Cli.CommandLine;
@@ -44,6 +45,14 @@ namespace Microsoft.DotNet.Tools.Tool.List
DirectoryPath? toolPath = null;
if (!string.IsNullOrWhiteSpace(toolPathOption))
{
+ if (!Directory.Exists(toolPathOption))
+ {
+ throw new GracefulException(
+ string.Format(
+ LocalizableStrings.InvalidToolPathOption,
+ toolPathOption));
+ }
+
toolPath = new DirectoryPath(toolPathOption);
}
diff --git a/src/dotnet/commands/dotnet-tool/list/xlf/LocalizableStrings.cs.xlf b/src/dotnet/commands/dotnet-tool/list/xlf/LocalizableStrings.cs.xlf
index 2885762cc..6538e2d55 100644
--- a/src/dotnet/commands/dotnet-tool/list/xlf/LocalizableStrings.cs.xlf
+++ b/src/dotnet/commands/dotnet-tool/list/xlf/LocalizableStrings.cs.xlf
@@ -47,6 +47,11 @@
(--global) conflicts with the tool path option (--tool-path). Please specify only one of the options.
+
+ Tool path '{0}' does not exist.
+ Tool path '{0}' does not exist.
+
+