aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.BuildTasks
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.BuildTasks')
-rw-r--r--src/WixToolset.BuildTasks/HeatTask_InProc.cs2
-rw-r--r--src/WixToolset.BuildTasks/MsbuildMessageListener.cs2
-rw-r--r--src/WixToolset.BuildTasks/ToolsetTask.cs49
-rw-r--r--src/WixToolset.BuildTasks/ToolsetTask_InProc.cs2
-rw-r--r--src/WixToolset.BuildTasks/WixBuild_InProc.cs2
-rw-r--r--src/WixToolset.BuildTasks/WixToolset.BuildTasks.csproj11
6 files changed, 59 insertions, 9 deletions
diff --git a/src/WixToolset.BuildTasks/HeatTask_InProc.cs b/src/WixToolset.BuildTasks/HeatTask_InProc.cs
index 8190d9e2..eb6feafc 100644
--- a/src/WixToolset.BuildTasks/HeatTask_InProc.cs
+++ b/src/WixToolset.BuildTasks/HeatTask_InProc.cs
@@ -1,5 +1,6 @@
1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. 1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2 2
3#if !NETCOREAPP
3namespace WixToolset.BuildTasks 4namespace WixToolset.BuildTasks
4{ 5{
5 using WixToolset.Extensibility; 6 using WixToolset.Extensibility;
@@ -25,3 +26,4 @@ namespace WixToolset.BuildTasks
25 } 26 }
26 } 27 }
27} 28}
29#endif
diff --git a/src/WixToolset.BuildTasks/MsbuildMessageListener.cs b/src/WixToolset.BuildTasks/MsbuildMessageListener.cs
index 47399a41..f186d721 100644
--- a/src/WixToolset.BuildTasks/MsbuildMessageListener.cs
+++ b/src/WixToolset.BuildTasks/MsbuildMessageListener.cs
@@ -1,5 +1,6 @@
1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. 1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2 2
3#if !NETCOREAPP
3namespace WixToolset.BuildTasks 4namespace WixToolset.BuildTasks
4{ 5{
5 using System; 6 using System;
@@ -64,3 +65,4 @@ namespace WixToolset.BuildTasks
64 public MessageLevel CalculateMessageLevel(IMessaging messaging, Message message, MessageLevel defaultMessageLevel) => defaultMessageLevel; 65 public MessageLevel CalculateMessageLevel(IMessaging messaging, Message message, MessageLevel defaultMessageLevel) => defaultMessageLevel;
65 } 66 }
66} 67}
68#endif
diff --git a/src/WixToolset.BuildTasks/ToolsetTask.cs b/src/WixToolset.BuildTasks/ToolsetTask.cs
index 4fd7af3f..94d007f0 100644
--- a/src/WixToolset.BuildTasks/ToolsetTask.cs
+++ b/src/WixToolset.BuildTasks/ToolsetTask.cs
@@ -4,10 +4,13 @@ namespace WixToolset.BuildTasks
4{ 4{
5 using System; 5 using System;
6 using System.IO; 6 using System.IO;
7 using System.Runtime.InteropServices;
7 using Microsoft.Build.Utilities; 8 using Microsoft.Build.Utilities;
8 9
9 public abstract partial class ToolsetTask : ToolTask 10 public abstract partial class ToolsetTask : ToolTask
10 { 11 {
12 private static readonly string ThisDllPath = new Uri(typeof(ToolsetTask).Assembly.CodeBase).AbsolutePath;
13
11 /// <summary> 14 /// <summary>
12 /// Gets or sets additional options that are appended the the tool command-line. 15 /// Gets or sets additional options that are appended the the tool command-line.
13 /// </summary> 16 /// </summary>
@@ -53,6 +56,8 @@ namespace WixToolset.BuildTasks
53 /// </summary> 56 /// </summary>
54 public bool VerboseOutput { get; set; } 57 public bool VerboseOutput { get; set; }
55 58
59 private string ToolFullPath => Path.Combine(Path.GetDirectoryName(ThisDllPath), this.ToolExe);
60
56 /// <summary> 61 /// <summary>
57 /// Get the path to the executable. 62 /// Get the path to the executable.
58 /// </summary> 63 /// </summary>
@@ -63,13 +68,20 @@ namespace WixToolset.BuildTasks
63 /// </remarks> 68 /// </remarks>
64 protected sealed override string GenerateFullPathToTool() 69 protected sealed override string GenerateFullPathToTool()
65 { 70 {
66 var thisDllPath = new Uri(typeof(ToolsetTask).Assembly.CodeBase).AbsolutePath; 71#if !NETCOREAPP
67 if (!this.RunAsSeparateProcess) 72 if (!this.RunAsSeparateProcess)
68 { 73 {
69 // 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. 74 // 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.
70 return thisDllPath; 75 return ThisDllPath;
71 } 76 }
72 return Path.Combine(Path.GetDirectoryName(thisDllPath), this.ToolExe); 77 return this.ToolFullPath;
78#else
79 if (IsSelfExecutable(this.ToolFullPath, out var toolFullPath))
80 {
81 return toolFullPath;
82 }
83 return DotnetFullPath;
84#endif
73 } 85 }
74 86
75 protected sealed override string GenerateResponseFileCommands() 87 protected sealed override string GenerateResponseFileCommands()
@@ -94,5 +106,36 @@ namespace WixToolset.BuildTasks
94 commandLineBuilder.AppendArrayIfNotNull("-wx ", this.TreatSpecificWarningsAsErrors); 106 commandLineBuilder.AppendArrayIfNotNull("-wx ", this.TreatSpecificWarningsAsErrors);
95 commandLineBuilder.AppendIfTrue("-wx", this.TreatWarningsAsErrors); 107 commandLineBuilder.AppendIfTrue("-wx", this.TreatWarningsAsErrors);
96 } 108 }
109
110#if NETCOREAPP
111 private static readonly string DotnetFullPath = Environment.GetEnvironmentVariable("DOTNET_HOST_PATH") ?? "dotnet";
112
113 protected override string GenerateCommandLineCommands()
114 {
115 if (IsSelfExecutable(this.ToolFullPath, out var toolFullPath))
116 {
117 return null;
118 }
119 else
120 {
121 return $"exec \"{toolFullPath}\"";
122 }
123 }
124
125 private static bool IsSelfExecutable(string proposedToolFullPath, out string toolFullPath)
126 {
127 var toolFullPathWithoutExtension = Path.Combine(Path.GetDirectoryName(proposedToolFullPath), Path.GetFileNameWithoutExtension(proposedToolFullPath));
128 var exeExtension = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : String.Empty;
129 var exeToolFullPath = $"{toolFullPathWithoutExtension}{exeExtension}";
130 if (File.Exists(exeToolFullPath))
131 {
132 toolFullPath = exeToolFullPath;
133 return true;
134 }
135
136 toolFullPath = $"{toolFullPathWithoutExtension}.dll";
137 return false;
138 }
139#endif
97 } 140 }
98} 141}
diff --git a/src/WixToolset.BuildTasks/ToolsetTask_InProc.cs b/src/WixToolset.BuildTasks/ToolsetTask_InProc.cs
index 4b365b2a..a3290e60 100644
--- a/src/WixToolset.BuildTasks/ToolsetTask_InProc.cs
+++ b/src/WixToolset.BuildTasks/ToolsetTask_InProc.cs
@@ -1,5 +1,6 @@
1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. 1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2 2
3#if !NETCOREAPP
3namespace WixToolset.BuildTasks 4namespace WixToolset.BuildTasks
4{ 5{
5 using System; 6 using System;
@@ -69,3 +70,4 @@ namespace WixToolset.BuildTasks
69 protected abstract string TaskShortName { get; } 70 protected abstract string TaskShortName { get; }
70 } 71 }
71} 72}
73#endif
diff --git a/src/WixToolset.BuildTasks/WixBuild_InProc.cs b/src/WixToolset.BuildTasks/WixBuild_InProc.cs
index 8e9f2fec..49148c8a 100644
--- a/src/WixToolset.BuildTasks/WixBuild_InProc.cs
+++ b/src/WixToolset.BuildTasks/WixBuild_InProc.cs
@@ -1,5 +1,6 @@
1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. 1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2 2
3#if !NETCOREAPP
3namespace WixToolset.BuildTasks 4namespace WixToolset.BuildTasks
4{ 5{
5 using WixToolset.Data; 6 using WixToolset.Data;
@@ -51,3 +52,4 @@ namespace WixToolset.BuildTasks
51 } 52 }
52 } 53 }
53} 54}
55#endif
diff --git a/src/WixToolset.BuildTasks/WixToolset.BuildTasks.csproj b/src/WixToolset.BuildTasks/WixToolset.BuildTasks.csproj
index 221478ed..6709949e 100644
--- a/src/WixToolset.BuildTasks/WixToolset.BuildTasks.csproj
+++ b/src/WixToolset.BuildTasks/WixToolset.BuildTasks.csproj
@@ -18,19 +18,18 @@
18 </PropertyGroup> 18 </PropertyGroup>
19 19
20 <ItemGroup> 20 <ItemGroup>
21 <ProjectReference Include="..\WixToolset.Tools.Core\WixToolset.Tools.Core.csproj" /> 21 <PackageReference Include="WixToolset.Dtf.WindowsInstaller" Version="4.0.*" />
22 </ItemGroup> 22 </ItemGroup>
23 23
24 <ItemGroup> 24 <ItemGroup Condition="'$(TargetFramework)'=='net461'">
25 <PackageReference Include="Microsoft.Build.Tasks.Core" Version="14.3" />
25 <PackageReference Include="WixToolset.Core.Burn" Version="4.0.*" /> 26 <PackageReference Include="WixToolset.Core.Burn" Version="4.0.*" />
26 <PackageReference Include="WixToolset.Core.WindowsInstaller" Version="4.0.*" /> 27 <PackageReference Include="WixToolset.Core.WindowsInstaller" Version="4.0.*" />
27 <PackageReference Include="WixToolset.Dtf.WindowsInstaller" Version="4.0.*" />
28 <PackageReference Include="WixToolset.Harvesters" Version="4.0.*" /> 28 <PackageReference Include="WixToolset.Harvesters" Version="4.0.*" />
29 </ItemGroup> 29 </ItemGroup>
30 30
31 <ItemGroup> 31 <ItemGroup Condition="'$(TargetFramework)'=='netcoreapp2.1' ">
32 <PackageReference Include="Microsoft.Build.Tasks.Core" Version="14.3" Condition="'$(TargetFramework)'=='net461'" /> 32 <PackageReference Include="Microsoft.Build.Tasks.Core" Version="15.7.179" />
33 <PackageReference Include="Microsoft.Build.Tasks.Core" Version="15.7.179" Condition="'$(TargetFramework)'=='netcoreapp2.1' " />
34 </ItemGroup> 33 </ItemGroup>
35 34
36 <ItemGroup> 35 <ItemGroup>