Get() 공개 정적인 메소드

public static Get ( int count = 10 ) : IList
count int
리턴 IList
예제 #1
0
        public void CanBuildHeatFileWithMultipleFilesPackage(BuildSystem buildSystem)
        {
            var sourceFolder = TestData.Get(@"TestData\HeatFileMultipleFilesSameFileName");

            using (var fs = new TestDataFolderFileSystem())
            {
                fs.Initialize(sourceFolder);
                var baseFolder         = fs.BaseFolder;
                var binFolder          = Path.Combine(baseFolder, @"bin\");
                var intermediateFolder = Path.Combine(baseFolder, @"obj\");
                var projectPath        = Path.Combine(baseFolder, "HeatFileMultipleFilesSameFileName.wixproj");

                var result = MsbuildUtilities.BuildProject(buildSystem, projectPath);
                result.AssertSuccess();

                var heatCommandLines = MsbuildUtilities.GetToolCommandLines(result, "heat", "file", buildSystem, true);
                Assert.Equal(2, heatCommandLines.Count());

                var warnings = result.Output.Where(line => line.Contains(": warning"));
                Assert.Empty(warnings);

                var generatedFilePath = Path.Combine(intermediateFolder, "x86", "Release", "_TxtProductComponents_INSTALLFOLDER_MyProgram.txt_file.wxs");
                Assert.True(File.Exists(generatedFilePath));

                var generatedContents = File.ReadAllText(generatedFilePath);
                var testXml           = generatedContents.GetTestXml();
                Assert.Equal("<Wix>" +
                             "<Fragment>" +
                             "<DirectoryRef Id='INSTALLFOLDER'>" +
                             "<Component Id='MyProgram.txt' Guid='*'>" +
                             @"<File Id='MyProgram.txt' KeyPath='yes' Source='SourceDir\MyProgram.txt' />" +
                             "</Component>" +
                             "</DirectoryRef>" +
                             "</Fragment>" +
                             "<Fragment>" +
                             "<ComponentGroup Id='TxtProductComponents'>" +
                             "<ComponentRef Id='MyProgram.txt' />" +
                             "</ComponentGroup>" +
                             "</Fragment>" +
                             "</Wix>", testXml);

                generatedFilePath = Path.Combine(intermediateFolder, "x86", "Release", "_JsonProductComponents_INSTALLFOLDER_MyProgram.json_file.wxs");
                Assert.True(File.Exists(generatedFilePath));

                generatedContents = File.ReadAllText(generatedFilePath);
                testXml           = generatedContents.GetTestXml();
                Assert.Equal("<Wix>" +
                             "<Fragment>" +
                             "<DirectoryRef Id='INSTALLFOLDER'>" +
                             "<Component Id='MyProgram.json' Guid='*'>" +
                             @"<File Id='MyProgram.json' KeyPath='yes' Source='SourceDir\MyProgram.json' />" +
                             "</Component>" +
                             "</DirectoryRef>" +
                             "</Fragment>" +
                             "<Fragment>" +
                             "<ComponentGroup Id='JsonProductComponents'>" +
                             "<ComponentRef Id='MyProgram.json' />" +
                             "</ComponentGroup>" +
                             "</Fragment>" +
                             "</Wix>", testXml);

                var pdbPath = Path.Combine(binFolder, "x86", "Release", "HeatFileMultipleFilesSameFileName.wixpdb");
                Assert.True(File.Exists(pdbPath));

                var intermediate = Intermediate.Load(pdbPath);
                var section      = intermediate.Sections.Single();

                var fileSymbols = section.Symbols.OfType <FileSymbol>().ToArray();
                Assert.Equal(@"SourceDir\MyProgram.txt", fileSymbols[0][FileSymbolFields.Source].PreviousValue.AsPath()?.Path);
                Assert.Equal(@"SourceDir\MyProgram.json", fileSymbols[1][FileSymbolFields.Source].PreviousValue.AsPath()?.Path);
            }
        }
예제 #2
0
        public void HarvestedPayloadsArePutInCorrectPackage()
        {
            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 bundlePath         = Path.Combine(binFolder, "test.exe");
                var baFolderPath       = Path.Combine(baseFolder, "ba");
                var extractFolderPath  = Path.Combine(baseFolder, "extract");

                this.BuildMsis(folder, intermediateFolder, binFolder);

                var result = WixRunner.Execute(new[]
                {
                    "build",
                    Path.Combine(folder, "Container", "HarvestIntoDetachedContainer.wxs"),
                    Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"),
                    "-bindpath", Path.Combine(folder, "SimpleBundle", "data"),
                    "-bindpath", binFolder,
                    "-intermediateFolder", intermediateFolder,
                    "-o", bundlePath
                });

                result.AssertSuccess();

                Assert.True(File.Exists(bundlePath));

                var extractResult = BundleExtractor.ExtractBAContainer(null, bundlePath, baFolderPath, extractFolderPath);
                extractResult.AssertSuccess();

                var ignoreAttributes = new Dictionary <string, List <string> >
                {
                    { "MsiPackage", new List <string> {
                          "CacheId", "InstallSize", "Size", "ProductCode"
                      } },
                    { "Provides", new List <string> {
                          "Key"
                      } },
                };
                var msiPackages = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:Chain/burn:MsiPackage")
                                  .Cast <XmlElement>()
                                  .Select(e => e.GetTestXml(ignoreAttributes))
                                  .ToArray();
                WixAssert.CompareLineByLine(new string[]
                {
                    "<MsiPackage Id='FirstX86.msi' Cache='keep' CacheId='*' InstallSize='*' Size='*' PerMachine='yes' Permanent='no' Vital='yes' RollbackBoundaryForward='WixDefaultBoundary' LogPathVariable='WixBundleLog_FirstX86.msi' RollbackLogPathVariable='WixBundleRollbackLog_FirstX86.msi' ProductCode='*' Language='1033' Version='1.0.0.0' UpgradeCode='{12E4699F-E774-4D05-8A01-5BDD41BBA127}'>" +
                    "<MsiProperty Id='ARPSYSTEMCOMPONENT' Value='1' />" +
                    "<Provides Key='*' Version='1.0.0.0' DisplayName='MsiPackage' />" +
                    "<RelatedPackage Id='{12E4699F-E774-4D05-8A01-5BDD41BBA127}' MaxVersion='1.0.0.0' MaxInclusive='no' OnlyDetect='no' LangInclusive='no'><Language Id='1033' /></RelatedPackage>" +
                    "<RelatedPackage Id='{12E4699F-E774-4D05-8A01-5BDD41BBA127}' MinVersion='1.0.0.0' MinInclusive='no' OnlyDetect='yes' LangInclusive='no'><Language Id='1033' /></RelatedPackage>" +
                    "<PayloadRef Id='FirstX86.msi' />" +
                    "<PayloadRef Id='fk1m38Cf9RZ2Bx_ipinRY6BftelU' />" +
                    "</MsiPackage>",
                    "<MsiPackage Id='FirstX64.msi' Cache='keep' CacheId='*' InstallSize='*' Size='*' PerMachine='yes' Permanent='no' Vital='yes' RollbackBoundaryBackward='WixDefaultBoundary' LogPathVariable='WixBundleLog_FirstX64.msi' RollbackLogPathVariable='WixBundleRollbackLog_FirstX64.msi' ProductCode='*' Language='1033' Version='1.0.0.0' UpgradeCode='{12E4699F-E774-4D05-8A01-5BDD41BBA127}'>" +
                    "<MsiProperty Id='ARPSYSTEMCOMPONENT' Value='1' />" +
                    "<Provides Key='*' Version='1.0.0.0' DisplayName='MsiPackage' />" +
                    "<RelatedPackage Id='{12E4699F-E774-4D05-8A01-5BDD41BBA127}' MaxVersion='1.0.0.0' MaxInclusive='no' OnlyDetect='no' LangInclusive='no'><Language Id='1033' /></RelatedPackage>" +
                    "<RelatedPackage Id='{12E4699F-E774-4D05-8A01-5BDD41BBA127}' MinVersion='1.0.0.0' MinInclusive='no' OnlyDetect='yes' LangInclusive='no'><Language Id='1033' /></RelatedPackage>" +
                    "<PayloadRef Id='FirstX64.msi' />" +
                    "<PayloadRef Id='fC0n41rZK8oW3JK8LzHu6AT3CjdQ' />" +
                    "</MsiPackage>",
                }, msiPackages);
            }
        }
예제 #3
0
        public void CanBuildHeatProjectSdkStyle(BuildSystem buildSystem, bool useToolsVersion)
        {
            var sourceFolder = TestData.Get(@"TestData\HeatProject");

            using (var fs = new TestDataFolderFileSystem())
            {
                fs.Initialize(sourceFolder);
                var baseFolder            = Path.Combine(fs.BaseFolder, "HeatProjectSdkStyle");
                var binFolder             = Path.Combine(baseFolder, @"bin\");
                var intermediateFolder    = Path.Combine(baseFolder, @"obj\");
                var projectPath           = Path.Combine(baseFolder, "HeatProjectSdkStyle.wixproj");
                var referencedProjectPath = Path.Combine(fs.BaseFolder, "SdkStyleCs", "SdkStyleCs.csproj");

                var result = MsbuildUtilities.BuildProject(buildSystem, referencedProjectPath, new[]
                {
                    "-t:restore",
                });
                result.AssertSuccess();

                result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[]
                {
                    useToolsVersion ? $"-p:HarvestProjectsUseToolsVersion=true" : String.Empty,
                });
                result.AssertSuccess();

                var heatCommandLines = MsbuildUtilities.GetToolCommandLines(result, "heat", "project", buildSystem, true);
                var heatCommandLine  = Assert.Single(heatCommandLines);

                if (useToolsVersion && buildSystem != BuildSystem.DotNetCoreSdk)
                {
                    Assert.Contains("-usetoolsversion", heatCommandLine);
                }
                else
                {
                    Assert.DoesNotContain("-usetoolsversion", heatCommandLine);
                }

                var warnings = result.Output.Where(line => line.Contains(": warning"));
                Assert.Empty(warnings);

                var generatedFilePath = Path.Combine(intermediateFolder, "x86", "Release", "_SdkStyleCs.wxs");
                Assert.True(File.Exists(generatedFilePath));

                var generatedContents = File.ReadAllText(generatedFilePath);
                var testXml           = generatedContents.GetTestXml();
                Assert.Equal(@"<Wix>" +
                             "<Fragment>" +
                             "<DirectoryRef Id='SdkStyleCs.Binaries'>" +
                             "<Component Id='SdkStyleCs.Binaries.SdkStyleCs.dll' Guid='*'>" +
                             "<File Id='SdkStyleCs.Binaries.SdkStyleCs.dll' Source='$(var.SdkStyleCs.TargetDir)\\SdkStyleCs.dll' />" +
                             "</Component>" +
                             "</DirectoryRef>" +
                             "</Fragment>" +
                             "<Fragment>" +
                             "<ComponentGroup Id='SdkStyleCs.Binaries'>" +
                             "<ComponentRef Id='SdkStyleCs.Binaries.SdkStyleCs.dll' />" +
                             "</ComponentGroup>" +
                             "</Fragment>" +
                             "<Fragment>" +
                             "<DirectoryRef Id='SdkStyleCs.Symbols'>" +
                             "<Component Id='SdkStyleCs.Symbols.SdkStyleCs.pdb' Guid='*'>" +
                             "<File Id='SdkStyleCs.Symbols.SdkStyleCs.pdb' Source='$(var.SdkStyleCs.TargetDir)\\SdkStyleCs.pdb' />" +
                             "</Component>" +
                             "</DirectoryRef>" +
                             "</Fragment>" +
                             "<Fragment>" +
                             "<ComponentGroup Id='SdkStyleCs.Symbols'>" +
                             "<ComponentRef Id='SdkStyleCs.Symbols.SdkStyleCs.pdb' />" +
                             "</ComponentGroup>" +
                             "</Fragment>" +
                             "<Fragment>" +
                             "<DirectoryRef Id='SdkStyleCs.Sources'>" +
                             "<Component Id='SdkStyleCs.Sources.SdkStyleCs.cs' Guid='*'>" +
                             "<File Id='SdkStyleCs.Sources.SdkStyleCs.cs' Source='$(var.SdkStyleCs.ProjectDir)\\SdkStyleCs.cs' />" +
                             "</Component>" +
                             "<Component Id='SdkStyleCs.Sources.SdkStyleCs.csproj' Guid='*'>" +
                             "<File Id='SdkStyleCs.Sources.SdkStyleCs.csproj' Source='$(var.SdkStyleCs.ProjectDir)\\SdkStyleCs.csproj' />" +
                             "</Component>" +
                             "</DirectoryRef>" +
                             "</Fragment>" +
                             "<Fragment>" +
                             "<ComponentGroup Id='SdkStyleCs.Sources'>" +
                             "<ComponentRef Id='SdkStyleCs.Sources.SdkStyleCs.cs' />" +
                             "<ComponentRef Id='SdkStyleCs.Sources.SdkStyleCs.csproj' />" +
                             "</ComponentGroup>" +
                             "</Fragment>" +
                             "<Fragment>" +
                             "<ComponentGroup Id='SdkStyleCs.Content' />" +
                             "</Fragment>" +
                             "<Fragment>" +
                             "<ComponentGroup Id='SdkStyleCs.Satellites' />" +
                             "</Fragment>" +
                             "<Fragment>" +
                             "<ComponentGroup Id='SdkStyleCs.Documents' />" +
                             "</Fragment>" +
                             "</Wix>", testXml);

                var pdbPath = Path.Combine(binFolder, "x86", "Release", "HeatProjectSdkStyle.wixpdb");
                Assert.True(File.Exists(pdbPath));

                var intermediate = Intermediate.Load(pdbPath);
                var section      = intermediate.Sections.Single();

                var fileSymbol = section.Symbols.OfType <FileSymbol>().Single();
                Assert.Equal(Path.Combine(fs.BaseFolder, "SdkStyleCs", "bin", "Release", "netstandard2.0\\\\SdkStyleCs.dll"), fileSymbol[FileSymbolFields.Source].AsPath()?.Path);
            }
        }
예제 #4
0
        public void CanBuildWithExtensionUsingMultipleWixlibs()
        {
            var folder        = TestData.Get(@"TestData\ComplexExampleExtension");
            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 result = WixRunner.Execute(new[]
                {
                    "build",
                    Path.Combine(folder, "PackageComponents.wxs"),
                    "-ext", extensionPath,
                    "-intermediateFolder", intermediateFolder,
                    "-o", Path.Combine(intermediateFolder, @"components.wixlib")
                });

                result.AssertSuccess();

                result = WixRunner.Execute(new[]
                {
                    "build",
                    Path.Combine(folder, "OtherComponents.wxs"),
                    "-ext", extensionPath,
                    "-intermediateFolder", intermediateFolder,
                    "-o", Path.Combine(intermediateFolder, @"other.wixlib")
                });

                result.AssertSuccess();

                result = WixRunner.Execute(new[]
                {
                    "build",
                    Path.Combine(folder, "Package.wxs"),
                    "-loc", Path.Combine(folder, "Package.en-us.wxl"),
                    "-lib", Path.Combine(intermediateFolder, @"components.wixlib"),
                    "-lib", Path.Combine(intermediateFolder, @"other.wixlib"),
                    "-ext", extensionPath,
                    "-bindpath", Path.Combine(folder, "data"),
                    "-intermediateFolder", intermediateFolder,
                    "-o", Path.Combine(intermediateFolder, @"bin\test.msi")
                });

                result.AssertSuccess();

                var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"bin\test.wixpdb"));
                var section      = intermediate.Sections.Single();

                var fileSymbols = section.Symbols.OfType <FileSymbol>().OrderBy(t => Path.GetFileName(t.Source.Path)).ToArray();
                Assert.Equal(Path.Combine(folder, @"data\example.txt"), fileSymbols[0][FileSymbolFields.Source].AsPath().Path);
                Assert.Equal(@"example.txt", fileSymbols[0][FileSymbolFields.Source].PreviousValue.AsPath().Path);
                Assert.Equal(Path.Combine(folder, @"data\other.txt"), fileSymbols[1][FileSymbolFields.Source].AsPath().Path);
                Assert.Equal(@"other.txt", fileSymbols[1][FileSymbolFields.Source].PreviousValue.AsPath().Path);

                var examples = section.Symbols.Where(t => t.Definition.Type == SymbolDefinitionType.MustBeFromAnExtension).ToArray();
                Assert.Equal(new string[] { "Foo", "Other" }, examples.Select(t => t.Id?.Id).ToArray());
                Assert.Equal(new[] { "Bar", "Value" }, examples.Select(t => t[0].AsString()).ToArray());
            }
        }
