@joebigelow / wix-1 / commits / 13ea8f9e

Add BaseLinkerExtension

Fixes wixtoolset/issues#5895

Rob Mensching committed Nov 2, 2018 at 23:14 UTC 13ea8f9e17f0bae1158b4a0f3c37e995e9816027
1 file changed +41
src/WixToolset.Extensibility/BaseLinkerExtension.cs new
+41
@@ -0,0 +1,41 @@
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 +
3 +namespace WixToolset.Extensibility
4 +{
5 + using WixToolset.Data;
6 + using WixToolset.Extensibility.Data;
7 + using WixToolset.Extensibility.Services;
8 +
9 + /// <summary>
10 + /// Base class for creating a linker extension.
11 + /// </summary>
12 + public abstract class BaseLinkerExtension : ILinkerExtension
13 + {
14 + /// <summary>
15 + /// Context for use by the extension.
16 + /// </summary>
17 + protected ILinkContext Context { get; private set; }
18 +
19 + /// <summary>
20 + /// Messaging for use by the extension.
21 + /// </summary>
22 + protected IMessaging Messaging { get; private set; }
23 +
24 + /// <summary>
25 + /// Called at the beginning of the linking.
26 + /// </summary>
27 + public virtual void PreLink(ILinkContext context)
28 + {
29 + this.Context = context;
30 +
31 + this.Messaging = context.ServiceProvider.GetService<IMessaging>();
32 + }
33 +
34 + /// <summary>
35 + /// Called at the end of the linking.
36 + /// </summary>
37 + public virtual void PostLink(Intermediate intermediate)
38 + {
39 + }
40 + }
41 +}