diff options
Diffstat (limited to 'src/wix/WixToolset.BuildTasks/ToolsetTask.cs')
| -rw-r--r-- | src/wix/WixToolset.BuildTasks/ToolsetTask.cs | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/wix/WixToolset.BuildTasks/ToolsetTask.cs b/src/wix/WixToolset.BuildTasks/ToolsetTask.cs index 05095fb8..7d4a7687 100644 --- a/src/wix/WixToolset.BuildTasks/ToolsetTask.cs +++ b/src/wix/WixToolset.BuildTasks/ToolsetTask.cs | |||
| @@ -9,10 +9,11 @@ namespace WixToolset.BuildTasks | |||
| 9 | 9 | ||
| 10 | public abstract partial class ToolsetTask : ToolTask | 10 | public abstract partial class ToolsetTask : ToolTask |
| 11 | { | 11 | { |
| 12 | #if NETFRAMEWORK | 12 | #if NETCOREAPP |
| 13 | private static readonly string ThisDllPath = new Uri(typeof(ToolsetTask).Assembly.CodeBase).AbsolutePath; | 13 | private static readonly string DotnetFullPath = Environment.GetEnvironmentVariable("DOTNET_HOST_PATH") ?? "dotnet"; |
| 14 | #else | ||
| 15 | private static readonly string ThisDllPath = typeof(ToolsetTask).Assembly.Location; | 14 | private static readonly string ThisDllPath = typeof(ToolsetTask).Assembly.Location; |
| 15 | #else | ||
| 16 | private static readonly string ThisDllPath = new Uri(typeof(ToolsetTask).Assembly.CodeBase).AbsolutePath; | ||
| 16 | #endif | 17 | #endif |
| 17 | 18 | ||
| 18 | /// <summary> | 19 | /// <summary> |
| @@ -84,19 +85,19 @@ namespace WixToolset.BuildTasks | |||
| 84 | /// </remarks> | 85 | /// </remarks> |
| 85 | protected sealed override string GenerateFullPathToTool() | 86 | protected sealed override string GenerateFullPathToTool() |
| 86 | { | 87 | { |
| 87 | #if !NETCOREAPP | 88 | #if NETCOREAPP |
| 89 | if (IsSelfExecutable(this.DefaultToolFullPath, out var toolFullPath)) | ||
| 90 | { | ||
| 91 | return toolFullPath; | ||
| 92 | } | ||
| 93 | return DotnetFullPath; | ||
| 94 | #else | ||
| 88 | if (!this.RunAsSeparateProcess) | 95 | if (!this.RunAsSeparateProcess) |
| 89 | { | 96 | { |
| 90 | // We need to return a path that exists, so if we're not actually going to run the tool then just return this dll path. | 97 | // We need to return a path that exists, so if we're not actually going to run the tool then just return this dll path. |
| 91 | return ThisDllPath; | 98 | return ThisDllPath; |
| 92 | } | 99 | } |
| 93 | return this.DefaultToolFullPath; | 100 | return this.DefaultToolFullPath; |
| 94 | #else | ||
| 95 | if (IsSelfExecutable(this.DefaultToolFullPath, out var toolFullPath)) | ||
| 96 | { | ||
| 97 | return toolFullPath; | ||
| 98 | } | ||
| 99 | return DotnetFullPath; | ||
| 100 | #endif | 101 | #endif |
| 101 | } | 102 | } |
| 102 | 103 | ||
| @@ -124,8 +125,6 @@ namespace WixToolset.BuildTasks | |||
| 124 | } | 125 | } |
| 125 | 126 | ||
| 126 | #if NETCOREAPP | 127 | #if NETCOREAPP |
| 127 | private static readonly string DotnetFullPath = Environment.GetEnvironmentVariable("DOTNET_HOST_PATH") ?? "dotnet"; | ||
| 128 | |||
| 129 | protected override string GenerateCommandLineCommands() | 128 | protected override string GenerateCommandLineCommands() |
| 130 | { | 129 | { |
| 131 | if (IsSelfExecutable(this.ToolFullPath, out var toolFullPath)) | 130 | if (IsSelfExecutable(this.ToolFullPath, out var toolFullPath)) |