예제 #5
0
        protected override void InitTestData()
        {
            itemName = TestData.Get("MapName");

            startActivity = new WorkflowActivity(TestData.Get("startActivityName"), 20, 20);
            endActivity   = new WorkflowActivity(TestData.Get("endActivityName"), 200, 20);

            planningActivity = new WorkflowActivity(TestData.Get("planningActivityName"), 200, 20)
            {
                EscalateTo = "Innovator Admin",
                Label      = TestData.Get("planningActivityLabel"),
                Icon       = "AddSearchCriteria.svg"
            };

            confirmingActivity = new WorkflowActivity(TestData.Get("confirmingActivityName"), 400, 20)
            {
                EscalateTo = "Innovator Admin",
                Icon       = "AddMilestone.svg"
            };

            defaultPath = new WorkflowPath(startActivity, endActivity);

            intermediatePath = new WorkflowPath(planningActivity, endActivity);

            goPath = new WorkflowPath(startActivity, planningActivity)
            {
                Name = TestData.Get("goPathName")
            };

            confirmPath = new WorkflowPath(planningActivity, confirmingActivity)
            {
                Name  = TestData.Get("confirmPathName"),
                Label = TestData.Get("confirmPathLabel")
            };

            finishPath = new WorkflowPath(confirmingActivity, endActivity)
            {
                Name = TestData.Get("finishPathName")
            };

            workflowMap = new WorkflowMap(itemName)
            {
                Label        = TestData.Get("MapLabel"),
                ProcessOwner = "Innovator Admin",
                Description  = TestData.Get("MapDescription"),
                Activities   = new List <WorkflowActivity>
                {
                    startActivity, planningActivity, confirmingActivity, endActivity
                },
                Paths = new List <WorkflowPath> {
                    goPath, confirmPath, finishPath
                }
            };

            identityNameLabel = Actor.AsksFor(LocaleState.LabelOf.GridColumn("Identity", "name"));

            votingWeightLabel =
                Actor.AsksFor(LocaleState.LabelOf.GridColumn("Activity Template Assignment", "voting_weight"));

            assignmentCriteria = new Dictionary <string, string>
            {
                [identityNameLabel] = Actor.ActorInfo.LoginName
            };

            var mapNameLabel = Actor.AsksFor(LocaleState.LabelOf.GridColumn("Workflow Map", "name"));

            workflowSearchCriteria = new Dictionary <string, string>
            {
                [mapNameLabel] = workflowMap.Name
            };
        }
