Beispiel #1
0
        public void InstallerWithParameters()
        {
            WixprojMSBuild wixproj = new WixprojMSBuild(Utilities.FileUtilities.GetUniqueFileName());
            wixproj.ProjectFile = Path.Combine(WixprojTests.TestDataDirectory, @"InstallerWithParameters\WixProject.wixproj");
            wixproj.Run();

            wixproj.AssertTaskSubstring("Candle", "-dVar1=1");
            wixproj.AssertTaskSubstring("Candle", "-dVar2");
            wixproj.AssertTaskSubstring("Candle", "-d\"Var3=<3>\"");
            wixproj.AssertTaskSubstring("Candle", "-dVar4=4");
            wixproj.AssertTaskSubstring("Candle", "-pedantic");
            wixproj.AssertTaskSubstring("Candle", "-sw1");
            wixproj.AssertTaskSubstring("Candle", "-wx");
            wixproj.AssertTaskSubstring("Candle", "-v");

            wixproj.AssertTaskSubstring("Light", "-cultures:en-US");
            wixproj.AssertTaskSubstring("Light", "-dWixVar1=1");
            wixproj.AssertTaskSubstring("Light", "-dWixVar2=2");
            wixproj.AssertTaskSubstring("Light", "-notidy");
            wixproj.AssertTaskSubstring("Light", "-pedantic");
            wixproj.AssertTaskSubstring("Light", "-spdb");
            wixproj.AssertTaskSubstring("Light", "-sw1");
            wixproj.AssertTaskSubstring("Light", "-wx");
            wixproj.AssertTaskSubstring("Light", "-v");
        }
Beispiel #2
0
        public void MergeModuleWithParameters()
        {
            WixprojMSBuild wixproj = new WixprojMSBuild(Utilities.FileUtilities.GetUniqueFileName());
            wixproj.ProjectFile = Path.Combine(WixprojTests.TestDataDirectory, @"MergeModuleWithParameters\WixProject.wixproj");
            wixproj.Run();

            wixproj.AssertTaskSubstring("Candle", "-dVar1=1");
            wixproj.AssertTaskSubstring("Candle", "-dVar4=4");
            wixproj.AssertTaskSubstring("Candle", "-sw");

            wixproj.AssertTaskSubstring("Light", "-cultures:ja-JP");
            wixproj.AssertTaskSubstring("Light", "-dWixVar1=1");
            wixproj.AssertTaskSubstring("Light", "-dWixVar2=2");
        }
Beispiel #3
0
        public void LibraryWithParameters()
        {
            WixprojMSBuild wixproj = new WixprojMSBuild(Utilities.FileUtilities.GetUniqueFileName());
            wixproj.ProjectFile = Path.Combine(WixprojTests.TestDataDirectory, @"LibraryWithParameters\WixProject.wixproj");
            wixproj.Run();

            wixproj.AssertTaskSubstring("Candle", "-dVar1=1");
            wixproj.AssertTaskSubstring("Candle", "-dVar4=4");
            wixproj.AssertTaskSubstring("Candle", "-sw1");
            wixproj.AssertTaskSubstring("Candle", "-wx");

            wixproj.AssertTaskSubstring("Lit", "-bf");
            wixproj.AssertTaskSubstring("Lit", "-nologo");
            wixproj.AssertTaskSubstring("Lit", "-sw1");
            wixproj.AssertTaskSubstring("Lit", "-wx");
        }
Beispiel #4
0
        public void WixprojWithReferences()
        {
            WixprojMSBuild wixproj = new WixprojMSBuild(Utilities.FileUtilities.GetUniqueFileName());
            wixproj.ProjectFile = Path.Combine(WixprojTests.TestDataDirectory, @"WixprojWithReferences\WixProject.wixproj");
            wixproj.Run();

            string expectedMSI = Path.Combine(wixproj.OutputPath, "WixProject.msi");
            Assert.True(File.Exists(expectedMSI), String.Format("Could not find the expected output file {0}", expectedMSI));
        }
