public void DependencyExtension_MissingDependency()
        {
            string packageB = BuildPackage("B", null);

            string logB = MSIExec.InstallProduct(packageB, MSIExec.MSIExecReturnCode.ERROR_INSTALL_FAILURE);

            Assert.IsTrue(LogVerifier.MessageInLogFile(logB, @"WixDependencyRequire:  The dependency ""Microsoft.WiX.DependencyExtension_MissingDependency.A,v1.0"" is missing or is not the required version."));
        }
        public void DependencyExtension_MissingDependencyOverride()
        {
            string packageB = BuildPackage("B", null);

            string logB = InstallProductWithProperties(packageB, MSIExec.MSIExecReturnCode.SUCCESS, "DISABLEDEPENDENCYCHECK=1");

            Assert.IsTrue(LogVerifier.MessageInLogFile(logB, @"Skipping action: WixDependencyRequire (condition is false)"));

            MSIExec.UninstallProduct(packageB, MSIExec.MSIExecReturnCode.SUCCESS);
        }
        public void NativeImage_VerifyNgenPath()
        {
            string sourceFile = Path.Combine(NativeImageTests.TestDataDirectory, @"product.wxs");
            string msiFile    = Builder.BuildPackage(sourceFile, "test.msi", "WixNetFXExtension");

            string logFile = MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS);

            string expectedPath = GetNgenPath(NetFXVerifier.FrameworkArch.x86);

            Assert.True(LogVerifier.MessageInLogFile(logFile, expectedPath), String.Format("Could not find expected ngen path in log file: '{0}'.", logFile));

            MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS);
        }