예제 #6
0
        public void CanBuildSimpleBundle()
        {
            var folder = TestData.Get(@"TestData\SimpleBundle");

            using (var fs = new DisposableFileSystem())
            {
                var baseFolder         = fs.GetFolder();
                var intermediateFolder = Path.Combine(baseFolder, "obj");
                var exePath            = Path.Combine(baseFolder, @"bin\test.exe");
                var pdbPath            = Path.Combine(baseFolder, @"bin\test.wixpdb");
                var baFolderPath       = Path.Combine(baseFolder, "ba");
                var extractFolderPath  = Path.Combine(baseFolder, "extract");

                var result = WixRunner.Execute(new[]
                {
                    "build",
                    Path.Combine(folder, "Bundle.wxs"),
                    "-loc", Path.Combine(folder, "Bundle.en-us.wxl"),
                    "-bindpath", Path.Combine(folder, "data"),
                    "-intermediateFolder", intermediateFolder,
                    "-o", exePath,
                });

                result.AssertSuccess();
                Assert.Empty(result.Messages.Where(m => m.Level == MessageLevel.Warning));

                Assert.True(File.Exists(exePath));
                Assert.True(File.Exists(pdbPath));

                using (var wixOutput = WixOutput.Read(pdbPath))
                {
                    var intermediate = Intermediate.Load(wixOutput);
                    var section      = intermediate.Sections.Single();

                    var bundleSymbol = section.Symbols.OfType <WixBundleSymbol>().Single();
                    Assert.Equal("1.0.0.0", bundleSymbol.Version);

                    var previousVersion = bundleSymbol.Fields[(int)WixBundleSymbolFields.Version].PreviousValue;
                    Assert.Equal("!(bind.packageVersion.test.msi)", previousVersion.AsString());

                    var msiSymbol = section.Symbols.OfType <WixBundlePackageSymbol>().Single();
                    Assert.Equal("test.msi", msiSymbol.Id.Id);

                    var extractResult = BundleExtractor.ExtractBAContainer(null, exePath, baFolderPath, extractFolderPath);
                    extractResult.AssertSuccess();

                    var burnManifestData          = wixOutput.GetData(BurnConstants.BurnManifestWixOutputStreamName);
                    var extractedBurnManifestData = File.ReadAllText(Path.Combine(baFolderPath, "manifest.xml"), Encoding.UTF8);
                    Assert.Equal(extractedBurnManifestData, burnManifestData);

                    var baManifestData          = wixOutput.GetData(BurnConstants.BootstrapperApplicationDataWixOutputStreamName);
                    var extractedBaManifestData = File.ReadAllText(Path.Combine(baFolderPath, "BootstrapperApplicationData.xml"), Encoding.UTF8);
                    Assert.Equal(extractedBaManifestData, baManifestData);

                    var bextManifestData          = wixOutput.GetData(BurnConstants.BundleExtensionDataWixOutputStreamName);
                    var extractedBextManifestData = File.ReadAllText(Path.Combine(baFolderPath, "BundleExtensionData.xml"), Encoding.UTF8);
                    Assert.Equal(extractedBextManifestData, bextManifestData);

                    var logElements = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:Log");
                    var logElement  = (XmlNode)Assert.Single(logElements);
                    Assert.Equal("<Log PathVariable='WixBundleLog' Prefix='~TestBundle' Extension='log' />", logElement.GetTestXml());

                    var registrationElements = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:Registration");
                    var registrationElement  = (XmlNode)Assert.Single(registrationElements);
                    Assert.Equal($"<Registration Id='{bundleSymbol.BundleId}' ExecutableName='test.exe' PerMachine='yes' Tag='' Version='1.0.0.0' ProviderKey='{bundleSymbol.BundleId}'>" +
                                 "<Arp Register='yes' DisplayName='~TestBundle' DisplayVersion='1.0.0.0' Publisher='Example Corporation' />" +
                                 "</Registration>", registrationElement.GetTestXml());

                    var msiPayloads = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:Payload[@Id='test.msi']");
                    var msiPayload  = (XmlNode)Assert.Single(msiPayloads);
                    Assert.Equal("<Payload Id='test.msi' FilePath='test.msi' FileSize='*' Hash='*' Packaging='embedded' SourcePath='a0' Container='WixAttachedContainer' />",
                                 msiPayload.GetTestXml(new Dictionary <string, List <string> >()
                    {
                        { "Payload", new List <string> {
                              "FileSize", "Hash"
                          } }
                    }));
                }

                var manifestResource = new Resource(ResourceType.Manifest, "#1", 1033);
                manifestResource.Load(exePath);
                var actualManifestData = Encoding.UTF8.GetString(manifestResource.Data);
                Assert.Equal("<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                             "<assembly manifestVersion=\"1.0\" xmlns=\"urn:schemas-microsoft-com:asm.v1\">" +
                             "<assemblyIdentity name=\"test.exe\" version=\"1.0.0.0\" processorArchitecture=\"x86\" type=\"win32\" />" +
                             "<description>~TestBundle</description>" +
                             "<dependency><dependentAssembly><assemblyIdentity name=\"Microsoft.Windows.Common-Controls\" version=\"6.0.0.0\" processorArchitecture=\"x86\" publicKeyToken=\"6595b64144ccf1df\" language=\"*\" type=\"win32\" /></dependentAssembly></dependency>" +
                             "<compatibility xmlns=\"urn:schemas-microsoft-com:compatibility.v1\"><application><supportedOS Id=\"{e2011457-1546-43c5-a5fe-008deee3d3f0}\" /><supportedOS Id=\"{35138b9a-5d96-4fbd-8e2d-a2440225f93a}\" /><supportedOS Id=\"{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}\" /><supportedOS Id=\"{1f676c76-80e1-4239-95bb-83d0f6d0da78}\" /><supportedOS Id=\"{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}\" /></application></compatibility>" +
                             "<trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v3\"><security><requestedPrivileges><requestedExecutionLevel level=\"asInvoker\" uiAccess=\"false\" /></requestedPrivileges></security></trustInfo>" +
                             "<application xmlns=\"urn:schemas-microsoft-com:asm.v3\"><windowsSettings><dpiAware xmlns=\"http://schemas.microsoft.com/SMI/2005/WindowsSettings\">true/pm</dpiAware><dpiAwareness xmlns=\"http://schemas.microsoft.com/SMI/2016/WindowsSettings\">PerMonitorV2, PerMonitor</dpiAwareness></windowsSettings></application>" +
                             "</assembly>", actualManifestData);
            }
        }
