diff options
Diffstat (limited to 'src/WixToolset.Converters/WixConverter.cs')
-rw-r--r-- | src/WixToolset.Converters/WixConverter.cs | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/WixToolset.Converters/WixConverter.cs b/src/WixToolset.Converters/WixConverter.cs index 89d33598..7ac64710 100644 --- a/src/WixToolset.Converters/WixConverter.cs +++ b/src/WixToolset.Converters/WixConverter.cs | |||
@@ -24,6 +24,7 @@ namespace WixToolset.Converters | |||
24 | 24 | ||
25 | private const char XDocumentNewLine = '\n'; // XDocument normalizes "\r\n" to just "\n". | 25 | private const char XDocumentNewLine = '\n'; // XDocument normalizes "\r\n" to just "\n". |
26 | private static readonly XNamespace WixNamespace = "http://wixtoolset.org/schemas/v4/wxs"; | 26 | private static readonly XNamespace WixNamespace = "http://wixtoolset.org/schemas/v4/wxs"; |
27 | private static readonly XNamespace Wix3Namespace = "http://schemas.microsoft.com/wix/2006/wi"; | ||
27 | private static readonly XNamespace WixUtilNamespace = "http://wixtoolset.org/schemas/v4/wxs/util"; | 28 | private static readonly XNamespace WixUtilNamespace = "http://wixtoolset.org/schemas/v4/wxs/util"; |
28 | 29 | ||
29 | private static readonly XName AdminExecuteSequenceElementName = WixNamespace + "AdminExecuteSequence"; | 30 | private static readonly XName AdminExecuteSequenceElementName = WixNamespace + "AdminExecuteSequence"; |
@@ -68,7 +69,11 @@ namespace WixToolset.Converters | |||
68 | private static readonly XName UtilXmlConfigElementName = WixUtilNamespace + "XmlConfig"; | 69 | private static readonly XName UtilXmlConfigElementName = WixUtilNamespace + "XmlConfig"; |
69 | private static readonly XName CustomActionElementName = WixNamespace + "CustomAction"; | 70 | private static readonly XName CustomActionElementName = WixNamespace + "CustomAction"; |
70 | private static readonly XName PropertyElementName = WixNamespace + "Property"; | 71 | private static readonly XName PropertyElementName = WixNamespace + "Property"; |
72 | private static readonly XName Wix4ElementName = WixNamespace + "Wix"; | ||
73 | private static readonly XName Wix3ElementName = Wix3Namespace + "Wix"; | ||
71 | private static readonly XName WixElementWithoutNamespaceName = XNamespace.None + "Wix"; | 74 | private static readonly XName WixElementWithoutNamespaceName = XNamespace.None + "Wix"; |
75 | private static readonly XName Include4ElementName = WixNamespace + "Include"; | ||
76 | private static readonly XName Include3ElementName = Wix3Namespace + "Include"; | ||
72 | private static readonly XName IncludeElementWithoutNamespaceName = XNamespace.None + "Include"; | 77 | private static readonly XName IncludeElementWithoutNamespaceName = XNamespace.None + "Include"; |
73 | 78 | ||
74 | private static readonly Dictionary<string, XNamespace> OldToNewNamespaceMapping = new Dictionary<string, XNamespace>() | 79 | private static readonly Dictionary<string, XNamespace> OldToNewNamespaceMapping = new Dictionary<string, XNamespace>() |
@@ -343,17 +348,17 @@ namespace WixToolset.Converters | |||
343 | 348 | ||
344 | foreach (var declaration in element.Attributes().Where(a => a.IsNamespaceDeclaration)) | 349 | foreach (var declaration in element.Attributes().Where(a => a.IsNamespaceDeclaration)) |
345 | { | 350 | { |
346 | if (WixConverter.OldToNewNamespaceMapping.TryGetValue(declaration.Value, out var ns)) | 351 | if (element.Name == Wix3ElementName || element.Name == Include3ElementName) |
347 | { | 352 | { |
348 | if (Wix3Namespaces.Contains(declaration.Value)) | 353 | this.SourceVersion = 3; |
349 | { | 354 | } |
350 | this.SourceVersion = 3; | 355 | else if (element.Name == Wix4ElementName || element.Name == Include4ElementName) |
351 | } | 356 | { |
352 | else if (Wix4Namespaces.Contains(declaration.Value)) | 357 | this.SourceVersion = 4; |
353 | { | 358 | } |
354 | this.SourceVersion = 4; | ||
355 | } | ||
356 | 359 | ||
360 | if (WixConverter.OldToNewNamespaceMapping.TryGetValue(declaration.Value, out var ns)) | ||
361 | { | ||
357 | if (this.OnError(ConverterTestType.XmlnsValueWrong, declaration, "The namespace '{0}' is out of date. It must be '{1}'.", declaration.Value, ns.NamespaceName)) | 362 | if (this.OnError(ConverterTestType.XmlnsValueWrong, declaration, "The namespace '{0}' is out of date. It must be '{1}'.", declaration.Value, ns.NamespaceName)) |
358 | { | 363 | { |
359 | deprecatedToUpdatedNamespaces.Add(declaration.Value, ns); | 364 | deprecatedToUpdatedNamespaces.Add(declaration.Value, ns); |