Beispiel #5
0
        public void SimpleMergeModule()
        {
            WixprojMSBuild wixproj = new WixprojMSBuild(Utilities.FileUtilities.GetUniqueFileName());
            wixproj.ProjectFile = Path.Combine(WixprojTests.TestDataDirectory, @"SimpleMergeModule\WixProject.wixproj");
            wixproj.ExpectedMSBuildMessages.Add(new MSBuildMessage(1079, Message.MessageTypeEnum.Warning));
            wixproj.Run();

            string expectedMSM = Path.Combine(wixproj.OutputPath, "WixProject.msm");
            Assert.True(File.Exists(expectedMSM), String.Format("Could not find the expected output file {0}", expectedMSM));
        }
Beispiel #6
0
        public void SimpleLibrary()
        {
            WixprojMSBuild wixproj = new WixprojMSBuild(Utilities.FileUtilities.GetUniqueFileName());
            wixproj.ProjectFile = Path.Combine(WixprojTests.TestDataDirectory, @"SimpleLibrary\WixProject.wixproj");
            wixproj.Run();

            string expectedWixlib = Path.Combine(wixproj.OutputPath, "WixProject.wixlib");
            Assert.True(File.Exists(expectedWixlib), String.Format("Could not find the expected output file {0}", expectedWixlib));
        }
Beispiel #7
0
        public void SimpleInstaller()
        {
            WixprojMSBuild wixproj = new WixprojMSBuild(Utilities.FileUtilities.GetUniqueFileName());
            wixproj.ProjectFile = Path.Combine(WixprojTests.TestDataDirectory, @"SimpleInstaller\WixProject.wixproj");
            wixproj.ExpectedMSBuildMessages.Add(new MSBuildMessage(1079, Message.MessageTypeEnum.Warning));
            wixproj.ExpectedMSBuildMessages.Add(new MSBuildMessage(1109, Message.MessageTypeEnum.Warning));
            wixproj.Run();

            string expectedMSI = Path.Combine(wixproj.OutputPath, "WixProject.msi");
            Assert.IsTrue(File.Exists(expectedMSI), "Could not find the expected output file {0}", expectedMSI);
        }
Beispiel #8
0
        /// <summary>
        /// Runs the MSBuild for a WiX Library Project passing build parameters and verifies that subtasks were ran correctly
        /// </summary>
        /// <param name="wixProjectFile">Path to the WiX Project to be build</param>
        /// <param name="target">Target parameter</param>
        /// <param name="configuration">Configuration parameter</param>
        /// <param name="architecture">Architecture parameter</param>
        /// <returns>The WixprojMSBuild object that was run</returns>
        private static WixprojMSBuild TestBuildWiXLibraryTasks(string wixProjectFile, string target, string configuration, string architecture)
        {
            // Initialize build parameters
            WixprojMSBuild wixprojMSBuild = new WixprojMSBuild();
            wixprojMSBuild.ProjectFile = wixProjectFile;
            wixprojMSBuild.Targets.Add(target);
            wixprojMSBuild.Properties.Add("Platform", architecture);
            wixprojMSBuild.Properties.Add("Configuration", configuration);
            wixprojMSBuild.OutputRootDirectory = Utilities.FileUtilities.GetUniqueFileName();
            wixprojMSBuild.Run();

            // Assert that the compilation ran correct and without errors
            wixprojMSBuild.AssertTaskExists("Candle");
            wixprojMSBuild.AssertNotExistsTaskSubstring("Candle", "error", true);
            wixprojMSBuild.AssertNotExistsTaskSubstring("Candle", "warning", true);
            wixprojMSBuild.AssertTaskSubstring("Candle", string.Format("-arch {0}", architecture));

            // Assert that the linking ran correct and without errors
            wixprojMSBuild.AssertTaskExists("Lit");
            wixprojMSBuild.AssertNotExistsTaskSubstring("Lit", "error", true);
            wixprojMSBuild.AssertNotExistsTaskSubstring("Lit", "warning", true);

            return wixprojMSBuild;
        }