예제 #7
0
        public void PopulatesCustomActionTable()
        {
            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, "CustomAction", "UnscheduledCustomAction.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[] {
                    "ActionText",
                    "AdminExecuteSequence",
                    "AdminUISequence",
                    "AdvtExecuteSequence",
                    "Binary",
                    "CustomAction",
                    "InstallExecuteSequence",
                    "InstallUISequence",
                    "Property",
                }).Where(x => !x.StartsWith("Property:") || x.StartsWith("Property:MsiHiddenProperties\t")).ToArray();
                Assert.Equal(new[]
                {
                    "ActionText:CustomAction2\tProgess2Text\t",
                    "AdminExecuteSequence:CostFinalize\t\t1000",
                    "AdminExecuteSequence:CostInitialize\t\t800",
                    "AdminExecuteSequence:CustomAction2\t\t801",
                    "AdminExecuteSequence:FileCost\t\t900",
                    "AdminExecuteSequence:InstallAdminPackage\t\t3900",
                    "AdminExecuteSequence:InstallFiles\t\t4000",
                    "AdminExecuteSequence:InstallFinalize\t\t6600",
                    "AdminExecuteSequence:InstallInitialize\t\t1500",
                    "AdminExecuteSequence:InstallValidate\t\t1400",
                    "AdminUISequence:CostFinalize\t\t1000",
                    "AdminUISequence:CostInitialize\t\t800",
                    "AdminUISequence:CustomAction2\t\t801",
                    "AdminUISequence:ExecuteAction\t\t1300",
                    "AdminUISequence:FileCost\t\t900",
                    "AdvtExecuteSequence:CostFinalize\t\t1000",
                    "AdvtExecuteSequence:CostInitialize\t\t800",
                    "AdvtExecuteSequence:CustomAction2\t\t801",
                    "AdvtExecuteSequence:InstallFinalize\t\t6600",
                    "AdvtExecuteSequence:InstallInitialize\t\t1500",
                    "AdvtExecuteSequence:InstallValidate\t\t1400",
                    "AdvtExecuteSequence:PublishFeatures\t\t6300",
                    "AdvtExecuteSequence:PublishProduct\t\t6400",
                    "Binary:Binary1\t[Binary data]",
                    "CustomAction:CustomAction1\t1\tBinary1\tInvalidEntryPoint\t",
                    "CustomAction:CustomAction2\t51\tTestAdvtExecuteSequenceProperty\t1\t",
                    "CustomAction:CustomActionWithHiddenTarget\t9217\tBinary1\tInvalidEntryPoint\t",
                    "CustomAction:DiscardOptimismAllBeingsWhoProceed\t19\t\tAbandon hope all ye who enter here.\t",
                    "InstallExecuteSequence:CostFinalize\t\t1000",
                    "InstallExecuteSequence:CostInitialize\t\t800",
                    "InstallExecuteSequence:CustomAction2\t\t801",
                    "InstallExecuteSequence:FileCost\t\t900",
                    "InstallExecuteSequence:FindRelatedProducts\t\t25",
                    "InstallExecuteSequence:InstallFiles\t\t4000",
                    "InstallExecuteSequence:InstallFinalize\t\t6600",
                    "InstallExecuteSequence:InstallInitialize\t\t1500",
                    "InstallExecuteSequence:InstallValidate\t\t1400",
                    "InstallExecuteSequence:LaunchConditions\t\t100",
                    "InstallExecuteSequence:MigrateFeatureStates\t\t1200",
                    "InstallExecuteSequence:ProcessComponents\t\t1600",
                    "InstallExecuteSequence:PublishFeatures\t\t6300",
                    "InstallExecuteSequence:PublishProduct\t\t6400",
                    "InstallExecuteSequence:RegisterProduct\t\t6100",
                    "InstallExecuteSequence:RegisterUser\t\t6000",
                    "InstallExecuteSequence:RemoveExistingProducts\t\t1401",
                    "InstallExecuteSequence:RemoveFiles\t\t3500",
                    "InstallExecuteSequence:UnpublishFeatures\t\t1800",
                    "InstallExecuteSequence:ValidateProductID\t\t700",
                    "InstallUISequence:CostFinalize\t\t1000",
                    "InstallUISequence:CostInitialize\t\t800",
                    "InstallUISequence:CustomAction2\t\t801",
                    "InstallUISequence:ExecuteAction\t\t1300",
                    "InstallUISequence:FileCost\t\t900",
                    "InstallUISequence:FindRelatedProducts\t\t25",
                    "InstallUISequence:LaunchConditions\t\t100",
                    "InstallUISequence:MigrateFeatureStates\t\t1200",
                    "InstallUISequence:ValidateProductID\t\t700",
                    "Property:MsiHiddenProperties\tCustomActionWithHiddenTarget",
                }, results);
            }
        }
