diff options
Diffstat (limited to 'src/WixToolset.Core/Compiler_Bundle.cs')
-rw-r--r-- | src/WixToolset.Core/Compiler_Bundle.cs | 101 |
1 files changed, 69 insertions, 32 deletions
diff --git a/src/WixToolset.Core/Compiler_Bundle.cs b/src/WixToolset.Core/Compiler_Bundle.cs index 68b738fb..00f88c1f 100644 --- a/src/WixToolset.Core/Compiler_Bundle.cs +++ b/src/WixToolset.Core/Compiler_Bundle.cs | |||
@@ -647,18 +647,73 @@ namespace WixToolset.Core | |||
647 | private void ParseBootstrapperApplicationElement(XElement node) | 647 | private void ParseBootstrapperApplicationElement(XElement node) |
648 | { | 648 | { |
649 | var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); | 649 | var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); |
650 | Identifier id = null; | ||
650 | Identifier previousId = null; | 651 | Identifier previousId = null; |
651 | var previousType = ComplexReferenceChildType.Unknown; | 652 | var previousType = ComplexReferenceChildType.Unknown; |
652 | var dpiAwareness = WixBootstrapperApplicationDpiAwarenessType.PerMonitorV2; | ||
653 | 653 | ||
654 | // The BootstrapperApplication element acts like a Payload element so delegate to the "Payload" attribute parsing code to parse and create a Payload entry. | 654 | foreach (var attrib in node.Attributes()) |
655 | var hasSourceFile = this.ParsePayloadElementContent(node, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId, false, out var id); | ||
656 | if (hasSourceFile) | ||
657 | { | 655 | { |
658 | previousId = id; | 656 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) |
659 | previousType = ComplexReferenceChildType.Payload; | 657 | { |
658 | switch (attrib.Name.LocalName) | ||
659 | { | ||
660 | case "Id": | ||
661 | id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); | ||
662 | break; | ||
663 | default: | ||
664 | this.Core.UnexpectedAttribute(node, attrib); | ||
665 | break; | ||
666 | } | ||
667 | } | ||
660 | } | 668 | } |
661 | 669 | ||
670 | foreach (var child in node.Elements()) | ||
671 | { | ||
672 | if (CompilerCore.WixNamespace == child.Name.Namespace) | ||
673 | { | ||
674 | switch (child.Name.LocalName) | ||
675 | { | ||
676 | case "BootstrapperApplicationDll": | ||
677 | previousId = this.ParseBootstrapperApplicationDllElement(child, previousType, previousId); | ||
678 | previousType = ComplexReferenceChildType.Payload; | ||
679 | break; | ||
680 | case "Payload": | ||
681 | previousId = this.ParsePayloadElement(child, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId); | ||
682 | previousType = ComplexReferenceChildType.Payload; | ||
683 | break; | ||
684 | case "PayloadGroupRef": | ||
685 | previousId = this.ParsePayloadGroupRefElement(child, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId); | ||
686 | previousType = ComplexReferenceChildType.PayloadGroup; | ||
687 | break; | ||
688 | default: | ||
689 | this.Core.UnexpectedElement(node, child); | ||
690 | break; | ||
691 | } | ||
692 | } | ||
693 | else | ||
694 | { | ||
695 | this.Core.ParseExtensionElement(node, child); | ||
696 | } | ||
697 | } | ||
698 | |||
699 | if (id != null) | ||
700 | { | ||
701 | this.Core.AddSymbol(new WixBootstrapperApplicationSymbol(sourceLineNumbers, id)); | ||
702 | } | ||
703 | } | ||
704 | |||
705 | /// <summary> | ||
706 | /// Parse the BoostrapperApplication element. | ||
707 | /// </summary> | ||
708 | /// <param name="node">Element to parse</param> | ||
709 | private Identifier ParseBootstrapperApplicationDllElement(XElement node, ComplexReferenceChildType previousType, Identifier previousId) | ||
710 | { | ||
711 | var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); | ||
712 | var dpiAwareness = WixBootstrapperApplicationDpiAwarenessType.PerMonitorV2; | ||
713 | |||
714 | // The BootstrapperApplicationDll element acts like a Payload element so delegate to the "Payload" attribute parsing code to parse and create a Payload entry. | ||
715 | this.ParsePayloadElementContent(node, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId, true, out var id); | ||
716 | |||
662 | foreach (var attrib in node.Attributes()) | 717 | foreach (var attrib in node.Attributes()) |
663 | { | 718 | { |
664 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) | 719 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) |
@@ -699,17 +754,9 @@ namespace WixToolset.Core | |||
699 | { | 754 | { |
700 | switch (child.Name.LocalName) | 755 | switch (child.Name.LocalName) |
701 | { | 756 | { |
702 | case "Payload": | 757 | default: |
703 | previousId = this.ParsePayloadElement(child, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId); | 758 | this.Core.UnexpectedElement(node, child); |
704 | previousType = ComplexReferenceChildType.Payload; | 759 | break; |
705 | break; | ||
706 | case "PayloadGroupRef": | ||
707 | previousId = this.ParsePayloadGroupRefElement(child, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId); | ||
708 | previousType = ComplexReferenceChildType.PayloadGroup; | ||
709 | break; | ||
710 | default: | ||
711 | this.Core.UnexpectedElement(node, child); | ||
712 | break; | ||
713 | } | 760 | } |
714 | } | 761 | } |
715 | else | 762 | else |
@@ -718,15 +765,6 @@ namespace WixToolset.Core | |||
718 | } | 765 | } |
719 | } | 766 | } |
720 | 767 | ||
721 | if (null == previousId) | ||
722 | { | ||
723 | // We need *either* <Payload> or <PayloadGroupRef> or even just @SourceFile on the BA... | ||
724 | // but we just say there's a missing <Payload>. | ||
725 | // TODO: Is there a better message for this? | ||
726 | this.Core.Write(ErrorMessages.ExpectedElement(sourceLineNumbers, node.Name.LocalName, "Payload")); | ||
727 | } | ||
728 | |||
729 | // Add the application as an attached container and if a SourceFile was provided add the Id as the BA. | ||
730 | if (!this.Core.EncounteredError) | 768 | if (!this.Core.EncounteredError) |
731 | { | 769 | { |
732 | this.Core.AddSymbol(new WixBundleContainerSymbol(sourceLineNumbers, Compiler.BurnUXContainerId) | 770 | this.Core.AddSymbol(new WixBundleContainerSymbol(sourceLineNumbers, Compiler.BurnUXContainerId) |
@@ -735,14 +773,13 @@ namespace WixToolset.Core | |||
735 | Type = ContainerType.Attached | 773 | Type = ContainerType.Attached |
736 | }); | 774 | }); |
737 | 775 | ||
738 | if (hasSourceFile) | 776 | this.Core.AddSymbol(new WixBootstrapperApplicationDllSymbol(sourceLineNumbers, id) |
739 | { | 777 | { |
740 | this.Core.AddSymbol(new WixBootstrapperApplicationSymbol(sourceLineNumbers, id) | 778 | DpiAwareness = dpiAwareness, |
741 | { | 779 | }); |
742 | DpiAwareness = dpiAwareness, | ||
743 | }); | ||
744 | } | ||
745 | } | 780 | } |
781 | |||
782 | return id; | ||
746 | } | 783 | } |
747 | 784 | ||
748 | /// <summary> | 785 | /// <summary> |