From 8c49d85e1bb225cb3249cc571c213288150a6049 Mon Sep 17 00:00:00 2001 From: Ashley Hauck Date: Wed, 4 Oct 2017 12:48:33 -0700 Subject: [PATCH] Fix build issue --- src/Compilers/Core/MSBuildTask/DotnetHost.cs | 11 ++++------- src/Compilers/Core/MSBuildTask/InteractiveCompiler.cs | 3 ++- src/Compilers/Core/MSBuildTask/ManagedCompiler.cs | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Compilers/Core/MSBuildTask/DotnetHost.cs b/src/Compilers/Core/MSBuildTask/DotnetHost.cs index 1f86f499189..5dd76c20b9c 100644 --- a/src/Compilers/Core/MSBuildTask/DotnetHost.cs +++ b/src/Compilers/Core/MSBuildTask/DotnetHost.cs @@ -32,16 +32,13 @@ public static DotnetHost CreateManagedToolInvocation(string toolName, string com { var pathToToolOpt = Utilities.GenerateFullPathToTool(toolName); // Desktop executes tool directly, only prepend if we're on CLI - if (IsCliHost(out string pathToDotnet)) + if (pathToToolOpt != null && IsCliHost(out string pathToDotnet)) { - if (pathToToolOpt != null) - { - commandLineArgs = PrependFileToArgs(pathToToolOpt, commandLineArgs); - pathToToolOpt = pathToDotnet; - } + commandLineArgs = PrependFileToArgs(pathToToolOpt, commandLineArgs); + pathToToolOpt = pathToDotnet; } - return new DotnetHost(toolName, pathToToolOpt, commandLineArgs, isManagedTool: true); + return new DotnetHost(pathToToolOpt, commandLineArgs, isManagedTool: true); } private static bool IsCliHost(out string pathToDotnet) diff --git a/src/Compilers/Core/MSBuildTask/InteractiveCompiler.cs b/src/Compilers/Core/MSBuildTask/InteractiveCompiler.cs index 8b165458822..f51bc2f7304 100644 --- a/src/Compilers/Core/MSBuildTask/InteractiveCompiler.cs +++ b/src/Compilers/Core/MSBuildTask/InteractiveCompiler.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System.IO; using System.Linq; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; @@ -201,7 +202,7 @@ private DotnetHost DotnetHostInfo { // Explicitly provided ToolPath or ToolExe, don't try to // figure anything out - _dotnetHostInfo = DotnetHost.CreateNativeToolInvocation(ToolName, Path.Combine(ToolPath, ToolExe), commandLine); + _dotnetHostInfo = DotnetHost.CreateNativeToolInvocation(Path.Combine(ToolPath, ToolExe), commandLine); } } return _dotnetHostInfo; diff --git a/src/Compilers/Core/MSBuildTask/ManagedCompiler.cs b/src/Compilers/Core/MSBuildTask/ManagedCompiler.cs index d20477e3988..6d0a2ce5875 100644 --- a/src/Compilers/Core/MSBuildTask/ManagedCompiler.cs +++ b/src/Compilers/Core/MSBuildTask/ManagedCompiler.cs @@ -431,7 +431,7 @@ private DotnetHost DotnetHostInfo { // Explicitly provided ToolPath or ToolExe, don't try to // figure anything out - _dotnetHostInfo = DotnetHost.CreateUnmanagedToolInvocation(ToolName, Path.Combine(ToolPath, ToolExe), commandLine); + _dotnetHostInfo = DotnetHost.CreateNativeToolInvocation(Path.Combine(ToolPath, ToolExe), commandLine); } } return _dotnetHostInfo; -- GitLab