diff options
-rw-r--r-- | src/WixToolset.BuildTasks/DoIt.cs | 15 | ||||
-rw-r--r-- | src/wix/Program.cs | 15 | ||||
-rw-r--r-- | src/wix/wix.csproj | 2 |
3 files changed, 25 insertions, 7 deletions
diff --git a/src/WixToolset.BuildTasks/DoIt.cs b/src/WixToolset.BuildTasks/DoIt.cs index 33842e44..01938ed6 100644 --- a/src/WixToolset.BuildTasks/DoIt.cs +++ b/src/WixToolset.BuildTasks/DoIt.cs | |||
@@ -4,6 +4,8 @@ namespace WixToolset.BuildTasks | |||
4 | { | 4 | { |
5 | using System; | 5 | using System; |
6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
7 | using System.Linq; | ||
8 | using System.Reflection; | ||
7 | using System.Runtime.InteropServices; | 9 | using System.Runtime.InteropServices; |
8 | using Microsoft.Build.Framework; | 10 | using Microsoft.Build.Framework; |
9 | using Microsoft.Build.Utilities; | 11 | using Microsoft.Build.Utilities; |
@@ -170,13 +172,13 @@ namespace WixToolset.BuildTasks | |||
170 | arguments.Populate(commandLineString); | 172 | arguments.Populate(commandLineString); |
171 | 173 | ||
172 | var commandLine = serviceProvider.GetService<ICommandLineParser>(); | 174 | var commandLine = serviceProvider.GetService<ICommandLineParser>(); |
173 | commandLine.ExtensionManager = this.CreateExtensionManagerWithStandardBackends(serviceProvider, arguments.Extensions); | 175 | commandLine.ExtensionManager = this.CreateExtensionManagerWithStandardBackends(serviceProvider, messaging, arguments.Extensions); |
174 | commandLine.Arguments = arguments; | 176 | commandLine.Arguments = arguments; |
175 | var command = commandLine.ParseStandardCommandLine(); | 177 | var command = commandLine.ParseStandardCommandLine(); |
176 | command?.Execute(); | 178 | command?.Execute(); |
177 | } | 179 | } |
178 | 180 | ||
179 | private IExtensionManager CreateExtensionManagerWithStandardBackends(IServiceProvider serviceProvider, string[] extensions) | 181 | private IExtensionManager CreateExtensionManagerWithStandardBackends(IServiceProvider serviceProvider, IMessaging messaging, string[] extensions) |
180 | { | 182 | { |
181 | var extensionManager = serviceProvider.GetService<IExtensionManager>(); | 183 | var extensionManager = serviceProvider.GetService<IExtensionManager>(); |
182 | 184 | ||
@@ -187,7 +189,14 @@ namespace WixToolset.BuildTasks | |||
187 | 189 | ||
188 | foreach (var extension in extensions) | 190 | foreach (var extension in extensions) |
189 | { | 191 | { |
190 | extensionManager.Load(extension); | 192 | try |
193 | { | ||
194 | extensionManager.Load(extension); | ||
195 | } | ||
196 | catch (ReflectionTypeLoadException e) | ||
197 | { | ||
198 | messaging.Write(ErrorMessages.InvalidExtension(extension, String.Join(Environment.NewLine, e.LoaderExceptions.Select(le => le.ToString())))); | ||
199 | } | ||
191 | } | 200 | } |
192 | 201 | ||
193 | return extensionManager; | 202 | return extensionManager; |
diff --git a/src/wix/Program.cs b/src/wix/Program.cs index 2a092ffc..a95851ee 100644 --- a/src/wix/Program.cs +++ b/src/wix/Program.cs | |||
@@ -4,6 +4,8 @@ namespace WixToolset.Tools | |||
4 | { | 4 | { |
5 | using System; | 5 | using System; |
6 | using System.Globalization; | 6 | using System.Globalization; |
7 | using System.Linq; | ||
8 | using System.Reflection; | ||
7 | using System.Text; | 9 | using System.Text; |
8 | using System.Threading; | 10 | using System.Threading; |
9 | using WixToolset.Core; | 11 | using WixToolset.Core; |
@@ -48,13 +50,13 @@ namespace WixToolset.Tools | |||
48 | arguments.Populate(args); | 50 | arguments.Populate(args); |
49 | 51 | ||
50 | var commandLine = serviceProvider.GetService<ICommandLineParser>(); | 52 | var commandLine = serviceProvider.GetService<ICommandLineParser>(); |
51 | commandLine.ExtensionManager = CreateExtensionManagerWithStandardBackends(serviceProvider, arguments.Extensions); | 53 | commandLine.ExtensionManager = CreateExtensionManagerWithStandardBackends(serviceProvider, messaging, arguments.Extensions); |
52 | commandLine.Arguments = arguments; | 54 | commandLine.Arguments = arguments; |
53 | var command = commandLine.ParseStandardCommandLine(); | 55 | var command = commandLine.ParseStandardCommandLine(); |
54 | return command?.Execute() ?? 1; | 56 | return command?.Execute() ?? 1; |
55 | } | 57 | } |
56 | 58 | ||
57 | private static IExtensionManager CreateExtensionManagerWithStandardBackends(IServiceProvider serviceProvider, string[] extensions) | 59 | private static IExtensionManager CreateExtensionManagerWithStandardBackends(IServiceProvider serviceProvider, IMessaging messaging, string[] extensions) |
58 | { | 60 | { |
59 | var extensionManager = serviceProvider.GetService<IExtensionManager>(); | 61 | var extensionManager = serviceProvider.GetService<IExtensionManager>(); |
60 | 62 | ||
@@ -65,7 +67,14 @@ namespace WixToolset.Tools | |||
65 | 67 | ||
66 | foreach (var extension in extensions) | 68 | foreach (var extension in extensions) |
67 | { | 69 | { |
68 | extensionManager.Load(extension); | 70 | try |
71 | { | ||
72 | extensionManager.Load(extension); | ||
73 | } | ||
74 | catch (ReflectionTypeLoadException e) | ||
75 | { | ||
76 | messaging.Write(ErrorMessages.InvalidExtension(extension, String.Join(Environment.NewLine, e.LoaderExceptions.Select(le => le.ToString())))); | ||
77 | } | ||
69 | } | 78 | } |
70 | 79 | ||
71 | return extensionManager; | 80 | return extensionManager; |
diff --git a/src/wix/wix.csproj b/src/wix/wix.csproj index fbb8a0f5..6ec22ec0 100644 --- a/src/wix/wix.csproj +++ b/src/wix/wix.csproj | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | <Project Sdk="Microsoft.NET.Sdk"> | 4 | <Project Sdk="Microsoft.NET.Sdk"> |
5 | <PropertyGroup> | 5 | <PropertyGroup> |
6 | <TargetFramework>netcoreapp2.1</TargetFramework> | 6 | <TargetFrameworks>net461;netcoreapp2.1</TargetFrameworks> |
7 | <OutputType>Exe</OutputType> | 7 | <OutputType>Exe</OutputType> |
8 | <Description>Compiler</Description> | 8 | <Description>Compiler</Description> |
9 | <Title>WiX Toolset Compiler</Title> | 9 | <Title>WiX Toolset Compiler</Title> |