From 17688d209109ce0db78ff2036cc549fe28d5a86f Mon Sep 17 00:00:00 2001 From: Cory Rivera Date: Wed, 8 Mar 2023 12:05:07 -0800 Subject: [PATCH] Use full path to global dotnet tools when starting SQL and Kusto services. --- src/Microsoft.DotNet.Interactive.Kql/KqlKernelExtension.cs | 7 +++++-- .../MsSqlKernelExtension.cs | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.DotNet.Interactive.Kql/KqlKernelExtension.cs b/src/Microsoft.DotNet.Interactive.Kql/KqlKernelExtension.cs index 178d53813d..eb102ea612 100644 --- a/src/Microsoft.DotNet.Interactive.Kql/KqlKernelExtension.cs +++ b/src/Microsoft.DotNet.Interactive.Kql/KqlKernelExtension.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using System.IO; using System.Threading.Tasks; using Microsoft.AspNetCore.Html; using Microsoft.DotNet.Interactive.SqlServer; @@ -13,11 +14,13 @@ public async Task OnLoadAsync(Kernel kernel) { if (kernel is CompositeKernel compositeKernel) { - var kqlToolName = "MicrosoftKustoServiceLayer"; + var kqlToolName = "MicrosoftKustoServiceLayer"; await Utils.CheckAndInstallGlobalToolAsync(kqlToolName, "1.2.0", "Microsoft.SqlServer.KustoServiceLayer.Tool"); + var userFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.UserProfile); + var kqlToolPath = Path.Join(userFolder, ".dotnet", "tools", kqlToolName); compositeKernel - .AddKernelConnector(new ConnectKqlCommand(kqlToolName)); + .AddKernelConnector(new ConnectKqlCommand(kqlToolPath)); KernelInvocationContext.Current?.Display( new HtmlString(@"
Query Microsoft Kusto Server databases. diff --git a/src/Microsoft.DotNet.Interactive.SqlServer/MsSqlKernelExtension.cs b/src/Microsoft.DotNet.Interactive.SqlServer/MsSqlKernelExtension.cs index 8caa30307a..f4700a8acb 100644 --- a/src/Microsoft.DotNet.Interactive.SqlServer/MsSqlKernelExtension.cs +++ b/src/Microsoft.DotNet.Interactive.SqlServer/MsSqlKernelExtension.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using System.IO; using System.Threading.Tasks; using Microsoft.AspNetCore.Html; @@ -15,8 +16,10 @@ public async Task OnLoadAsync(Kernel kernel) var sqlToolName = "MicrosoftSqlToolsServiceLayer"; await Utils.CheckAndInstallGlobalToolAsync(sqlToolName, "1.2.0", "Microsoft.SqlServer.SqlToolsServiceLayer.Tool"); + var userFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.UserProfile); + var sqlToolPath = Path.Join(userFolder, ".dotnet", "tools", sqlToolName); compositeKernel - .AddKernelConnector(new ConnectMsSqlCommand(sqlToolName)); + .AddKernelConnector(new ConnectMsSqlCommand(sqlToolPath)); compositeKernel .SubmissionParser