diff options
| author | Rob Mensching <rob@firegiant.com> | 2023-04-03 22:21:18 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2023-04-04 10:03:45 -0700 |
| commit | ef800a635a79effeec25775163002e1c8da9bb98 (patch) | |
| tree | 133eb6e203dc602bbf0dfbe45b2182ab4956fd11 /src | |
| parent | 238a1601a3cdf11cb9becaf8a53f281bdbbcbf09 (diff) | |
| download | wix-ef800a635a79effeec25775163002e1c8da9bb98.tar.gz wix-ef800a635a79effeec25775163002e1c8da9bb98.tar.bz2 wix-ef800a635a79effeec25775163002e1c8da9bb98.zip | |
Convert iis:Certificate BinaryKey to BinaryRef
Fixes 7341
Diffstat (limited to 'src')
| -rw-r--r-- | src/wix/WixToolset.Converters/WixConverter.cs | 21 | ||||
| -rw-r--r-- | src/wix/test/WixToolsetTest.Converters/IisExtensionFixture.cs | 51 |
2 files changed, 71 insertions, 1 deletions
diff --git a/src/wix/WixToolset.Converters/WixConverter.cs b/src/wix/WixToolset.Converters/WixConverter.cs index f2711300..2f00d15d 100644 --- a/src/wix/WixToolset.Converters/WixConverter.cs +++ b/src/wix/WixToolset.Converters/WixConverter.cs | |||
| @@ -52,6 +52,7 @@ namespace WixToolset.Converters | |||
| 52 | private static readonly XNamespace WixDependencyNamespace = "http://wixtoolset.org/schemas/v4/wxs/dependency"; | 52 | private static readonly XNamespace WixDependencyNamespace = "http://wixtoolset.org/schemas/v4/wxs/dependency"; |
| 53 | private static readonly XNamespace WixDirectXNamespace = "http://wixtoolset.org/schemas/v4/wxs/directx"; | 53 | private static readonly XNamespace WixDirectXNamespace = "http://wixtoolset.org/schemas/v4/wxs/directx"; |
| 54 | private static readonly XNamespace WixFirewallNamespace = "http://wixtoolset.org/schemas/v4/wxs/firewall"; | 54 | private static readonly XNamespace WixFirewallNamespace = "http://wixtoolset.org/schemas/v4/wxs/firewall"; |
| 55 | private static readonly XNamespace WixIisNamespace = "http://wixtoolset.org/schemas/v4/wxs/iis"; | ||
| 55 | private static readonly XNamespace WixUiNamespace = "http://wixtoolset.org/schemas/v4/wxs/ui"; | 56 | private static readonly XNamespace WixUiNamespace = "http://wixtoolset.org/schemas/v4/wxs/ui"; |
| 56 | private static readonly XNamespace WixUtilNamespace = "http://wixtoolset.org/schemas/v4/wxs/util"; | 57 | private static readonly XNamespace WixUtilNamespace = "http://wixtoolset.org/schemas/v4/wxs/util"; |
| 57 | private static readonly XNamespace WixVSNamespace = "http://wixtoolset.org/schemas/v4/wxs/vs"; | 58 | private static readonly XNamespace WixVSNamespace = "http://wixtoolset.org/schemas/v4/wxs/vs"; |
| @@ -76,6 +77,7 @@ namespace WixToolset.Converters | |||
| 76 | private static readonly XName CustomTableElementName = WixNamespace + "CustomTable"; | 77 | private static readonly XName CustomTableElementName = WixNamespace + "CustomTable"; |
| 77 | private static readonly XName CustomTableRefElementName = WixNamespace + "CustomTableRef"; | 78 | private static readonly XName CustomTableRefElementName = WixNamespace + "CustomTableRef"; |
| 78 | private static readonly XName CatalogElementName = WixNamespace + "Catalog"; | 79 | private static readonly XName CatalogElementName = WixNamespace + "Catalog"; |
| 80 | private static readonly XName CertificateElementName = WixIisNamespace + "Certificate"; | ||
| 79 | private static readonly XName ColumnElementName = WixNamespace + "Column"; | 81 | private static readonly XName ColumnElementName = WixNamespace + "Column"; |
| 80 | private static readonly XName ComponentElementName = WixNamespace + "Component"; | 82 | private static readonly XName ComponentElementName = WixNamespace + "Component"; |
| 81 | private static readonly XName ControlElementName = WixNamespace + "Control"; | 83 | private static readonly XName ControlElementName = WixNamespace + "Control"; |
| @@ -173,7 +175,7 @@ namespace WixToolset.Converters | |||
| 173 | { "http://schemas.microsoft.com/wix/DifxAppExtension", "http://wixtoolset.org/schemas/v4/wxs/difxapp" }, | 175 | { "http://schemas.microsoft.com/wix/DifxAppExtension", "http://wixtoolset.org/schemas/v4/wxs/difxapp" }, |
| 174 | { "http://schemas.microsoft.com/wix/FirewallExtension", WixFirewallNamespace }, | 176 | { "http://schemas.microsoft.com/wix/FirewallExtension", WixFirewallNamespace }, |
| 175 | { "http://schemas.microsoft.com/wix/HttpExtension", "http://wixtoolset.org/schemas/v4/wxs/http" }, | 177 | { "http://schemas.microsoft.com/wix/HttpExtension", "http://wixtoolset.org/schemas/v4/wxs/http" }, |
| 176 | { "http://schemas.microsoft.com/wix/IIsExtension", "http://wixtoolset.org/schemas/v4/wxs/iis" }, | 178 | { "http://schemas.microsoft.com/wix/IIsExtension", WixIisNamespace }, |
| 177 | { "http://schemas.microsoft.com/wix/MsmqExtension", "http://wixtoolset.org/schemas/v4/wxs/msmq" }, | 179 | { "http://schemas.microsoft.com/wix/MsmqExtension", "http://wixtoolset.org/schemas/v4/wxs/msmq" }, |
| 178 | { "http://schemas.microsoft.com/wix/NetFxExtension", "http://wixtoolset.org/schemas/v4/wxs/netfx" }, | 180 | { "http://schemas.microsoft.com/wix/NetFxExtension", "http://wixtoolset.org/schemas/v4/wxs/netfx" }, |
| 179 | { "http://schemas.microsoft.com/wix/PSExtension", "http://wixtoolset.org/schemas/v4/wxs/powershell" }, | 181 | { "http://schemas.microsoft.com/wix/PSExtension", "http://wixtoolset.org/schemas/v4/wxs/powershell" }, |
| @@ -278,6 +280,7 @@ namespace WixToolset.Converters | |||
| 278 | { WixConverter.BootstrapperApplicationRefElementName, this.ConvertBootstrapperApplicationRefElement }, | 280 | { WixConverter.BootstrapperApplicationRefElementName, this.ConvertBootstrapperApplicationRefElement }, |
| 279 | { WixConverter.ApprovedExeForElevationElementName, this.ConvertApprovedExeForElevationElement }, | 281 | { WixConverter.ApprovedExeForElevationElementName, this.ConvertApprovedExeForElevationElement }, |
| 280 | { WixConverter.CatalogElementName, this.ConvertCatalogElement }, | 282 | { WixConverter.CatalogElementName, this.ConvertCatalogElement }, |
| 283 | { WixConverter.CertificateElementName, this.ConvertCertificateElement }, | ||
| 281 | { WixConverter.ColumnElementName, this.ConvertColumnElement }, | 284 | { WixConverter.ColumnElementName, this.ConvertColumnElement }, |
| 282 | { WixConverter.ComponentElementName, this.ConvertComponentElement }, | 285 | { WixConverter.ComponentElementName, this.ConvertComponentElement }, |
| 283 | { WixConverter.ControlElementName, this.ConvertControlElement }, | 286 | { WixConverter.ControlElementName, this.ConvertControlElement }, |
| @@ -864,6 +867,17 @@ namespace WixToolset.Converters | |||
| 864 | } | 867 | } |
| 865 | } | 868 | } |
| 866 | 869 | ||
| 870 | |||
| 871 | private void ConvertCertificateElement(XElement xCertificate) | ||
| 872 | { | ||
| 873 | var xBinaryKey = xCertificate.Attribute("BinaryKey"); | ||
| 874 | if (xBinaryKey != null && this.OnInformation(ConverterTestType.CertificateBinaryKeyIsNowBinaryRef, xCertificate, "The Certificate BinaryKey element has been renamed to BinaryRef.")) | ||
| 875 | { | ||
| 876 | xCertificate.SetAttributeValue("BinaryRef", xBinaryKey.Value); | ||
| 877 | xBinaryKey.Remove(); | ||
| 878 | } | ||
| 879 | } | ||
| 880 | |||
| 867 | private void ConvertColumnElement(XElement element) | 881 | private void ConvertColumnElement(XElement element) |
| 868 | { | 882 | { |
| 869 | var category = element.Attribute("Category"); | 883 | var category = element.Attribute("Category"); |
| @@ -3284,6 +3298,11 @@ namespace WixToolset.Converters | |||
| 3284 | /// A reference to the TARGETDIR Directory was removed. This may cause the Fragment that defined TARGETDIR to not be included in the final output. If this happens, reference a different element in the Fragment to replace the old reference to TARGEDIR. | 3298 | /// A reference to the TARGETDIR Directory was removed. This may cause the Fragment that defined TARGETDIR to not be included in the final output. If this happens, reference a different element in the Fragment to replace the old reference to TARGEDIR. |
| 3285 | /// </summary> | 3299 | /// </summary> |
| 3286 | TargetDirRefRemoved, | 3300 | TargetDirRefRemoved, |
| 3301 | |||
| 3302 | /// <summary> | ||
| 3303 | /// The Certificate BinaryKey element has been renamed to BinaryRef. | ||
| 3304 | /// </summary> | ||
| 3305 | CertificateBinaryKeyIsNowBinaryRef, | ||
| 3287 | } | 3306 | } |
| 3288 | } | 3307 | } |
| 3289 | } | 3308 | } |
diff --git a/src/wix/test/WixToolsetTest.Converters/IisExtensionFixture.cs b/src/wix/test/WixToolsetTest.Converters/IisExtensionFixture.cs new file mode 100644 index 00000000..b20ac90d --- /dev/null +++ b/src/wix/test/WixToolsetTest.Converters/IisExtensionFixture.cs | |||
| @@ -0,0 +1,51 @@ | |||
| 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 WixInternal.TestSupport; | ||
| 8 | using WixToolset.Converters; | ||
| 9 | using WixToolsetTest.Converters.Mocks; | ||
| 10 | using Xunit; | ||
| 11 | |||
| 12 | public class IisExtensionFixture : BaseConverterFixture | ||
| 13 | { | ||
| 14 | [Fact] | ||
| 15 | public void FixCertificateBinaryKey() | ||
| 16 | { | ||
| 17 | var parse = String.Join(Environment.NewLine, | ||
| 18 | "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:iis='http://schemas.microsoft.com/wix/IIsExtension'>", | ||
| 19 | " <Fragment>", | ||
| 20 | " <iis:Certificate BinaryKey=\"SomeBinary\" />", | ||
| 21 | " </Fragment>", | ||
| 22 | " <Fragment>", | ||
| 23 | " <Binary Id=\"SomeBinary\" SourceFile=\"path\\to\\bin.dll\" />", | ||
| 24 | " </Fragment>", | ||
| 25 | "</Wix>"); | ||
| 26 | |||
| 27 | var expected = new[] | ||
| 28 | { | ||
| 29 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:iis=\"http://wixtoolset.org/schemas/v4/wxs/iis\">", | ||
| 30 | " <Fragment>", | ||
| 31 | " <iis:Certificate BinaryRef=\"SomeBinary\" />", | ||
| 32 | " </Fragment>", | ||
| 33 | " <Fragment>", | ||
| 34 | " <Binary Id=\"SomeBinary\" SourceFile=\"path\\to\\bin.dll\" />", | ||
| 35 | " </Fragment>", | ||
| 36 | "</Wix>" | ||
| 37 | }; | ||
| 38 | |||
| 39 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
| 40 | |||
| 41 | var messaging = new MockMessaging(); | ||
| 42 | var converter = new WixConverter(messaging, 2, null, null); | ||
| 43 | |||
| 44 | var errors = converter.ConvertDocument(document); | ||
| 45 | Assert.Equal(3, errors); | ||
| 46 | |||
| 47 | var actualLines = UnformattedDocumentLines(document); | ||
| 48 | WixAssert.CompareLineByLine(expected, actualLines); | ||
| 49 | } | ||
| 50 | } | ||
| 51 | } | ||