Example #4
0
        public void IISCertificate_InvalidCertificateFile_InstallFailure()
        {
            string sourceFile = Path.Combine(IISCertificateTests.TestDataDirectory, @"InvalidCertificateFile.wxs");
            string msiFile    = Builder.BuildPackage(sourceFile, "test.msi", "WixIIsExtension");

            // Install  Msi
            string logFile = MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.ERROR_INSTALL_FAILURE);

            // Verify the log file for failure reason
            Assert.True(LogVerifier.MessageInLogFile(logFile, "Failed to read certificate from file path"), String.Format("Could not find fail message in log file: '{0}'.", logFile));

            // Verify Machine certificate was not created
            Assert.False(IISVerifier.CertificateExists("TestCertPrivateKey", StoreLocation.LocalMachine), String.Format("Certificate '{0}' was not removed from the LocalMachine store on Rollback", "TestCertPrivateKey"));
        }
        public void DependencyExtension_UninstallDependencyOverrideAll()
        {
            string packageA = BuildPackage("A", null);
            string packageB = BuildPackage("B", null);

            MSIExec.InstallProduct(packageA, MSIExec.MSIExecReturnCode.SUCCESS);
            MSIExec.InstallProduct(packageB, MSIExec.MSIExecReturnCode.SUCCESS);

            // Now attempt the uninstall of dependency package A.
            string logA = UninstallProductWithProperties(packageA, MSIExec.MSIExecReturnCode.SUCCESS, "IGNOREDEPENDENCIES=ALL");

            Assert.IsTrue(LogVerifier.MessageInLogFile(logA, @"Skipping action: WixDependencyCheck (condition is false)"));

            MSIExec.UninstallProduct(packageB, MSIExec.MSIExecReturnCode.SUCCESS);
        }
        public void User_RestrictedDomain()
        {
            string sourceFile = Path.Combine(UserTests.TestDataDirectory, @"RestrictedDomain.wxs");
            string msiFile    = Builder.BuildPackage(sourceFile, "test.msi", "WixUtilExtension");

            // Create 'existinguser'
            UserVerifier.CreateLocalUser("existinguser", "test123!@#");

            string logFile = MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.ERROR_INSTALL_FAILURE);

            // clean up
            UserVerifier.DeleteLocalUser("existinguser");

            // Verify expected error message in the log file
            Assert.IsTrue(LogVerifier.MessageInLogFile(logFile, string.Format("ConfigureUsers:  Error 0x80070035: Failed to check existence of domain: {0}, user: testName1", Environment.GetEnvironmentVariable("tempdomain"))) ||
                          LogVerifier.MessageInLogFile(logFile, "CreateUser:  Error 0x80070005: failed to create user: testName1"), "Could not find CreateUser error message in log file: '{0}'.", logFile);
        }
        public void DependencyExtension_UninstallDependency()
        {
            string packageA = BuildPackage("A", null);
            string packageB = BuildPackage("B", null);

            MSIExec.InstallProduct(packageA, MSIExec.MSIExecReturnCode.SUCCESS);
            MSIExec.InstallProduct(packageB, MSIExec.MSIExecReturnCode.SUCCESS);

            // Now attempt the uninstall of dependency package A.
            string logA = MSIExec.UninstallProduct(packageA, MSIExec.MSIExecReturnCode.SUCCESS);

            Assert.IsTrue(LogVerifier.MessageInLogFile(logA, @"WixDependencyCheck:  Found dependent"));

            // Uninstall in reverse order.
            MSIExec.UninstallProduct(packageB, MSIExec.MSIExecReturnCode.SUCCESS);
            MSIExec.UninstallProduct(packageA, MSIExec.MSIExecReturnCode.SUCCESS);
        }
        public void NativeImage_DisableWindowsInstallerRollback_Install()
        {
            string sourceFile = Path.Combine(NativeImageTests.TestDataDirectory, @"product.wxs");
            string msiFile    = Builder.BuildPackage(sourceFile, "test.msi", "WixNetFXExtension");

            //Disable Windows Installer RollBack
            NativeImageTests.DisableWindowsInstallerRollBack();

            string logFile = MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS);

            // Verify actions in the log file
            Assert.True(LogVerifier.MessageInLogFile(logFile, "Doing action: NetFxExecuteNativeImageUninstall"), String.Format("Could not find NetFxExecuteNativeImageUninstall Doing message in log file: '{0}'.", logFile));
            Assert.True(LogVerifier.MessageInLogFile(logFile, "Skipping action: NetFxExecuteNativeImageCommitUninstall"), String.Format("Could not find NetFxExecuteNativeImageCommitUninstall Skipping message in log file: '{0}'.", logFile));
            Assert.True(LogVerifier.MessageInLogFile(logFile, "Doing action: NetFxExecuteNativeImageInstall"), String.Format("Could not find NetFxExecuteNativeImageInstall Doing message in log file: '{0}'.", logFile));
            Assert.True(LogVerifier.MessageInLogFile(logFile, "Skipping action: NetFxExecuteNativeImageCommitInstall"), String.Format("Could not find NetFxExecuteNativeImageCommitInstall Skipping message in log file: '{0}'.", logFile));

            MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS);
        }
        public void NativeImage_Install_64bit()
        {
            string sourceFile = Path.Combine(NativeImageTests.TestDataDirectory, @"product_64.wxs");
            string msiFile    = Builder.BuildPackage(sourceFile, "test.msi", "WixNetFXExtension");

            string logFile = MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS);

            // make sure all the assymblies have been ngened
            NgenQueuedBinaries(NetFXVerifier.FrameworkArch.x64);
            Assert.True(NetFXVerifier.NativeImageExists("WixTasks.dll", NetFXVerifier.FrameworkVersion.NetFX20, NetFXVerifier.FrameworkArch.x64), String.Format("Native Image '{0}' was not created on Install", "WixTasks.dll"));

            // Verify actions in the log file
            Assert.True(LogVerifier.MessageInLogFile(logFile, "Doing action: NetFxExecuteNativeImageCommitUninstall"), String.Format("Could not find NetFxExecuteNativeImageUninstall Doing message in log file: '{0}'.", logFile));
            Assert.True(LogVerifier.MessageInLogFile(logFile, "Skipping action: NetFxExecuteNativeImageUninstall"), String.Format("Could not find NetFxExecuteNativeImageUninstall Skipping message in log file: '{0}'.", logFile));
            Assert.True(LogVerifier.MessageInLogFile(logFile, "Doing action: NetFxExecuteNativeImageCommitInstall"), String.Format("Could not find NetFxExecuteNativeImageInstall Doing message in log file: '{0}'.", logFile));
            Assert.True(LogVerifier.MessageInLogFile(logFile, "Skipping action: NetFxExecuteNativeImageInstall"), String.Format("Could not find NetFxExecuteNativeImageInstall Skipping message in log file: '{0}'.", logFile));

            MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS);

            Assert.False(NetFXVerifier.NativeImageExists("WixTasks.dll", NetFXVerifier.FrameworkVersion.NetFX20, NetFXVerifier.FrameworkArch.x64), String.Format("Native Image '{0}' was not removed on Uninstall", "WixTasks.dll"));
        }
        public void DependencyExtension_UninstallUpgradedDependency()
        {
            string packageA  = BuildPackage("A", null);
            string packageB  = BuildPackage("B", null);
            string packageA1 = BuildPackage("A", "1.0.1.0");

            MSIExec.InstallProduct(packageA, MSIExec.MSIExecReturnCode.SUCCESS);
            MSIExec.InstallProduct(packageB, MSIExec.MSIExecReturnCode.SUCCESS);

            // Build the upgraded dependency A1 and make sure A was removed.
            MSIExec.InstallProduct(packageA1, MSIExec.MSIExecReturnCode.SUCCESS);
            Assert.IsFalse(IsPackageInstalled(packageA));

            // Now attempt the uninstall of upgraded dependency package A1.
            string logA = MSIExec.UninstallProduct(packageA1, MSIExec.MSIExecReturnCode.SUCCESS);

            Assert.IsTrue(LogVerifier.MessageInLogFile(logA, @"WixDependencyCheck:  Found dependent"));

            // Uninstall in reverse order.
            MSIExec.UninstallProduct(packageB, MSIExec.MSIExecReturnCode.SUCCESS);
            MSIExec.UninstallProduct(packageA1, MSIExec.MSIExecReturnCode.SUCCESS);
        }
 /// <summary>
 /// Verify a property using the logfile
 /// </summary>
 /// <param name="logFileName">Log file name</param>
 /// <param name="propertyName">The property to look for</param>
 /// <param name="propertyValue">The expected value of the property</param>
 private static void VerifyPropery(string logFileName, string propertyName, string propertyValue)
 {
     Assert.True(
         LogVerifier.MessageInLogFile(logFileName, string.Format("Property(S): {0} = {1}", propertyName, propertyValue)),
         String.Format("Property '{0}' with expected value '{1}' was not found in the log file: '{2}'", propertyName, propertyValue, logFileName));
 }