Пример #1
0
        /// <summary>
        /// Runs MSBuild for a WiX Library Project with target parameter 'Clean' for particular configuration and architecture and verifies that subtasks were ran correctly
        /// </summary>
        /// <param name="wixProjectFile">Path to the WiX Project to be build</param>
        /// <param name="configuration">Configuration parameter</param>
        /// <param name="architecture">Architecture parameter</param>
        private static void TestCleanWiXLibrary(string wixProjectFile, string configuration, string architecture)
        {
            WixprojMSBuild wixprojMSBuild = WixTaskTests.TestBuildWiXLibraryTasks(wixProjectFile, "Build", configuration, architecture);

            wixprojMSBuild.OtherArguments = string.Format("/t:Clean /p:Configuration={0};Platform={1}", configuration, architecture);
            wixprojMSBuild.Run();
        }
Пример #2
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");
        }
Пример #3
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);
        }
Пример #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));
        }
Пример #5
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));
        }
Пример #6
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));
        }
Пример #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);
        }
Пример #8
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");
        }
Пример #9
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");
        }