diff options
Diffstat (limited to 'src')
3 files changed, 75 insertions, 3 deletions
diff --git a/src/WixToolset.Converters/WixConverter.cs b/src/WixToolset.Converters/WixConverter.cs index d0c40050..a7f08b88 100644 --- a/src/WixToolset.Converters/WixConverter.cs +++ b/src/WixToolset.Converters/WixConverter.cs | |||
@@ -161,7 +161,7 @@ namespace WixToolset.Converters | |||
161 | { WixConverter.FirewallRemoteAddressElementName, this.ConvertFirewallRemoteAddressElement }, | 161 | { WixConverter.FirewallRemoteAddressElementName, this.ConvertFirewallRemoteAddressElement }, |
162 | { WixConverter.EmbeddedChainerElementName, this.ConvertEmbeddedChainerElement }, | 162 | { WixConverter.EmbeddedChainerElementName, this.ConvertEmbeddedChainerElement }, |
163 | { WixConverter.ErrorElementName, this.ConvertErrorElement }, | 163 | { WixConverter.ErrorElementName, this.ConvertErrorElement }, |
164 | { WixConverter.ExePackageElementName, this.ConvertSuppressSignatureValidation }, | 164 | { WixConverter.ExePackageElementName, this.ConvertExePackageElement }, |
165 | { WixConverter.ModuleElementName, this.ConvertModuleElement }, | 165 | { WixConverter.ModuleElementName, this.ConvertModuleElement }, |
166 | { WixConverter.MsiPackageElementName, this.ConvertWindowsInstallerPackageElement }, | 166 | { WixConverter.MsiPackageElementName, this.ConvertWindowsInstallerPackageElement }, |
167 | { WixConverter.MspPackageElementName, this.ConvertWindowsInstallerPackageElement }, | 167 | { WixConverter.MspPackageElementName, this.ConvertWindowsInstallerPackageElement }, |
@@ -843,6 +843,24 @@ namespace WixToolset.Converters | |||
843 | 843 | ||
844 | private void ConvertErrorElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Message"); | 844 | private void ConvertErrorElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Message"); |
845 | 845 | ||
846 | private void ConvertExePackageElement(XElement element) | ||
847 | { | ||
848 | this.ConvertSuppressSignatureValidation(element); | ||
849 | |||
850 | foreach (var attributeName in new[] { "InstallCommand", "RepairCommand", "UninstallCommand" }) | ||
851 | { | ||
852 | var newName = attributeName.Replace("Command", "Arguments"); | ||
853 | var attribute = element.Attribute(attributeName); | ||
854 | |||
855 | if (attribute != null && | ||
856 | this.OnError(ConverterTestType.RenameExePackageCommandToArguments, element, "The {0} element {1} attribute has been renamed {2}.", element.Name.LocalName, attribute.Name.LocalName, newName)) | ||
857 | { | ||
858 | element.Add(new XAttribute(newName, attribute.Value)); | ||
859 | attribute.Remove(); | ||
860 | } | ||
861 | } | ||
862 | } | ||
863 | |||
846 | private void ConvertPermissionExElement(XElement element) | 864 | private void ConvertPermissionExElement(XElement element) |
847 | { | 865 | { |
848 | var xCondition = element.Element(ConditionElementName); | 866 | var xCondition = element.Element(ConditionElementName); |
@@ -1691,6 +1709,11 @@ namespace WixToolset.Converters | |||
1691 | /// The custom elements for built-in BAs are now required. | 1709 | /// The custom elements for built-in BAs are now required. |
1692 | /// </summary> | 1710 | /// </summary> |
1693 | BalBootstrapperApplicationRefToElement, | 1711 | BalBootstrapperApplicationRefToElement, |
1712 | |||
1713 | /// <summary> | ||
1714 | /// The ExePackage elements "XxxCommand" attributes have been renamed to "XxxArguments". | ||
1715 | /// </summary> | ||
1716 | RenameExePackageCommandToArguments, | ||
1694 | } | 1717 | } |
1695 | } | 1718 | } |
1696 | } | 1719 | } |
diff --git a/src/test/WixToolsetTest.Converters/ExePackageFixture.cs b/src/test/WixToolsetTest.Converters/ExePackageFixture.cs new file mode 100644 index 00000000..0ee8d065 --- /dev/null +++ b/src/test/WixToolsetTest.Converters/ExePackageFixture.cs | |||
@@ -0,0 +1,49 @@ | |||
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.Converters | ||
4 | { | ||
5 | using System; | ||
6 | using System.Xml.Linq; | ||
7 | using WixBuildTools.TestSupport; | ||
8 | using WixToolset.Converters; | ||
9 | using WixToolsetTest.Converters.Mocks; | ||
10 | using Xunit; | ||
11 | |||
12 | public class ExePackageFixture : BaseConverterFixture | ||
13 | { | ||
14 | [Fact] | ||
15 | public void CanConvertExePackageCommandToArguments() | ||
16 | { | ||
17 | var parse = String.Join(Environment.NewLine, | ||
18 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | ||
19 | " <Fragment>", | ||
20 | " <PackageGroup Id='exe'>", | ||
21 | " <ExePackage InstallCommand='-install' RepairCommand='-repair' UninstallCommand='-uninstall' SourceFile='test.exe' />", | ||
22 | " </PackageGroup>", | ||
23 | " </Fragment>", | ||
24 | "</Wix>"); | ||
25 | |||
26 | var expected = new[] | ||
27 | { | ||
28 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | ||
29 | " <Fragment>", | ||
30 | " <PackageGroup Id=\"exe\">", | ||
31 | " <ExePackage SourceFile=\"test.exe\" InstallArguments=\"-install\" RepairArguments=\"-repair\" UninstallArguments=\"-uninstall\" />", | ||
32 | " </PackageGroup>", | ||
33 | " </Fragment>", | ||
34 | "</Wix>" | ||
35 | }; | ||
36 | |||
37 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
38 | |||
39 | var messaging = new MockMessaging(); | ||
40 | var converter = new WixConverter(messaging, 2, null, null); | ||
41 | |||
42 | var errors = converter.ConvertDocument(document); | ||
43 | Assert.Equal(3, errors); | ||
44 | |||
45 | var actualLines = UnformattedDocumentLines(document); | ||
46 | WixAssert.CompareLineByLine(expected, actualLines); | ||
47 | } | ||
48 | } | ||
49 | } | ||
diff --git a/src/test/WixToolsetTest.Converters/WixToolsetTest.Converters.csproj b/src/test/WixToolsetTest.Converters/WixToolsetTest.Converters.csproj index 1bf44dbc..902494a2 100644 --- a/src/test/WixToolsetTest.Converters/WixToolsetTest.Converters.csproj +++ b/src/test/WixToolsetTest.Converters/WixToolsetTest.Converters.csproj | |||
@@ -36,8 +36,8 @@ | |||
36 | </ItemGroup> | 36 | </ItemGroup> |
37 | 37 | ||
38 | <ItemGroup> | 38 | <ItemGroup> |
39 | <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.0" /> | 39 | <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" /> |
40 | <PackageReference Include="xunit" Version="2.4.1" /> | 40 | <PackageReference Include="xunit" Version="2.4.1" /> |
41 | <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" PrivateAssets="All" /> | 41 | <PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" PrivateAssets="All" /> |
42 | </ItemGroup> | 42 | </ItemGroup> |
43 | </Project> | 43 | </Project> |