예제 #8
0
        public void ReplacesDownloadUrlPlaceholders()
        {
            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 baFolderPath       = Path.Combine(baseFolder, "ba");
                var extractFolderPath  = Path.Combine(baseFolder, "extract");

                var result = WixRunner.Execute(false, new[]
                {
                    "build",
                    Path.Combine(folder, "Payload", "DownloadUrlPlaceholdersBundle.wxs"),
                    Path.Combine(folder, "SimpleBundle", "MultiFileBootstrapperApplication.wxs"),
                    "-bindpath", Path.Combine(folder, "SimpleBundle", "data"),
                    "-bindpath", Path.Combine(folder, ".Data"),
                    "-intermediateFolder", intermediateFolder,
                    "-o", bundlePath,
                });

                result.AssertSuccess();

                WixAssert.CompareLineByLine(new string[]
                {
                    "The Payload 'burn.exe' is being added to Container 'PackagesContainer', overriding its Compressed value of 'no'.",
                }, result.Messages.Select(m => m.ToString()).ToArray());

                Assert.True(File.Exists(bundlePath));

                var extractResult = BundleExtractor.ExtractBAContainer(null, bundlePath, baFolderPath, extractFolderPath);
                extractResult.AssertSuccess();

                var ignoreAttributesByElementName = new Dictionary <string, List <string> >
                {
                    { "Container", new List <string> {
                          "FileSize", "Hash"
                      } },
                    { "Payload", new List <string> {
                          "FileSize", "Hash"
                      } },
                };
                var payloads = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:Payload")
                               .Cast <XmlElement>()
                               .Select(e => e.GetTestXml(ignoreAttributesByElementName))
                               .ToArray();
                WixAssert.CompareLineByLine(new string[]
                {
                    "<Payload Id='burn.exe' FilePath='burn.exe' FileSize='*' Hash='*' Packaging='embedded' SourcePath='a0' Container='PackagesContainer' />",
                    "<Payload Id='test.msi' FilePath='test.msi' FileSize='*' Hash='*' DownloadUrl='http://example.com/id/test.msi/test.msi' Packaging='external' SourcePath='test.msi' />",
                    "<Payload Id='LayoutOnlyPayload' FilePath='DownloadUrlPlaceholdersBundle.wxs' FileSize='*' Hash='*' LayoutOnly='yes' DownloadUrl='http://example.com/id/LayoutOnlyPayload/DownloadUrlPlaceholdersBundle.wxs' Packaging='external' SourcePath='DownloadUrlPlaceholdersBundle.wxs' />",
                    @"<Payload Id='fhuZsOcBDTuIX8rF96kswqI6SnuI' FilePath='MsiPackage\test.txt' FileSize='*' Hash='*' DownloadUrl='http://example.com/test.msiid/fhuZsOcBDTuIX8rF96kswqI6SnuI/MsiPackage/test.txt' Packaging='external' SourcePath='MsiPackage\test.txt' />",
                    @"<Payload Id='faf_OZ741BG7SJ6ZkcIvivZ2Yzo8' FilePath='MsiPackage\Shared.dll' FileSize='*' Hash='*' DownloadUrl='http://example.com/test.msiid/faf_OZ741BG7SJ6ZkcIvivZ2Yzo8/MsiPackage/Shared.dll' Packaging='external' SourcePath='MsiPackage\Shared.dll' />",
                }, payloads);

                var containers = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:Container")
                                 .Cast <XmlElement>()
                                 .Select(e => e.GetTestXml(ignoreAttributesByElementName))
                                 .ToArray();
                WixAssert.CompareLineByLine(new string[]
                {
                    "<Container Id='PackagesContainer' FileSize='*' Hash='*' DownloadUrl='http://example.com/id/PackagesContainer/packages.cab' FilePath='packages.cab' />",
                }, containers);
            }
        }