diff options
Diffstat (limited to 'src/WixToolset.BuildTasks/DoIt.cs')
-rw-r--r-- | src/WixToolset.BuildTasks/DoIt.cs | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/WixToolset.BuildTasks/DoIt.cs b/src/WixToolset.BuildTasks/DoIt.cs index aeeb428b..07bf05e5 100644 --- a/src/WixToolset.BuildTasks/DoIt.cs +++ b/src/WixToolset.BuildTasks/DoIt.cs | |||
@@ -4,8 +4,6 @@ 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; | ||
9 | using System.Runtime.InteropServices; | 7 | using System.Runtime.InteropServices; |
10 | using Microsoft.Build.Framework; | 8 | using Microsoft.Build.Framework; |
11 | using Microsoft.Build.Utilities; | 9 | using Microsoft.Build.Utilities; |
@@ -111,9 +109,17 @@ namespace WixToolset.BuildTasks | |||
111 | 109 | ||
112 | public override bool Execute() | 110 | public override bool Execute() |
113 | { | 111 | { |
112 | var serviceProvider = new WixToolsetServiceProvider(); | ||
113 | |||
114 | var listener = new MsbuildMessageListener(this.Log, "WIX", this.BuildEngine.ProjectFileOfTaskNode); | ||
115 | |||
114 | try | 116 | try |
115 | { | 117 | { |
116 | this.ExecuteCore(); | 118 | this.ExecuteCore(serviceProvider, listener); |
119 | } | ||
120 | catch (WixException e) | ||
121 | { | ||
122 | listener.Write(e.Error); | ||
117 | } | 123 | } |
118 | catch (Exception e) | 124 | catch (Exception e) |
119 | { | 125 | { |
@@ -128,10 +134,8 @@ namespace WixToolset.BuildTasks | |||
128 | return !this.Log.HasLoggedErrors; | 134 | return !this.Log.HasLoggedErrors; |
129 | } | 135 | } |
130 | 136 | ||
131 | private void ExecuteCore() | 137 | private void ExecuteCore(IServiceProvider serviceProvider, IMessageListener listener) |
132 | { | 138 | { |
133 | var listener = new MsbuildMessageListener(this.Log, "WIX", this.BuildEngine.ProjectFileOfTaskNode); | ||
134 | |||
135 | var commandLineBuilder = new WixCommandLineBuilder(); | 139 | var commandLineBuilder = new WixCommandLineBuilder(); |
136 | 140 | ||
137 | commandLineBuilder.AppendTextUnquoted("build"); | 141 | commandLineBuilder.AppendTextUnquoted("build"); |
@@ -164,8 +168,6 @@ namespace WixToolset.BuildTasks | |||
164 | 168 | ||
165 | this.Log.LogMessage(MessageImportance.Normal, "wix.exe " + commandLineString); | 169 | this.Log.LogMessage(MessageImportance.Normal, "wix.exe " + commandLineString); |
166 | 170 | ||
167 | var serviceProvider = new WixToolsetServiceProvider(); | ||
168 | |||
169 | var messaging = serviceProvider.GetService<IMessaging>(); | 171 | var messaging = serviceProvider.GetService<IMessaging>(); |
170 | messaging.SetListener(listener); | 172 | messaging.SetListener(listener); |
171 | 173 | ||
@@ -194,9 +196,9 @@ namespace WixToolset.BuildTasks | |||
194 | { | 196 | { |
195 | extensionManager.Load(extension); | 197 | extensionManager.Load(extension); |
196 | } | 198 | } |
197 | catch (ReflectionTypeLoadException e) | 199 | catch (WixException e) |
198 | { | 200 | { |
199 | messaging.Write(ErrorMessages.InvalidExtension(extension, String.Join(Environment.NewLine, e.LoaderExceptions.Select(le => le.ToString())))); | 201 | messaging.Write(e.Error); |
200 | } | 202 | } |
201 | } | 203 | } |
202 | 204 | ||