From 0c3a3b3a7d724a8eb0cb62de05354040d7d1a9f4 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sun, 22 Dec 2019 10:33:15 +1100 Subject: Move the entry point from Mba.Core to Mba.Host. --- .../BootstrapperApplicationFactory.cs | 84 ------------ .../BootstrapperSectionGroup.cs | 29 ----- src/WixToolset.Mba.Core/Exceptions.cs | 145 --------------------- src/WixToolset.Mba.Core/HostSection.cs | 47 ------- .../SupportedFrameworkElement.cs | 47 ------- .../SupportedFrameworkElementCollection.cs | 36 ----- src/WixToolset.Mba.Core/WixToolset.Mba.Core.config | 26 ---- src/WixToolset.Mba.Core/WixToolset.Mba.Core.csproj | 37 +----- src/WixToolset.Mba.Core/WixToolset.Mba.Core.nuspec | 2 - 9 files changed, 1 insertion(+), 452 deletions(-) delete mode 100644 src/WixToolset.Mba.Core/BootstrapperApplicationFactory.cs delete mode 100644 src/WixToolset.Mba.Core/BootstrapperSectionGroup.cs delete mode 100644 src/WixToolset.Mba.Core/Exceptions.cs delete mode 100644 src/WixToolset.Mba.Core/HostSection.cs delete mode 100644 src/WixToolset.Mba.Core/SupportedFrameworkElement.cs delete mode 100644 src/WixToolset.Mba.Core/SupportedFrameworkElementCollection.cs delete mode 100644 src/WixToolset.Mba.Core/WixToolset.Mba.Core.config diff --git a/src/WixToolset.Mba.Core/BootstrapperApplicationFactory.cs b/src/WixToolset.Mba.Core/BootstrapperApplicationFactory.cs deleted file mode 100644 index 55f0e83b..00000000 --- a/src/WixToolset.Mba.Core/BootstrapperApplicationFactory.cs +++ /dev/null @@ -1,84 +0,0 @@ -// 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. - -namespace WixToolset.Mba.Core -{ - using System; - using System.Configuration; - using System.Reflection; - using System.Runtime.InteropServices; - - /// - /// Entry point for the MBA host to create and return the BA to the engine. - /// - [ClassInterface(ClassInterfaceType.None)] - public sealed class BootstrapperApplicationFactory : MarshalByRefObject, IBootstrapperApplicationFactory - { - /// - /// Creates a new instance of the class. - /// - public BootstrapperApplicationFactory() - { - } - - /// - /// Loads the bootstrapper application assembly and calls its IBootstrapperApplicationFactory.Create method. - /// - /// Pointer to BOOTSTRAPPER_CREATE_ARGS struct. - /// Pointer to BOOTSTRAPPER_CREATE_RESULTS struct. - /// The bootstrapper application assembly - /// does not define the . - public void Create(IntPtr pArgs, IntPtr pResults) - { - // Get the wix.boostrapper section group to get the name of the bootstrapper application assembly to host. - var section = ConfigurationManager.GetSection("wix.bootstrapper/host") as HostSection; - if (null == section) - { - throw new MissingAttributeException(); // TODO: throw a more specific exception than this. - } - - // Load the BA's IBootstrapperApplicationFactory. - var baFactoryType = BootstrapperApplicationFactory.GetBAFactoryTypeFromAssembly(section.AssemblyName); - var baFactory = (IBootstrapperApplicationFactory)Activator.CreateInstance(baFactoryType); - if (null == baFactory) - { - throw new InvalidBootstrapperApplicationFactoryException(); - } - - baFactory.Create(pArgs, pResults); - } - - /// - /// Locates the and returns the specified type. - /// - /// The assembly that defines the IBootstrapperApplicationFactory implementation. - /// The bootstrapper application factory . - private static Type GetBAFactoryTypeFromAssembly(string assemblyName) - { - Type baFactoryType = null; - - // Load the requested assembly. - Assembly asm = AppDomain.CurrentDomain.Load(assemblyName); - - // If an assembly was loaded and is not the current assembly, check for the required attribute. - // This is done to avoid using the BootstrapperApplicationFactoryAttribute which we use at build time - // to specify the BootstrapperApplicationFactory assembly in the manifest. - if (!Assembly.GetExecutingAssembly().Equals(asm)) - { - // There must be one and only one BootstrapperApplicationFactoryAttribute. - // The attribute prevents multiple declarations already. - var attrs = (BootstrapperApplicationFactoryAttribute[])asm.GetCustomAttributes(typeof(BootstrapperApplicationFactoryAttribute), false); - if (null != attrs) - { - baFactoryType = attrs[0].BootstrapperApplicationFactoryType; - } - } - - if (null == baFactoryType) - { - throw new MissingAttributeException(); - } - - return baFactoryType; - } - } -} diff --git a/src/WixToolset.Mba.Core/BootstrapperSectionGroup.cs b/src/WixToolset.Mba.Core/BootstrapperSectionGroup.cs deleted file mode 100644 index f307e53e..00000000 --- a/src/WixToolset.Mba.Core/BootstrapperSectionGroup.cs +++ /dev/null @@ -1,29 +0,0 @@ -// 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. - -namespace WixToolset.Mba.Core -{ - using System; - using System.Configuration; - - /// - /// Handler for the wix.bootstrapper configuration section group. - /// - public class BootstrapperSectionGroup : ConfigurationSectionGroup - { - /// - /// Creates a new instance of the class. - /// - public BootstrapperSectionGroup() - { - } - - /// - /// Gets the handler for the mba configuration section. - /// - [ConfigurationProperty("host")] - public HostSection Host - { - get { return (HostSection)base.Sections["host"]; } - } - } -} diff --git a/src/WixToolset.Mba.Core/Exceptions.cs b/src/WixToolset.Mba.Core/Exceptions.cs deleted file mode 100644 index 72669a42..00000000 --- a/src/WixToolset.Mba.Core/Exceptions.cs +++ /dev/null @@ -1,145 +0,0 @@ -// 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. - -namespace WixToolset.Mba.Core -{ - using System; - using System.Runtime.Serialization; - - /// - /// Base class for exception returned to the bootstrapper application host. - /// - [Serializable] - public abstract class BootstrapperException : Exception - { - /// - /// Creates an instance of the base class with the given HRESULT. - /// - /// The HRESULT for the exception that is used by the bootstrapper application host. - public BootstrapperException(int hr) - { - this.HResult = hr; - } - - /// - /// Initializes a new instance of the class. - /// - /// Exception message. - public BootstrapperException(string message) - : base(message) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// Exception message - /// Inner exception associated with this one - public BootstrapperException(string message, Exception innerException) - : base(message, innerException) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// Serialization information for this exception - /// Streaming context to serialize to - protected BootstrapperException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - /// - /// The bootstrapper application assembly loaded by the host does not contain exactly one instance of the - /// class. - /// - /// - [Serializable] - public class MissingAttributeException : BootstrapperException - { - /// - /// Creates a new instance of the class. - /// - public MissingAttributeException() - : base(NativeMethods.E_NOTFOUND) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// Exception message. - public MissingAttributeException(string message) - : base(message) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// Exception message - /// Inner exception associated with this one - public MissingAttributeException(string message, Exception innerException) - : base(message, innerException) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// Serialization information for this exception - /// Streaming context to serialize to - protected MissingAttributeException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - /// - /// The bootstrapper application factory specified by the - /// does not extend the base class. - /// - /// - /// - [Serializable] - public class InvalidBootstrapperApplicationFactoryException : BootstrapperException - { - /// - /// Creates a new instance of the class. - /// - public InvalidBootstrapperApplicationFactoryException() - : base(NativeMethods.E_UNEXPECTED) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// Exception message. - public InvalidBootstrapperApplicationFactoryException(string message) - : base(message) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// Exception message - /// Inner exception associated with this one - public InvalidBootstrapperApplicationFactoryException(string message, Exception innerException) - : base(message, innerException) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// Serialization information for this exception - /// Streaming context to serialize to - protected InvalidBootstrapperApplicationFactoryException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } -} diff --git a/src/WixToolset.Mba.Core/HostSection.cs b/src/WixToolset.Mba.Core/HostSection.cs deleted file mode 100644 index 2586f565..00000000 --- a/src/WixToolset.Mba.Core/HostSection.cs +++ /dev/null @@ -1,47 +0,0 @@ -// 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. - -namespace WixToolset.Mba.Core -{ - using System; - using System.Configuration; - - /// - /// Handler for the Host configuration section. - /// - public sealed class HostSection : ConfigurationSection - { - private static readonly ConfigurationProperty assemblyNameProperty = new ConfigurationProperty("assemblyName", typeof(string), null, ConfigurationPropertyOptions.IsRequired); - private static readonly ConfigurationProperty supportedFrameworksProperty = new ConfigurationProperty("", typeof(SupportedFrameworkElementCollection), null, ConfigurationPropertyOptions.IsDefaultCollection); - - /// - /// Creates a new instance of the class. - /// - public HostSection() - { - } - - /// - /// Gets the name of the assembly that contians the child class. - /// - /// - /// The assembly specified by this name must contain the to identify - /// the type of the child class. - /// - [ConfigurationProperty("assemblyName", IsRequired = true)] - public string AssemblyName - { - get { return (string)base[assemblyNameProperty]; } - set { base[assemblyNameProperty] = value; } - } - - /// - /// Gets the of supported frameworks for the host configuration. - /// - [ConfigurationProperty("", IsDefaultCollection = true)] - [ConfigurationCollection(typeof(SupportedFrameworkElement))] - public SupportedFrameworkElementCollection SupportedFrameworks - { - get { return (SupportedFrameworkElementCollection)base[supportedFrameworksProperty]; } - } - } -} diff --git a/src/WixToolset.Mba.Core/SupportedFrameworkElement.cs b/src/WixToolset.Mba.Core/SupportedFrameworkElement.cs deleted file mode 100644 index 7eae8bbf..00000000 --- a/src/WixToolset.Mba.Core/SupportedFrameworkElement.cs +++ /dev/null @@ -1,47 +0,0 @@ -// 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. - -namespace WixToolset.Mba.Core -{ - using System; - using System.Configuration; - - /// - /// Handler for the supportedFramework configuration section. - /// - public sealed class SupportedFrameworkElement : ConfigurationElement - { - private static readonly ConfigurationProperty versionProperty = new ConfigurationProperty("version", typeof(string), null, ConfigurationPropertyOptions.IsRequired); - private static readonly ConfigurationProperty runtimeVersionProperty = new ConfigurationProperty("runtimeVersion", typeof(string)); - - /// - /// Creates a new instance of the class. - /// - public SupportedFrameworkElement() - { - } - - /// - /// Gets the version of the supported framework. - /// - /// - /// The assembly specified by this name must contain a value matching the NETFX version registry key under - /// "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP". - /// - [ConfigurationProperty("version", IsRequired = true)] - public string Version - { - get { return (string)base[versionProperty]; } - set { base[versionProperty] = value; } - } - - /// - /// Gets the runtime version required by this supported framework. - /// - [ConfigurationProperty("runtimeVersion", IsRequired = false)] - public string RuntimeVersion - { - get { return (string)base[runtimeVersionProperty]; } - set { base[runtimeVersionProperty] = value; } - } - } -} diff --git a/src/WixToolset.Mba.Core/SupportedFrameworkElementCollection.cs b/src/WixToolset.Mba.Core/SupportedFrameworkElementCollection.cs deleted file mode 100644 index 88a9b4dd..00000000 --- a/src/WixToolset.Mba.Core/SupportedFrameworkElementCollection.cs +++ /dev/null @@ -1,36 +0,0 @@ -// 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. - -namespace WixToolset.Mba.Core -{ - using System; - using System.Configuration; - using System.Diagnostics.CodeAnalysis; - - /// - /// Handler for the supportedFramework collection. - /// - [SuppressMessage("Microsoft.Design", "CA1010:CollectionsShouldImplementGenericInterface")] - [ConfigurationCollection(typeof(SupportedFrameworkElement), AddItemName = "supportedFramework", CollectionType = ConfigurationElementCollectionType.BasicMap)] - public sealed class SupportedFrameworkElementCollection : ConfigurationElementCollection - { - public override ConfigurationElementCollectionType CollectionType - { - get { return ConfigurationElementCollectionType.BasicMap; } - } - - protected override string ElementName - { - get { return "supportedFramework"; } - } - - protected override ConfigurationElement CreateNewElement() - { - return new SupportedFrameworkElement(); - } - - protected override object GetElementKey(ConfigurationElement element) - { - return (element as SupportedFrameworkElement).Version; - } - } -} diff --git a/src/WixToolset.Mba.Core/WixToolset.Mba.Core.config b/src/WixToolset.Mba.Core/WixToolset.Mba.Core.config deleted file mode 100644 index 81b49347..00000000 --- a/src/WixToolset.Mba.Core/WixToolset.Mba.Core.config +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - -
- - - - - - - - - - - - - - diff --git a/src/WixToolset.Mba.Core/WixToolset.Mba.Core.csproj b/src/WixToolset.Mba.Core/WixToolset.Mba.Core.csproj index 4b14a545..e88498ac 100644 --- a/src/WixToolset.Mba.Core/WixToolset.Mba.Core.csproj +++ b/src/WixToolset.Mba.Core/WixToolset.Mba.Core.csproj @@ -10,7 +10,7 @@ WixToolset.Mba.Core 0693;1591 v2.0 - Managed Bootstrapper Application entry point + Managed Bootstrapper Application Core true @@ -27,15 +27,11 @@ - - - - @@ -49,13 +45,6 @@ - - - - - - PreserveNewest - @@ -66,33 +55,9 @@ - - - False - - - - - - - - - - - - - - - - - - - - - diff --git a/src/WixToolset.Mba.Core/WixToolset.Mba.Core.nuspec b/src/WixToolset.Mba.Core/WixToolset.Mba.Core.nuspec index bbac204f..d773bcf9 100644 --- a/src/WixToolset.Mba.Core/WixToolset.Mba.Core.nuspec +++ b/src/WixToolset.Mba.Core/WixToolset.Mba.Core.nuspec @@ -14,10 +14,8 @@ - - -- cgit v1.2.3-55-g6feb