public void FixTagExtensionTagRef() { var parse = String.Join(Environment.NewLine, "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:tag='http://schemas.microsoft.com/wix/TagExtension'>", " <Fragment>", " <PatchFamily>", " <tag:TagRef Regid='wixtoolset.org' />", " </PatchFamily>", " </Fragment>", "</Wix>"); var expected = new[] { "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", " <Fragment>", " <PatchFamily>", " <SoftwareTagRef Regid=\"wixtoolset.org\" />", " </PatchFamily>", " </Fragment>", "</Wix>" }; var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); Assert.Equal(3, errors); var actualLines = UnformattedDocumentLines(document); WixAssert.CompareLineByLine(expected, actualLines); }
public void FixTagExtensionDeprecations() { var parse = String.Join(Environment.NewLine, "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:tag='http://schemas.microsoft.com/wix/TagExtension'>", " <Product>", " <tag:Tag Regid='wixtoolset.org' InstallDirectory='InstallFolder' Licensed='true' Type='component' Win64='yes' />", " </Product>", "</Wix>"); var expected = new[] { "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", " <Package>", " <SoftwareTag Regid=\"wixtoolset.org\" InstallDirectory=\"InstallFolder\" Bitness=\"always64\" />", " </Package>", "</Wix>" }; var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); Assert.Equal(7, errors); var actualLines = UnformattedDocumentLines(document); WixAssert.CompareLineByLine(expected, actualLines); }
public void KeepsDpiAwarenessFromV4() { var parse = String.Join(Environment.NewLine, "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", " <Fragment>", " <BootstrapperApplication Id='ba' SourceFile='ba.dll' DpiAwareness='system' />", " </Fragment>", "</Wix>"); var expected = new[] { "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", " <Fragment>", " <BootstrapperApplication Id=\"ba\">", "<BootstrapperApplicationDll SourceFile=\"ba.dll\" DpiAwareness=\"system\" />", "</BootstrapperApplication>", " </Fragment>", "</Wix>" }; var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); Assert.Equal(1, errors); var actualLines = UnformattedDocumentLines(document); WixAssert.CompareLineByLine(expected, actualLines); }
public void CanConvertMsiCustomTableRef() { var parse = String.Join(Environment.NewLine, "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", " <CustomTable Id='FgAppx'>", " <Row>", " <Data Column='Column1'>Row1</Data>", " </Row>", " </CustomTable>", "</Wix>"); var expected = String.Join(Environment.NewLine, "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", " <CustomTableRef Id=\"FgAppx\">", " <Row>", " <Data Column=\"Column1\" Value=\"Row1\" />", " </Row>", " </CustomTableRef>", "</Wix>"); var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, customTableTarget: CustomTableTarget.Msi); var errors = converter.ConvertDocument(document); var actual = UnformattedDocumentString(document); Assert.Equal(2, errors); Assert.Equal(expected, actual); }
public void FixRemoteAddressValue() { var parse = String.Join(Environment.NewLine, "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:fw='http://schemas.microsoft.com/wix/FirewallExtension'>", " <Fragment>", " <fw:RemoteAddress>", " 127.0.0.1", " </fw:RemoteAddress>", " </Fragment>", "</Wix>"); var expected = new[] { "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:fw=\"http://wixtoolset.org/schemas/v4/wxs/firewall\">", " <Fragment>", " <fw:RemoteAddress Value=\"127.0.0.1\" />", " </Fragment>", "</Wix>" }; var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); Assert.Equal(3, errors); var actualLines = UnformattedDocumentLines(document); WixAssert.CompareLineByLine(expected, actualLines); }
public void CanConvertMissingWixNamespace() { var parse = String.Join(Environment.NewLine, "<?xml version='1.0' encoding='utf-8'?>", "<Wix>", " <Fragment />", "</Wix>"); var expected = String.Join(Environment.NewLine, "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", " <Fragment />", "</Wix>"); var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); var actual = UnformattedDocumentString(document); Assert.Equal(2, errors); Assert.Equal(expected, actual); Assert.Equal(Wix4Namespace, document.Root.GetDefaultNamespace()); }
public void CanConvertRemotePayloadElement() { var parse = String.Join(Environment.NewLine, "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", " <RemotePayload", " Description='Microsoft ASP.NET Core 3.1.8 - Shared Framework'", " Hash='61DC9EAA0C8968E48E13C5913ED202A2F8F94DBA'", " CertificatePublicKey='3756E9BBF4461DCD0AA68E0D1FCFFA9CEA47AC18'", " CertificateThumbprint='2485A7AFA98E178CB8F30C9838346B514AEA4769'", " ProductName='Microsoft ASP.NET Core 3.1.8 - Shared Framework'", " Size='7841880'", " Version='3.1.8.20421' />", "</Wix>"); var expected = String.Join(Environment.NewLine, "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", " <RemotePayload Description=\"Microsoft ASP.NET Core 3.1.8 - Shared Framework\" Hash=\"61DC9EAA0C8968E48E13C5913ED202A2F8F94DBA\" ProductName=\"Microsoft ASP.NET Core 3.1.8 - Shared Framework\" Size=\"7841880\" Version=\"3.1.8.20421\" />", "</Wix>"); var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); var actual = UnformattedDocumentString(document); Assert.Equal(2, errors); Assert.Equal(expected, actual); }
public void RemovesBalUseUILanguages() { var parse = String.Join(Environment.NewLine, "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:bal='http://schemas.microsoft.com/wix/BalExtension'>", " <Fragment>", " <BootstrapperApplication Id='ba' bal:UseUILanguages='true' />", " </Fragment>", "</Wix>"); var expected = new[] { "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", " <Fragment>", " <BootstrapperApplication Id=\"ba\" />", " </Fragment>", "</Wix>" }; var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); Assert.Equal(5, errors); var actualLines = UnformattedDocumentLines(document); WixAssert.CompareLineByLine(expected, actualLines); }
public void FixNamespace() { var parse = String.Join(Environment.NewLine, "<Include xmlns='http://schemas.microsoft.com/wix/2006/wi'>", " <Fragment />", "</Include>"); var expected = new[] { "<Include xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", " <Fragment />", "</Include>" }; var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); Assert.Equal(1, errors); var actualLines = UnformattedDocumentLines(document); WixAssert.CompareLineByLine(expected, actualLines); }
public void FixUtilRegistrySearchBitness() { var parse = String.Join(Environment.NewLine, "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:util='http://schemas.microsoft.com/wix/UtilExtension'>", " <Fragment>", " <util:RegistrySearch Id='RegValue' Root='HKLM' Key='Converter' Variable='Test' />", " <util:RegistrySearch Id='RegValue2' Root='HKLM' Key='Converter' Variable='Test' Result='value' Win64='no' />", " <util:RegistrySearch Id='RegValue3' Root='HKLM' Key='Converter' Variable='Test' Result='exists' Win64='yes' />", " </Fragment>", "</Wix>"); var expected = new[] { "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:util=\"http://wixtoolset.org/schemas/v4/wxs/util\">", " <Fragment>", " <util:RegistrySearch Id=\"RegValue\" Root=\"HKLM\" Key=\"Converter\" Variable=\"Test\" />", " <util:RegistrySearch Id=\"RegValue2\" Root=\"HKLM\" Key=\"Converter\" Variable=\"Test\" Result=\"value\" Bitness=\"always32\" />", " <util:RegistrySearch Id=\"RegValue3\" Root=\"HKLM\" Key=\"Converter\" Variable=\"Test\" Result=\"exists\" Bitness=\"always64\" />", " </Fragment>", "</Wix>" }; var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); Assert.Equal(6, errors); var actualLines = UnformattedDocumentLines(document); WixAssert.CompareLineByLine(expected, actualLines); }
public void CanConvertCustomAction() { var parse = String.Join(Environment.NewLine, "<?xml version='1.0' encoding='utf-8'?>", "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", " <CustomAction Id='Foo' BinaryKey='WixCA' DllEntry='CAQuietExec' />", " <CustomAction Id='Foo' BinaryKey='WixCA_x64' DllEntry='CAQuietExec64' />", " <CustomAction Id='Foo' BinaryKey='UtilCA' DllEntry='WixQuietExec' />", " <CustomAction Id='Foo' BinaryKey='UtilCA_x64' DllEntry='WixQuietExec64' />", "</Wix>"); var expected = String.Join(Environment.NewLine, "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", " <CustomAction Id=\"Foo\" DllEntry=\"WixQuietExec\" BinaryRef=\"Wix4UtilCA_X86\" />", " <CustomAction Id=\"Foo\" DllEntry=\"WixQuietExec64\" BinaryRef=\"Wix4UtilCA_X64\" />", " <CustomAction Id=\"Foo\" DllEntry=\"WixQuietExec\" BinaryRef=\"Wix4UtilCA_X86\" />", " <CustomAction Id=\"Foo\" DllEntry=\"WixQuietExec64\" BinaryRef=\"Wix4UtilCA_X64\" />", "</Wix>"); var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); var actual = UnformattedDocumentString(document); Assert.Equal(11, errors); Assert.Equal(expected, actual); }
public void EnsuresDeclarationWhenIgnored() { var parse = String.Join(Environment.NewLine, "<?xml version='1.0' encoding='utf-16'?>", "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", " <Fragment />", "</Wix>"); var expected = String.Join(Environment.NewLine, "<?xml version=\"1.0\" encoding=\"utf-16\"?>", "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", " <Fragment />", "</Wix>"); var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, ignoreErrors: new[] { "DeclarationPresent" }); var errors = converter.ConvertDocument(document); var actual = UnformattedDocumentString(document, omitXmlDeclaration: false); Assert.Equal(0, errors); Assert.Equal(expected, actual); }
public void RemoveDeprecatedAllowAdvertiseAttributes() { var parse = String.Join(Environment.NewLine, "<?xml version=\"1.0\" encoding=\"utf-16\"?>", "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>", " <Fragment>", " <Feature AllowAdvertise='disallow' />", " </Fragment>", "</Wix>"); var expected = new[] { "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", " <Fragment>", " <Feature />", " </Fragment>", "</Wix>" }; var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); Assert.Equal(3, errors); var actualLines = UnformattedDocumentLines(document); WixAssert.CompareLineByLine(expected, actualLines); }
public void CanKeepCdataWithOnlyWhitespace() { var parse = String.Join(Environment.NewLine, "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", " <Fragment>", " <Property Id='Prop'><![CDATA[ ]]></Property>", " </Fragment>", "</Wix>"); var expected = String.Join(Environment.NewLine, "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", " <Fragment>", " <Property Id=\"Prop\" Value=\" \" />", " </Fragment>", "</Wix>"); var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); var actual = UnformattedDocumentString(document); Assert.Equal(expected, actual); Assert.Equal(1, errors); }
public void FixXmlConfigValue() { var parse = String.Join(Environment.NewLine, "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:util='http://schemas.microsoft.com/wix/UtilExtension'>", " <Fragment>", " <util:XmlConfig Id='Change' ElementPath='book'>", " a<>b", " </util:XmlConfig>", " </Fragment>", "</Wix>"); var expected = new[] { "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:util=\"http://wixtoolset.org/schemas/v4/wxs/util\">", " <Fragment>", " <util:XmlConfig Id=\"Change\" ElementPath=\"book\" Value=\"a<>b\" />", " </Fragment>", "</Wix>" }; var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); Assert.Equal(3, errors); var actualLines = UnformattedDocumentLines(document); WixAssert.CompareLineByLine(expected, actualLines); }
public void FixCloseAppsCondition() { var parse = String.Join(Environment.NewLine, "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:util='http://schemas.microsoft.com/wix/UtilExtension'>", " <Fragment>", " <util:CloseApplication Id='EndApp' Target='example.exe'>", " a<>b", " </util:CloseApplication>", " </Fragment>", "</Wix>"); var expected = new[] { "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:util=\"http://wixtoolset.org/schemas/v4/wxs/util\">", " <Fragment>", " <util:CloseApplication Id=\"EndApp\" Target=\"example.exe\" Condition=\"a<>b\" />", " </Fragment>", "</Wix>" }; var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); Assert.Equal(3, errors); var actualLines = UnformattedDocumentLines(document); WixAssert.CompareLineByLine(expected, actualLines); }
public void CanConvertExePackageCommandToArguments() { var parse = String.Join(Environment.NewLine, "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", " <Fragment>", " <PackageGroup Id='exe'>", " <ExePackage InstallCommand='-install' RepairCommand='-repair' UninstallCommand='-uninstall' SourceFile='test.exe' />", " </PackageGroup>", " </Fragment>", "</Wix>"); var expected = new[] { "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", " <Fragment>", " <PackageGroup Id=\"exe\">", " <ExePackage SourceFile=\"test.exe\" InstallArguments=\"-install\" RepairArguments=\"-repair\" UninstallArguments=\"-uninstall\" />", " </PackageGroup>", " </Fragment>", "</Wix>" }; var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); Assert.Equal(3, errors); var actualLines = UnformattedDocumentLines(document); WixAssert.CompareLineByLine(expected, actualLines); }
public void CanConvertAnonymousFile() { var parse = String.Join(Environment.NewLine, "<?xml version='1.0' encoding='utf-8'?>", "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>", " <File Source='path\\to\\foo.txt' />", "</Wix>"); var expected = String.Join(Environment.NewLine, "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", " <File Id=\"foo.txt\" Source=\"path\\to\\foo.txt\" />", "</Wix>"); var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); var actual = UnformattedDocumentString(document); Assert.Equal(3, errors); Assert.Equal(expected, actual); }
public void FixCondition() { var parse = String.Join(Environment.NewLine, "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>", " <Fragment>", " <InstallUISequence>", " <Custom Action='ExampleCA' After='InstallFiles'>NOT Installed</Custom>", " </InstallUISequence>", " </Fragment>", "</Wix>"); var expected = new[] { "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", " <Fragment>", " <InstallUISequence>", " <Custom Action=\"ExampleCA\" After=\"InstallFiles\" Condition=\"NOT Installed\" />", " </InstallUISequence>", " </Fragment>", "</Wix>" }; var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); Assert.Equal(2, errors); var actualLines = UnformattedDocumentLines(document); WixAssert.CompareLineByLine(expected, actualLines); }
public void CanConvertShortNameDirectoryWithoutName() { var parse = String.Join(Environment.NewLine, "<?xml version='1.0' encoding='utf-8'?>", "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", " <Directory ShortName='iamshort' />", "</Wix>"); var expected = String.Join(Environment.NewLine, "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", " <Directory Name=\"iamshort\" />", "</Wix>"); var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); var actual = UnformattedDocumentString(document); Assert.Equal(2, errors); Assert.Equal(expected, actual); }
public void CantCreateBootstrapperApplicationDllFromV3PayloadGroupRef() { var parse = String.Join(Environment.NewLine, "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>", " <Fragment>", " <BootstrapperApplication Id='ba'>", " <PayloadGroupRef Id='baPayloads' />", " </BootstrapperApplication>", " </Fragment>", "</Wix>"); var expected = new[] { "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", " <Fragment>", " <BootstrapperApplication Id=\"ba\">", " <PayloadGroupRef Id=\"baPayloads\" />", " </BootstrapperApplication>", " </Fragment>", "</Wix>" }; var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); Assert.Equal(2, errors); var actualLines = UnformattedDocumentLines(document); WixAssert.CompareLineByLine(expected, actualLines); }
public void CanConvertNamedMainNamespace() { var parse = String.Join(Environment.NewLine, "<?xml version='1.0' encoding='utf-8'?>", "<w:Wix xmlns:w='http://schemas.microsoft.com/wix/2006/wi'>", " <w:Fragment />", "</w:Wix>"); var expected = String.Join(Environment.NewLine, "<w:Wix xmlns:w=\"http://wixtoolset.org/schemas/v4/wxs\">", " <w:Fragment />", "</w:Wix>"); var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); var actual = UnformattedDocumentString(document); Assert.Equal(2, errors); Assert.Equal(expected, actual); Assert.Equal(Wix4Namespace, document.Root.GetNamespaceOfPrefix("w")); }
public void ConvertStandardBootstrapperApplicationRefWithoutExistingElement() { var parse = String.Join(Environment.NewLine, "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:bal='http://schemas.microsoft.com/wix/BalExtension'>", " <Fragment>", " <BootstrapperApplicationRef Id='WixStandardBootstrapperApplication.RtfLicense' />", " </Fragment>", "</Wix>"); var expected = new[] { "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:bal=\"http://wixtoolset.org/schemas/v4/wxs/bal\">", " <Fragment>", " <BootstrapperApplication>", "<bal:WixStandardBootstrapperApplication Theme=\"rtfLicense\" />", "</BootstrapperApplication>", " </Fragment>", "</Wix>" }; var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); Assert.Equal(3, errors); var actualLines = UnformattedDocumentLines(document); WixAssert.CompareLineByLine(expected, actualLines); }
public void DoesntFixFormattedTypeFromV4() { var parse = String.Join(Environment.NewLine, "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", " <Fragment>", " <Variable Name='ImplicitString' Value='implicit' />", " <Variable Name='ExplicitString' Type='string' Value='explicit' />", " </Fragment>", "</Wix>"); var expected = new[] { "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", " <Fragment>", " <Variable Name=\"ImplicitString\" Value=\"implicit\" />", " <Variable Name=\"ExplicitString\" Type=\"string\" Value=\"explicit\" />", " </Fragment>", "</Wix>" }; var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); Assert.Equal(0, errors); var actualLines = UnformattedDocumentLines(document); WixAssert.CompareLineByLine(expected, actualLines); }
public void ConvertDotNetCoreBootstrapperApplicationRefWithoutExistingElement() { var parse = String.Join(Environment.NewLine, "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs' xmlns:bal='http://wixtoolset.org/schemas/v4/wxs/bal'>", " <Fragment>", " <BootstrapperApplicationRef Id='DotNetCoreBootstrapperApplicationHost' />", " </Fragment>", "</Wix>"); var expected = new[] { "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:bal=\"http://wixtoolset.org/schemas/v4/wxs/bal\">", " <Fragment>", " <BootstrapperApplication>", "<bal:WixDotNetCoreBootstrapperApplicationHost />", "</BootstrapperApplication>", " </Fragment>", "</Wix>" }; var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); Assert.Equal(1, errors); var actualLines = UnformattedDocumentLines(document); WixAssert.CompareLineByLine(expected, actualLines); }
public void CanConvertMspYesCache() { var parse = String.Join(Environment.NewLine, "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", " <Fragment>", " <PackageGroup Id='exe'>", " <MspPackage Cache='yes' SourceFile='test.msp' />", " </PackageGroup>", " </Fragment>", "</Wix>"); var expected = new[] { "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", " <Fragment>", " <PackageGroup Id=\"exe\">", " <MspPackage Cache=\"keep\" SourceFile=\"test.msp\" />", " </PackageGroup>", " </Fragment>", "</Wix>" }; var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); Assert.Equal(1, errors); var actualLines = UnformattedDocumentLines(document); WixAssert.CompareLineByLine(expected, actualLines); }
public void CanConvertMsiCustomTableBootstrapperApplicationData() { var parse = String.Join(Environment.NewLine, "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", " <CustomTable Id='FgAppx' BootstrapperApplicationData='yes'>", " <Column Id='Column1' PrimaryKey='yes' Type='string' Width='0' Category='text' Description='The first custom column.' />", " <Row>", " <Data Column='Column1'>Row1</Data>", " </Row>", " </CustomTable>", "</Wix>"); var expected = String.Join(Environment.NewLine, "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", " <CustomTable Id=\"FgAppx\" Unreal=\"yes\">", " <Column Id=\"Column1\" PrimaryKey=\"yes\" Type=\"string\" Width=\"0\" Category=\"text\" Description=\"The first custom column.\" />", " <Row>", " <Data Column=\"Column1\" Value=\"Row1\" />", " </Row>", " </CustomTable>", "</Wix>"); var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, customTableTarget: CustomTableTarget.Msi); var errors = converter.ConvertDocument(document); var actual = UnformattedDocumentString(document); Assert.Equal(2, errors); Assert.Equal(expected, actual); }
public void FixComponentBitness() { var parse = String.Join(Environment.NewLine, "<?xml version=\"1.0\" encoding=\"utf-16\"?>", "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>", " <Fragment>", " <Component>", " <File Source='default.exe' />", " </Component>", " <Component Win64='no'>", " <File Source='32bit.exe' />", " </Component>", " <Component Win64='yes'>", " <File Source='64bit.exe' />", " </Component>", " <Component Win64='$(var.Win64)'>", " <File Source='unconvert.exe' />", " </Component>", " </Fragment>", "</Wix>"); var expected = new[] { "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", " <Fragment>", " <Component>", " <File Id=\"default.exe\" Source=\"default.exe\" />", " </Component>", " <Component Bitness=\"always32\">", " <File Id=\"_32bit.exe\" Source=\"32bit.exe\" />", " </Component>", " <Component Bitness=\"always64\">", " <File Id=\"_64bit.exe\" Source=\"64bit.exe\" />", " </Component>", " <Component Bitness=\"$(var.Win64)\">", " <File Id=\"unconvert.exe\" Source=\"unconvert.exe\" />", " </Component>", " </Fragment>", "</Wix>" }; var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); Assert.Equal(10, errors); var actualLines = UnformattedDocumentLines(document); WixAssert.CompareLineByLine(expected, actualLines); }
private static void AssertSuccess(string input, int expectedErrorCount, string[] expected) { var document = XDocument.Parse(input, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); Assert.Equal(expectedErrorCount, errors); var actualLines = UnformattedDocumentLines(document); WixAssert.CompareLineByLine(expected, actualLines); }
public void FixRegistrySearchBitness() { var parse = String.Join(Environment.NewLine, "<?xml version=\"1.0\" encoding=\"utf-16\"?>", "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>", " <Fragment>", " <Property Id='BITNESSDEFAULT'>", " <RegistrySearch Id='SampleRegSearch' Root='HKLM' Key='SampleReg' Type='raw'></RegistrySearch>", " </Property>", " <Property Id='BITNESS32'>", " <RegistrySearch Id='SampleRegSearch' Root='HKLM' Key='SampleReg' Type='raw' Win64='no'></RegistrySearch>", " </Property>", " <Property Id='BITNESS64'>", " <RegistrySearch Id='SampleRegSearch' Root='HKLM' Key='SampleReg' Type='raw' Win64='yes'></RegistrySearch>", " </Property>", " </Fragment>", "</Wix>"); var expected = new[] { "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", " <Fragment>", " <Property Id=\"BITNESSDEFAULT\">", " <RegistrySearch Id=\"SampleRegSearch\" Root=\"HKLM\" Key=\"SampleReg\" Type=\"raw\"></RegistrySearch>", " </Property>", " <Property Id=\"BITNESS32\">", " <RegistrySearch Id=\"SampleRegSearch\" Root=\"HKLM\" Key=\"SampleReg\" Type=\"raw\" Bitness=\"always32\"></RegistrySearch>", " </Property>", " <Property Id=\"BITNESS64\">", " <RegistrySearch Id=\"SampleRegSearch\" Root=\"HKLM\" Key=\"SampleReg\" Type=\"raw\" Bitness=\"always64\"></RegistrySearch>", " </Property>", " </Fragment>", "</Wix>" }; var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); var messaging = new MockMessaging(); var converter = new WixConverter(messaging, 2, null, null); var errors = converter.ConvertDocument(document); Assert.Equal(4, errors); var actualLines = UnformattedDocumentLines(document); WixAssert.CompareLineByLine(expected, actualLines); }