@joebigelow / wix / commits / 72b6f010

Correctly handle custom action default suffix.

Bob Arnson committed Mar 5, 2020 at 16:47 UTC 72b6f0109008103dfe974fa4d2d3ce42e7b6b53e
2 files changed +41 -9
src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs
+5 -9
@@ -897,35 +897,31 @@ namespace WixToolset.Core.ExtensibilityServices
897 if (!this.Messaging.EncounteredError)
898 {
899 var name = String.Concat("Wix4", customAction);
900 + var suffix = "_X86";
901
902 switch (currentPlatform)
903 {
904 case Platform.X64:
905 if ((supportedPlatforms & CustomActionPlatforms.X64) == CustomActionPlatforms.X64)
906 {
906 - name = String.Concat(name, "_X64");
907 + suffix = "_X64";
908 }
909 break;
910 case Platform.ARM:
911 if ((supportedPlatforms & CustomActionPlatforms.ARM) == CustomActionPlatforms.ARM)
912 {
912 - name = String.Concat(name, "_A32");
913 + suffix = "_A32";
914 }
915 break;
916 case Platform.ARM64:
917 if ((supportedPlatforms & CustomActionPlatforms.ARM64) == CustomActionPlatforms.ARM64)
918 {
918 - name = String.Concat(name, "_A64");
919 + suffix = "_A64";
920 }
921 break;
921 - // Fall back to x86.
922 - case Platform.X86:
923 - default:
924 - name = String.Concat(name, "_X86");
925 - break;
922 }
923
928 - this.CreateSimpleReference(section, sourceLineNumbers, nameof(TupleDefinitionType.CustomAction), name);
924 + this.CreateSimpleReference(section, sourceLineNumbers, nameof(TupleDefinitionType.CustomAction), name + suffix);
925 }
926 }
927
src/test/WixToolsetTest.CoreIntegration/ParseFixture.cs new
+36
@@ -0,0 +1,36 @@
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 WixToolsetTest.CoreIntegration
4 +{
5 + using System.Linq;
6 + using WixToolset.Core;
7 + using WixToolset.Data;
8 + using WixToolset.Data.Tuples;
9 + using WixToolset.Extensibility.Data;
10 + using WixToolset.Extensibility.Services;
11 + using Xunit;
12 +
13 + public class ParseFixture
14 + {
15 + [Fact]
16 + public void GeneratesCorrectCustomActionIdentifiers()
17 + {
18 + var serviceProvider = new WixToolsetServiceProvider();
19 + var section = new IntermediateSection("section", SectionType.Fragment, 0);
20 + var parseHelper = serviceProvider.GetService<IParseHelper>();
21 +
22 + parseHelper.CreateCustomActionReference(null, section, "CustomAction32", Platform.X86, CustomActionPlatforms.X86 | CustomActionPlatforms.ARM);
23 + parseHelper.CreateCustomActionReference(null, section, "CustomArmAction", Platform.ARM64, CustomActionPlatforms.X86 | CustomActionPlatforms.ARM);
24 + parseHelper.CreateCustomActionReference(null, section, "CustomArmAction", Platform.ARM64, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM64);
25 + parseHelper.CreateCustomActionReference(null, section, "CustomAction", Platform.X64, CustomActionPlatforms.X86 | CustomActionPlatforms.ARM);
26 + parseHelper.CreateCustomActionReference(null, section, "CustomAction", Platform.X64, CustomActionPlatforms.X86 | CustomActionPlatforms.X64);
27 +
28 + var simpleReferences = section.Tuples.OfType<WixSimpleReferenceTuple>();
29 + Assert.NotNull(simpleReferences.Where(t => t.SymbolicName == "CustomAction:Wix4CustomAction32_X86").FirstOrDefault());
30 + Assert.NotNull(simpleReferences.Where(t => t.SymbolicName == "CustomAction:Wix4CustomArmAction_X86").FirstOrDefault());
31 + Assert.NotNull(simpleReferences.Where(t => t.SymbolicName == "CustomAction:Wix4CustomArmAction_A64").FirstOrDefault());
32 + Assert.NotNull(simpleReferences.Where(t => t.SymbolicName == "CustomAction:Wix4CustomAction_X86").FirstOrDefault());
33 + Assert.NotNull(simpleReferences.Where(t => t.SymbolicName == "CustomAction:Wix4CustomAction_X64").FirstOrDefault());
34 + }
35 + }
36 +}