public void PopulatesRegistryTableFromRemoveRegistryKey() { var folder = TestData.Get(@"TestData"); using (var fs = new DisposableFileSystem()) { var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); var result = WixRunner.Execute(new[] { "build", Path.Combine(folder, "Registry", "RemoveRegistryKey.wxs"), Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), "-bindpath", Path.Combine(folder, "SingleFile", "data"), "-intermediateFolder", intermediateFolder, "-o", msiPath }); result.AssertSuccess(); Assert.True(File.Exists(msiPath)); var results = Query.QueryDatabase(msiPath, new[] { "Registry" }); WixAssert.CompareLineByLine(new[] { "Registry:RemoveAKeyName\t2\tAKeyName\t-\t\tRemoveRegistryKeyComp", }, results); } }
public void PopulatesAppSearchTablesFromComponentSearch() { var folder = TestData.Get(@"TestData"); using (var fs = new DisposableFileSystem()) { var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); var result = WixRunner.Execute(new[] { "build", Path.Combine(folder, "AppSearch", "ComponentSearch.wxs"), Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), "-bindpath", Path.Combine(folder, "SingleFile", "data"), "-intermediateFolder", intermediateFolder, "-o", msiPath }); result.AssertSuccess(); Assert.True(File.Exists(msiPath)); var results = Query.QueryDatabase(msiPath, new[] { "AppSearch", "CompLocator" }); WixAssert.CompareLineByLine(new[] { "AppSearch:SAMPLECOMPFOUND\tSampleCompSearch", "CompLocator:SampleCompSearch\t{4D9A0D20-D0CC-40DE-B580-EAD38B985217}\t1", }, results); } }
public void PopulatesMsiAssemblyTables() { var folder = TestData.Get(@"TestData"); using (var fs = new DisposableFileSystem()) { var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); var result = WixRunner.Execute(new[] { "build", Path.Combine(folder, "Assembly", "Win32Assembly.wxs"), Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), "-bindpath", Path.Combine(folder, "Assembly", "data"), "-bindpath", Path.Combine(folder, "SingleFile", "data"), "-intermediateFolder", intermediateFolder, "-o", msiPath }); result.AssertSuccess(); Assert.True(File.Exists(msiPath)); var results = Query.QueryDatabase(msiPath, new[] { "MsiAssembly", "MsiAssemblyName" }); WixAssert.CompareLineByLine(new[] { "MsiAssembly:test.txt\tProductFeature\ttest.dll.manifest\t\t1", "MsiAssemblyName:test.txt\tname\tMyApplication.app", "MsiAssemblyName:test.txt\tversion\t1.0.0.0", }, results); } }
public void PopulatesCreateFolderTableForNullKeypathComponents() { var folder = TestData.Get(@"TestData\Components"); using (var fs = new DisposableFileSystem()) { var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); var result = WixRunner.Execute(new[] { "build", Path.Combine(folder, "Package.wxs"), Path.Combine(folder, "PackageComponents.wxs"), "-loc", Path.Combine(folder, "Package.en-us.wxl"), "-bindpath", Path.Combine(folder, "data"), "-intermediateFolder", intermediateFolder, "-o", msiPath }); result.AssertSuccess(); Assert.True(File.Exists(msiPath)); var results = Query.QueryDatabase(msiPath, new[] { "CreateFolder" }); WixAssert.CompareLineByLine(new[] { "CreateFolder:INSTALLFOLDER\tNullKeypathComponent", }, results); } }
public void PopulatesExampleTableBecauseOfEnsureTable() { var folder = TestData.Get(@"TestData"); var extensionPath = Path.GetFullPath(new Uri(typeof(ExampleExtensionFactory).Assembly.CodeBase).LocalPath); using (var fs = new DisposableFileSystem()) { var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); var result = WixRunner.Execute(new[] { "build", Path.Combine(folder, "EnsureTable", "EnsureTable.wxs"), Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), "-ext", extensionPath, "-bindpath", Path.Combine(folder, "SingleFile", "data"), "-intermediateFolder", intermediateFolder, "-o", msiPath }); result.AssertSuccess(); Assert.True(File.Exists(msiPath)); var results = Query.QueryDatabaseByTable(msiPath, new[] { "Wix4Example" }); Assert.Empty(results["Wix4Example"]); } }
public void PopulatesAppSearchTablesFromFileSearch() { var folder = TestData.Get(@"TestData"); using (var fs = new DisposableFileSystem()) { var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); var result = WixRunner.Execute(new[] { "build", Path.Combine(folder, "AppSearch", "FileSearch.wxs"), Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), "-bindpath", Path.Combine(folder, "SingleFile", "data"), "-intermediateFolder", intermediateFolder, "-o", msiPath }); result.AssertSuccess(); Assert.True(File.Exists(msiPath)); var results = Query.QueryDatabase(msiPath, new[] { "AppSearch", "DrLocator", "IniLocator" }); WixAssert.CompareLineByLine(new[] { "AppSearch:SAMPLEFILEFOUND\tSampleFileSearch", "DrLocator:SampleFileSearch\tSampleIniFileSearch\t\t", "IniLocator:SampleFileSearch\tsample.fil\tMySection\tMyKey\t\t1", }, results); } }
public void PopulatesClassTablesWhenIconIndexIsZero() { var folder = TestData.Get(@"TestData"); using (var fs = new DisposableFileSystem()) { var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); var result = WixRunner.Execute(new[] { "build", Path.Combine(folder, "Class", "IconIndex0.wxs"), Path.Combine(folder, "Icon", "SampleIcon.wxs"), Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), "-bindpath", Path.Combine(folder, ".Data"), "-bindpath", Path.Combine(folder, "SingleFile", "data"), "-intermediateFolder", intermediateFolder, "-o", msiPath }); result.AssertSuccess(); Assert.True(File.Exists(msiPath)); var results = Query.QueryDatabase(msiPath, new[] { "Class" }); WixAssert.CompareLineByLine(new[] { "Class:{3FAED4CC-C473-4B8A-BE8B-303871377A4A}\tLocalServer32\tClassComp\t\tFakeClass3FAE\t\t\tSampleIcon\t0\t\t\tProductFeature\t", }, results); } }
public void CanLoadPdbGeneratedByBuild() { var folder = TestData.Get(@"TestData\MultiFileCompressed"); using (var fs = new DisposableFileSystem()) { var intermediateFolder = fs.GetFolder(); var result = WixRunner.Execute(new[] { "build", Path.Combine(folder, "Package.wxs"), Path.Combine(folder, "PackageComponents.wxs"), "-d", "MediaTemplateCompressionLevel", "-loc", Path.Combine(folder, "Package.en-us.wxl"), "-bindpath", Path.Combine(folder, "data"), "-intermediateFolder", intermediateFolder, "-o", Path.Combine(intermediateFolder, @"bin\test.msi") }, out var messages); Assert.Equal(0, result); Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\test.msi"))); Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\cab1.cab"))); var pdbPath = Path.Combine(intermediateFolder, @"bin\test.wixpdb"); Assert.True(File.Exists(pdbPath)); var pdb = Pdb.Load(pdbPath, suppressVersionCheck: true); Assert.NotNull(pdb); Assert.NotNull(pdb.Output); } }
public void CanBuildWixlib() { var folder = TestData.Get(@"TestData\SingleFile"); using (var fs = new DisposableFileSystem()) { var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); var result = WixRunner.Execute(new[] { "build", Path.Combine(folder, "Package.wxs"), Path.Combine(folder, "PackageComponents.wxs"), "-loc", Path.Combine(folder, "Package.en-us.wxl"), "-bindpath", Path.Combine(folder, "data"), "-intermediateFolder", intermediateFolder, "-o", Path.Combine(baseFolder, @"bin\test.wixlib") }, out var messages); Assert.Equal(0, result); var builtFiles = Directory.GetFiles(Path.Combine(baseFolder, @"bin")); Assert.Equal(new[] { "test.wixlib" }, builtFiles.Select(Path.GetFileName).ToArray()); } }
public void RejectsAbsoluteName() { var folder = TestData.Get(@"TestData\Payload"); using (var fs = new DisposableFileSystem()) { var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); var wixlibPath = Path.Combine(intermediateFolder, @"test.wixlib"); var result = WixRunner.Execute(new[] { "build", Path.Combine(folder, "AbsoluteName.wxs"), "-intermediateFolder", intermediateFolder, "-o", wixlibPath, }); Assert.InRange(result.ExitCode, 2, int.MaxValue); var expectedIllegalRelativeLongFileName = 1; var expectedPayloadMustBeRelativeToCache = 2; Assert.Equal(expectedIllegalRelativeLongFileName, result.Messages.Where(m => m.Id == (int)ErrorMessages.Ids.IllegalRelativeLongFilename).Count()); Assert.Equal(expectedPayloadMustBeRelativeToCache, result.Messages.Where(m => m.Id == (int)ErrorMessages.Ids.PayloadMustBeRelativeToCache).Count()); } }
public void CanBuildX86AfterX64Bundle() { var folder = TestData.Get(@"TestData"); using (var fs = new DisposableFileSystem()) { var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); var binFolder = Path.Combine(baseFolder, "bin"); var exePath = Path.Combine(binFolder, "test.exe"); BuildMsiPackages(folder, intermediateFolder, binFolder); var result = WixRunner.Execute(new[] { "build", "-sw1151", // this is expected for this test Path.Combine(folder, "MsiTransaction", "X86AfterX64Bundle.wxs"), Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"), "-bindpath", Path.Combine(folder, "SimpleBundle", "data"), "-bindpath", binFolder, "-intermediateFolder", intermediateFolder, "-o", exePath, }); result.AssertSuccess(); Assert.True(File.Exists(exePath)); } }
public void CanCanonicalizeName() { var folder = TestData.Get(@"TestData\Payload"); using (var fs = new DisposableFileSystem()) { var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); var wixlibPath = Path.Combine(intermediateFolder, @"test.wixlib"); var result = WixRunner.Execute(warningsAsErrors: false, new[] { "build", Path.Combine(folder, "CanonicalizeName.wxs"), "-intermediateFolder", intermediateFolder, "-o", wixlibPath, }); result.AssertSuccess(); Assert.Single(result.Messages, m => m.Id == (int)WarningMessages.Ids.PathCanonicalized); var intermediate = Intermediate.Load(wixlibPath); var allSymbols = intermediate.Sections.SelectMany(s => s.Symbols); var payloadSymbol = allSymbols.OfType <WixBundlePayloadSymbol>() .SingleOrDefault(); Assert.NotNull(payloadSymbol); var fields = payloadSymbol.Fields.Select(field => field?.Type == IntermediateFieldType.Bool ? field.AsNullableNumber()?.ToString() : field?.AsString()) .ToList(); Assert.Equal(@"c\d.exe", fields[(int)WixBundlePayloadSymbolFields.Name]); } }
public void ErrorWhenWrongPackagePayloadInPayloadGroup() { var folder = TestData.Get(@"TestData"); using (var fs = new DisposableFileSystem()) { var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); var bundlePath = Path.Combine(baseFolder, @"bin\test.exe"); var result = WixRunner.Execute(new[] { "build", Path.Combine(folder, "PackagePayload", "WrongPackagePayloadInPayloadGroup.wxs"), Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"), "-bindpath", Path.Combine(folder, "SimpleBundle", "data"), "-bindpath", Path.Combine(folder, ".Data"), "-intermediateFolder", intermediateFolder, "-o", bundlePath, }); Assert.Equal(407, result.ExitCode); WixAssert.CompareLineByLine(new[] { "The ExePackagePayload element can only be used for ExePackages.", "The location of the package related to previous error.", "There is no payload defined for package 'WrongPackagePayloadInPayloadGroup'. This is specified on the MsiPackage element or a child MsiPackagePayload element.", }, result.Messages.Select(m => m.ToString()).ToArray()); } }
public void CanBuildWithOverridableActions() { var folder = TestData.Get(@"TestData\OverridableActions"); using (var fs = new DisposableFileSystem()) { var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); var result = WixRunner.Execute(new[] { "build", Path.Combine(folder, "Package.wxs"), Path.Combine(folder, "PackageComponents.wxs"), "-loc", Path.Combine(folder, "Package.en-us.wxl"), "-bindpath", Path.Combine(folder, "data"), "-intermediateFolder", intermediateFolder, "-o", Path.Combine(baseFolder, @"bin\test.msi") }); result.AssertSuccess(); Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.msi"))); Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb"))); Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\MsiPackage\test.txt"))); var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"test.wir")); var section = intermediate.Sections.Single(); var actions = section.Tuples.OfType <WixActionTuple>().Where(wat => wat.Action.StartsWith("Set")).ToList(); Assert.Equal(2, actions.Count); //Assert.Equal(Path.Combine(folder, @"data\test.txt"), wixFile[WixFileTupleFields.Source].AsPath().Path); //Assert.Equal(@"test.txt", wixFile[WixFileTupleFields.Source].PreviousValue.AsPath().Path); } }
public void VariableRedefinitionIsAWarning() { var folder = TestData.Get(@"TestData\Variables"); using (var fs = new DisposableFileSystem()) { var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); var result = WixRunner.Execute(new[] { "build", Path.Combine(folder, "Package.wxs"), Path.Combine(folder, "PackageComponents.wxs"), "-loc", Path.Combine(folder, "Package.en-us.wxl"), "-bindpath", Path.Combine(folder, "data"), "-intermediateFolder", intermediateFolder, "-o", Path.Combine(baseFolder, @"bin\test.msi") }); result.AssertSuccess(); var warning = result.Messages.Where(message => message.Id == (int)WarningMessages.Ids.VariableDeclarationCollision); Assert.Single(warning); } }
public void CanBuildInstanceTransform() { var folder = TestData.Get(@"TestData\InstanceTransform"); using (var fs = new DisposableFileSystem()) { var intermediateFolder = fs.GetFolder(); var result = WixRunner.Execute(new[] { "build", Path.Combine(folder, "Package.wxs"), Path.Combine(folder, "PackageComponents.wxs"), "-loc", Path.Combine(folder, "Package.en-us.wxl"), "-bindpath", Path.Combine(folder, "data"), "-intermediateFolder", intermediateFolder, "-o", Path.Combine(intermediateFolder, @"bin\test.msi") }, out var messages); Assert.Equal(0, result); var pdb = Pdb.Load(Path.Combine(intermediateFolder, @"bin\test.wixpdb"), false); Assert.NotEmpty(pdb.Output.SubStorages); } }
public void CanPublishComponentWithMultipleFeatureComponents() { var folder = TestData.Get(@"TestData\PublishComponent"); using (var fs = new DisposableFileSystem()) { var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); var result = WixRunner.Execute(new[] { "build", Path.Combine(folder, "Package.wxs"), "-loc", Path.Combine(folder, "Package.en-us.wxl"), "-bindpath", Path.Combine(folder, "data"), "-intermediateFolder", intermediateFolder, "-o", msiPath }); result.AssertSuccess(); Assert.True(File.Exists(msiPath)); var results = Query.QueryDatabase(msiPath, new[] { "PublishComponent" }); WixAssert.CompareLineByLine(new[] { "PublishComponent:{0A82C8F6-9CE9-4336-B8BE-91A39B5F7081} Qualifier2 Component2 AppData2 ProductFeature2", "PublishComponent:{BD245B5A-EC33-46ED-98FF-E9D3D416AD04} Qualifier1 Component1 AppData1 ProductFeature1", }, results); } }
public void CanBuildSingleFileCompressed() { var folder = TestData.Get(@"TestData\SingleFileCompressed"); using (var fs = new DisposableFileSystem()) { var intermediateFolder = fs.GetFolder(); var result = WixRunner.Execute(new[] { "build", Path.Combine(folder, "Package.wxs"), Path.Combine(folder, "PackageComponents.wxs"), "-loc", Path.Combine(folder, "Package.en-us.wxl"), "-bindpath", Path.Combine(folder, "data"), "-intermediateFolder", intermediateFolder, "-o", Path.Combine(intermediateFolder, @"bin\test.msi") }, out var messages); Assert.Equal(0, result); Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\test.msi"))); Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\example.cab"))); Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\test.wixpdb"))); var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"bin\test.wir")); var section = intermediate.Sections.Single(); var wixFile = section.Tuples.OfType <WixFileTuple>().Single(); Assert.Equal(Path.Combine(folder, @"data\test.txt"), wixFile[WixFileTupleFields.Source].AsPath().Path); Assert.Equal(@"test.txt", wixFile[WixFileTupleFields.Source].PreviousValue.AsPath().Path); } }
public void PopulatesAppIdTableWhenAdvertised() { var folder = TestData.Get(@"TestData"); using (var fs = new DisposableFileSystem()) { var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); var result = WixRunner.Execute(new[] { "build", Path.Combine(folder, "AppId", "Advertised.wxs"), Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), "-bindpath", Path.Combine(folder, "SingleFile", "data"), "-intermediateFolder", intermediateFolder, "-o", msiPath }); result.AssertSuccess(); Assert.True(File.Exists(msiPath)); var results = Query.QueryDatabase(msiPath, new[] { "AppId" }); WixAssert.CompareLineByLine(new[] { "AppId:{D6040299-B15C-4C94-AE26-0C9B60D14C35}\t\t\t\t\t\t", }, results); } }
public void CanBuildSingleFileCompressedWithMediaTemplate() { var folder = TestData.Get(@"TestData\SingleFileCompressed"); using (var fs = new DisposableFileSystem()) { var intermediateFolder = fs.GetFolder(); var result = WixRunner.Execute(new[] { "build", Path.Combine(folder, "Package.wxs"), Path.Combine(folder, "PackageComponents.wxs"), "-d", "MediaTemplateCompressionLevel", "-loc", Path.Combine(folder, "Package.en-us.wxl"), "-bindpath", Path.Combine(folder, "data"), "-intermediateFolder", intermediateFolder, "-o", Path.Combine(intermediateFolder, @"bin\test.msi") }, out var messages); Assert.Equal(0, result); Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\test.msi"))); Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\cab1.cab"))); Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\test.wixpdb"))); } }
public void PopulatesClassTablesWhenProgIdIsNestedUnderAdvertisedClass() { var folder = TestData.Get(@"TestData"); using (var fs = new DisposableFileSystem()) { var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); var result = WixRunner.Execute(new[] { "build", Path.Combine(folder, "ProgId", "NestedUnderClass.wxs"), Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), "-bindpath", Path.Combine(folder, "SingleFile", "data"), "-intermediateFolder", intermediateFolder, "-o", msiPath }); result.AssertSuccess(); Assert.True(File.Exists(msiPath)); var results = Query.QueryDatabase(msiPath, new[] { "Class", "ProgId", "Registry" }); WixAssert.CompareLineByLine(new[] { "Class:{F12A6F69-117F-471F-AE73-F8E74218F498}\tLocalServer32\tProgIdComp\t73E7DF7E-EFAC-4E11-90E2-6EBAEB8DE58D\tFakeClassF12A\t\t\t\t\t\t\tProductFeature\t", "ProgId:73E7DF7E-EFAC-4E11-90E2-6EBAEB8DE58D\t\t{F12A6F69-117F-471F-AE73-F8E74218F498}\tFakeClassF12A\t\t", "Registry:regUIIK326nDZpkWHuexeF58EikQvA\t0\t73E7DF7E-EFAC-4E11-90E2-6EBAEB8DE58D\tNoOpen\tNoOpen73E7\tProgIdComp", "Registry:regvrhMurMp98anbQJkpgA8yJCefdM\t0\tCLSID\\{F12A6F69-117F-471F-AE73-F8E74218F498}\\Version\t\t0.0.0.1\tProgIdComp", "Registry:regY1F4E2lvu_Up6gV6c3jeN5ukn8s\t0\tCLSID\\{F12A6F69-117F-471F-AE73-F8E74218F498}\\LocalServer32\tThreadingModel\tApartment\tProgIdComp", }, results); } }
public static void Main(string[] args) { var intermediateFolder = args[0]; var wixlibPath = args[1]; var buildArgs = new List <string>(); buildArgs.Add("build"); buildArgs.Add("-bindfiles"); buildArgs.Add("-bindpath"); buildArgs.Add("Data"); buildArgs.Add("-intermediateFolder"); buildArgs.Add(intermediateFolder); buildArgs.Add("-o"); buildArgs.Add(wixlibPath); foreach (var path in args[2].Split(';')) { buildArgs.Add(path); } var result = WixRunner.Execute(buildArgs.ToArray()); result.AssertSuccess(); }
public void PopulatesEnvironmentTable() { var folder = TestData.Get(@"TestData"); using (var fs = new DisposableFileSystem()) { var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); var result = WixRunner.Execute(new[] { "build", Path.Combine(folder, "Environment", "Environment.wxs"), Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), "-bindpath", Path.Combine(folder, "SingleFile", "data"), "-intermediateFolder", intermediateFolder, "-o", msiPath }); result.AssertSuccess(); Assert.True(File.Exists(msiPath)); var results = Query.QueryDatabase(msiPath, new[] { "Environment" }); WixAssert.CompareLineByLine(new[] { "Environment:PATH\t=-*PATH\t[INSTALLFOLDER]; ;[~]\tWixEnvironmentTest", "Environment:WixEnvironmentTest1\t=-WixEnvTest1\t\tWixEnvironmentTest", "Environment:WixEnvironmentTest2\t+-WixEnvTest1\t\tWixEnvironmentTest", "Environment:WixEnvironmentTest3\t!-WixEnvTest1\t\tWixEnvironmentTest", "Environment:WixEnvironmentTest4\t=-*WIX\t[INSTALLFOLDER]\tWixEnvironmentTest", }, results); } }
public void CanDetectDuplicateComponentGuids() { var folder = TestData.Get(@"TestData"); using (var fs = new DisposableFileSystem()) { var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); var result = WixRunner.Execute(new[] { "build", Path.Combine(folder, "Component", "GuidCollision.wxs"), Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), "-bindpath", Path.Combine(folder, "SingleFile", "data"), "-intermediateFolder", intermediateFolder, "-o", msiPath }); var errors = result.Messages.Where(m => m.Level == MessageLevel.Error); Array.Equals(new[] { 369, 369 }, errors.Select(e => e.Id).ToArray()); } }
public void PopulatesFeatureTableWithParent() { var folder = TestData.Get(@"TestData"); using (var fs = new DisposableFileSystem()) { var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); var result = WixRunner.Execute(new[] { "build", Path.Combine(folder, "FeatureGroup", "FeatureGroup.wxs"), Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), "-bindpath", Path.Combine(folder, "SingleFile", "data"), "-intermediateFolder", intermediateFolder, "-o", msiPath }); result.AssertSuccess(); Assert.True(File.Exists(msiPath)); var results = Query.QueryDatabase(msiPath, new[] { "Feature" }); WixAssert.CompareLineByLine(new[] { "Feature:ChildFeature\tParentFeature\tChildFeatureTitle\t\t2\t1\t\t0", "Feature:ParentFeature\t\tParentFeatureTitle\t\t2\t1\t\t0", "Feature:ProductFeature\t\tMsiPackageTitle\t\t2\t1\t\t0", }, results); } }
public void CanBuildCopyFile() { var folder = TestData.Get(@"TestData"); using (var fs = new DisposableFileSystem()) { var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); var result = WixRunner.Execute(new[] { "build", Path.Combine(folder, "CopyFile", "CopyFile.wxs"), Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), "-bindpath", Path.Combine(folder, "SingleFile", "data"), "-intermediateFolder", intermediateFolder, "-o", msiPath }); result.AssertSuccess(); var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"bin\test.wixpdb")); var section = intermediate.Sections.Single(); var copyFileSymbol = section.Symbols.OfType <MoveFileSymbol>().Single(); Assert.Equal("MoveText", copyFileSymbol.Id.Id); Assert.True(copyFileSymbol.Delete); Assert.Equal("OtherFolder", copyFileSymbol.DestFolder); } }
public void PopulatesLockPermissionsTableWithEmptyPermissions() { var folder = TestData.Get(@"TestData"); using (var fs = new DisposableFileSystem()) { var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); var result = WixRunner.Execute(new[] { "build", Path.Combine(folder, "LockPermissions", "EmptyPermissions.wxs"), Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), "-bindpath", Path.Combine(folder, "SingleFile", "data"), "-intermediateFolder", intermediateFolder, "-o", msiPath }); result.AssertSuccess(); Assert.True(File.Exists(msiPath)); var results = Query.QueryDatabase(msiPath, new[] { "LockPermissions" }); WixAssert.CompareLineByLine(new[] { "LockPermissions:INSTALLFOLDER\tCreateFolder\t\tAdministrator\t0", }, results); } }
public void CanParseCommandLineWithExtension() { var folder = TestData.Get(@"TestData\ExampleExtension"); var extensionPath = Path.GetFullPath(new Uri(typeof(ExampleExtensionFactory).Assembly.CodeBase).LocalPath); using (var fs = new DisposableFileSystem()) { var intermediateFolder = fs.GetFolder(); var result = WixRunner.Execute(new[] { "build", Path.Combine(folder, "Package.wxs"), Path.Combine(folder, "PackageComponents.wxs"), "-loc", Path.Combine(folder, "Package.en-us.wxl"), "-ext", extensionPath, "-bindpath", Path.Combine(folder, "data"), "-intermediateFolder", intermediateFolder, "-example", "test", "-o", Path.Combine(intermediateFolder, @"bin\extest.msi") }, out var messages); Assert.Equal(0, result); var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"bin\extest.wir")); var section = intermediate.Sections.Single(); var property = section.Tuples.OfType <PropertyTuple>().Where(p => p.Id.Id == "ExampleProperty").Single(); Assert.Equal("ExampleProperty", property.Property); Assert.Equal("test", property.Value); } }
public void PopulatesReserveCostTable() { var folder = TestData.Get(@"TestData"); using (var fs = new DisposableFileSystem()) { var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); var result = WixRunner.Execute(new[] { "build", Path.Combine(folder, "ReserveCost", "ReserveCost.wxs"), Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), "-bindpath", Path.Combine(folder, "SingleFile", "data"), "-intermediateFolder", intermediateFolder, "-o", msiPath }); result.AssertSuccess(); Assert.True(File.Exists(msiPath)); var results = Query.QueryDatabase(msiPath, new[] { "ReserveCost" }); WixAssert.CompareLineByLine(new[] { "ReserveCost:TestCost\tReserveCostComp\tINSTALLFOLDER\t100\t200", }, results); } }
public void PopulatesRegistryTableFromRegistryValueMultiString() { var folder = TestData.Get(@"TestData"); using (var fs = new DisposableFileSystem()) { var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); var result = WixRunner.Execute(new[] { "build", Path.Combine(folder, "Registry", "RegistryValueMultiString.wxs"), Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), "-bindpath", Path.Combine(folder, "SingleFile", "data"), "-intermediateFolder", intermediateFolder, "-o", msiPath }); result.AssertSuccess(); var results = Query.QueryDatabase(msiPath, new[] { "Registry" }); WixAssert.CompareLineByLine(new[] { "Registry:regitq_Wx9LfvJuNSc2un6gIHAzr4A\t2\tPath\\To\\AnotherKey\tSecret\t#x\tMultiStringComponent", "Registry:regmeTJMpOD41igfxhTcUVZ7kNG1Mo\t2\tPath\\To\\Key\t\ta[~]b[~][~]c[~]\tMultiStringComponent", }, results); } }