diff --git a/src/NuGet.Clients/NuGet.Tools/Commands/ClearNuGetLocalResourcesCommand.cs b/src/NuGet.Clients/NuGet.Tools/Commands/ClearNuGetLocalResourcesCommand.cs
index 11ec1d011c4..1a04afd60a1 100644
--- a/src/NuGet.Clients/NuGet.Tools/Commands/ClearNuGetLocalResourcesCommand.cs
+++ b/src/NuGet.Clients/NuGet.Tools/Commands/ClearNuGetLocalResourcesCommand.cs
@@ -91,7 +91,7 @@ private void ExecuteClearNuGetLocalResourcesCommand(object sender, EventArgs e)
}
finally
{
- OutputConsoleLogger.End();
+ OutputConsoleLogger.End(bringErrorListToFrontIfSettingsPermit: false);
}
}).PostOnFailure(nameof(NuGetPackage), nameof(ExecuteClearNuGetLocalResourcesCommand));
}
@@ -111,7 +111,7 @@ public async Task ClearNuGetLocalsCommandExecuteAsync()
}
finally
{
- OutputConsoleLogger.End();
+ OutputConsoleLogger.End(bringErrorListToFrontIfSettingsPermit: false);
}
}
diff --git a/src/NuGet.Clients/NuGet.VisualStudio.Common/OutputConsoleLogger.cs b/src/NuGet.Clients/NuGet.VisualStudio.Common/OutputConsoleLogger.cs
index fc41e81e9e1..e7a9f76fa21 100644
--- a/src/NuGet.Clients/NuGet.VisualStudio.Common/OutputConsoleLogger.cs
+++ b/src/NuGet.Clients/NuGet.VisualStudio.Common/OutputConsoleLogger.cs
@@ -98,14 +98,22 @@ await _semaphore.ExecuteAsync(async () =>
}
public void End()
+ {
+ End(bringErrorListToFrontIfSettingsPermit: true);
+ }
+
+ public void End(bool bringErrorListToFrontIfSettingsPermit)
{
Run(async () =>
{
await _outputConsole.WriteLineAsync(Resources.Finished);
await _outputConsole.WriteLineAsync(string.Empty);
- // Give the error list focus
- await _errorList.Value.BringToFrontIfSettingsPermitAsync();
+ if (bringErrorListToFrontIfSettingsPermit)
+ {
+ // Give the error list focus
+ await _errorList.Value.BringToFrontIfSettingsPermitAsync();
+ }
});
}
diff --git a/src/NuGet.Clients/NuGet.VisualStudio.Common/UserInterfaceService/INuGetUILogger.cs b/src/NuGet.Clients/NuGet.VisualStudio.Common/UserInterfaceService/INuGetUILogger.cs
index 6b1ad7594ab..b2a9b2a0ee2 100644
--- a/src/NuGet.Clients/NuGet.VisualStudio.Common/UserInterfaceService/INuGetUILogger.cs
+++ b/src/NuGet.Clients/NuGet.VisualStudio.Common/UserInterfaceService/INuGetUILogger.cs
@@ -31,5 +31,8 @@ public interface INuGetUILogger
/// End the logging.
void End();
+
+ /// End the logging without possibly showing the Error List.
+ void End(bool bringErrorListToFrontIfSettingsPermit);
}
}