public void XmlFile_ExistingFile() { string sourceFile = Path.Combine(XmlFileTests.TestDataDirectory, @"product.wxs"); string targetFile = Utilities.FileUtilities.GetUniqueFileName(); // Create new test.xml file to be used. File.Copy(Path.Combine(XmlFileTests.TestDataDirectory, @"test.xml"), targetFile, true); FileInfo file = new FileInfo(targetFile); if (file.IsReadOnly) { file.IsReadOnly = false; } // build the msi and pass targetfile as a param to the .wxs file string msiFile = Builder.BuildPackage(Environment.CurrentDirectory, sourceFile, "test.msi", string.Format("-dTargetFile=\"{0}\" -ext WixUtilExtension", targetFile), "-ext WixUtilExtension"); MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify XML File Transformation. VerifyXMLFileTransformation(targetFile); MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify that the file was removed Assert.True(File.Exists(targetFile), String.Format("XMLFile '{0}' was removed on Uninstall.", targetFile)); // Verify that the changes were reverted except for permenant changes XMLVerifier.VerifyXMLFile(targetFile, Path.Combine(XmlFileTests.TestDataDirectory, @"expected.xml")); }
public void IISWebPropertyEtag_Install() { string sourceFile = Path.Combine(IISWebPropertyTests.TestDataDirectory, @"product_etag.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixIIsExtension"); // get original value for the property int originalEtagPropertyValue; if (!int.TryParse(IISVerifier.GetMetaBasePropertyValue("MD_ETAG_CHANGENUMBER").ToString(), out originalEtagPropertyValue)) { originalEtagPropertyValue = -1; // default is null } // Install Msi MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify Etag property was set correctelly on install int acctualEtagPropertyValue = (int)IISVerifier.GetMetaBasePropertyValue("MD_ETAG_CHANGENUMBER"); int expectedEtagPropertyValue = 1234; Assert.True(acctualEtagPropertyValue == expectedEtagPropertyValue, String.Format("Etag Property value does not meat expected. Acctual: '{0}'. Expected: '{1}'.", acctualEtagPropertyValue, expectedEtagPropertyValue)); // UnInstall Msi MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify WebDir was removed if (!int.TryParse(IISVerifier.GetMetaBasePropertyValue("MD_ETAG_CHANGENUMBER").ToString(), out acctualEtagPropertyValue)) { acctualEtagPropertyValue = -1; // default } expectedEtagPropertyValue = originalEtagPropertyValue; Assert.True(acctualEtagPropertyValue == expectedEtagPropertyValue, String.Format("Etag Property value does not meat expected. Acctual: '{0}'. Expected: '{1}'.", acctualEtagPropertyValue, expectedEtagPropertyValue)); }
public void ServiceConfig_Repair() { string sourceFile = Path.Combine(ServiceConfigTests.TestDataDirectory, @"product.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixUtilExtension"); MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Change the service details ServiceFailureActionType[] expectedFailureActions = new ServiceFailureActionType[] { ServiceFailureActionType.RestartService, ServiceFailureActionType.RestartService, ServiceFailureActionType.RestartService }; ServiceVerifier.SetServiceInformation("MynewService", 4, expectedFailureActions); MSIExec.RepairProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Validate Existing Service Information. expectedFailureActions = new ServiceFailureActionType[] { ServiceFailureActionType.RestartService, ServiceFailureActionType.RebootComputer, ServiceFailureActionType.None }; ServiceVerifier.VerifyServiceInformation("W32Time", 1, expectedFailureActions); // Validate New Service Information. expectedFailureActions = new ServiceFailureActionType[] { ServiceFailureActionType.RebootComputer, ServiceFailureActionType.RestartService, ServiceFailureActionType.None }; ServiceVerifier.VerifyServiceInformation("MynewService", 3, expectedFailureActions); MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Validate New Service Does NOT exist any more. Assert.False(ServiceVerifier.ServiceExists("MynewService"), String.Format("Service '{0}' was NOT removed on Uninstall.", "MynewService")); }
// bug: https://sourceforge.net/tracker/?func=detail&aid=2824407&group_id=105970&atid=642714 public void FileShare_ExistingShare() { string sourceFile = Path.Combine(FileShareTests.TestDataDirectory, @"product.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixUtilExtension"); // create the share string testFolderPath = Path.Combine(@"\\" + System.Environment.MachineName, "TestShareName"); string testForderPhysicalPath = Utilities.FileUtilities.GetUniqueFileName(); Directory.CreateDirectory(testForderPhysicalPath); FileUtilities.CreateShare(testForderPhysicalPath, "TestShareName"); MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify Fileshare still Exists. Assert.True(Directory.Exists(testFolderPath), String.Format("Share '{0}' was not created on Install.", testFolderPath)); // Verify Fileshare Permissions. PermissionsVerifier.VerifySharePermession(Environment.GetEnvironmentVariable("tempdomain") + "\\ddrelqa1", testFolderPath, PermissionsVerifier.ACCESS_MASK.READ_CONTROL | PermissionsVerifier.ACCESS_MASK.WRITE_DAC | PermissionsVerifier.ACCESS_MASK.WRITE_OWNER | PermissionsVerifier.ACCESS_MASK.DELETE); PermissionsVerifier.VerifySharePermession(Environment.GetEnvironmentVariable("tempdomain") + "\\ddrelqa2", testFolderPath, PermissionsVerifier.ACCESS_MASK.READ_CONTROL); MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify Fileshare is removed. Assert.False(Directory.Exists(testFolderPath), String.Format("Share '{0}' was not removed on Uninstall.", testFolderPath)); }
public void IISWebPropertyLogInUTF8_Install() { string sourceFile = Path.Combine(IISWebPropertyTests.TestDataDirectory, @"product_LogInUTF8.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixIIsExtension"); // get original value for the property bool originalEtagPropertyValue = (bool)IISVerifier.GetMetaBasePropertyValue("LogInUTF8"); // Install Msi MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify Etag property was set correctelly on install bool acctualEtagPropertyValue = (bool)IISVerifier.GetMetaBasePropertyValue("LogInUTF8"); bool expectedEtagPropertyValue = true; Assert.True(acctualEtagPropertyValue == expectedEtagPropertyValue, String.Format("LogInUTF8 Property value does not meat expected. Acctual: '{0}'. Expected: '{1}'.", acctualEtagPropertyValue, expectedEtagPropertyValue)); // UnInstall Msi MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify WebDir was removed acctualEtagPropertyValue = (bool)IISVerifier.GetMetaBasePropertyValue("LogInUTF8"); expectedEtagPropertyValue = originalEtagPropertyValue; Assert.True(acctualEtagPropertyValue == expectedEtagPropertyValue, String.Format("LogInUTF8 Property value does not meat expected. Acctual: '{0}'. Expected: '{1}'.", acctualEtagPropertyValue, expectedEtagPropertyValue)); }
public void WixInternetShortcut_Install_64bit() { string sourceFile = Path.Combine(WixInternetShortcutTests.TestDataDirectory, @"product_64.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixUtilExtension"); MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); string link1Location = Path.Combine(Environment.ExpandEnvironmentVariables(@"%ProgramW6432%\WiX Sample"), "notepad.lnk"); string link1Target = Environment.ExpandEnvironmentVariables(@"%SystemDrive%\Windows\System32\notepad.exe"); string link2Location = Path.Combine(Environment.ExpandEnvironmentVariables(@"%ProgramW6432%\WiX Sample"), "notepad2.url"); string link2Target = Environment.ExpandEnvironmentVariables("file:///%SystemDrive%/Windows/system32/notepad.exe"); // Verify that the Internet short cuts were created Assert.True(WixInternetShortcutTests.InterNetShortCutExists(link1Location), String.Format("Shortcut '{0}' was not created on Install.", link1Location)); Assert.True(WixInternetShortcutTests.InterNetShortCutExists(link2Location), String.Format("Shortcut '{0}' was not created on Install.", link2Location)); // verify the shortcuts have the right targets WixInternetShortcutTests.VerifyInterNetShortCutTarget(link1Location, link1Target, LinkType.Link); WixInternetShortcutTests.VerifyInterNetShortCutTarget(link2Location, link2Target, LinkType.URL); MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify that the Internet short cuts were removed Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link1Location), String.Format("Shortcut '{0}' was not removed on Uninstall.", link1Location)); Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link2Location), String.Format("Shortcut '{0}' was not removed on Uninstall.", link2Location)); }
public void SqlString_Install() { string sourceFile = Path.Combine(SqlStringTests.TestDataDirectory, @"product.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixSqlExtension"); MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); Assert.IsTrue(SqlVerifier.DatabaseExists(SqlStringTests.SQLServerHostName, SqlStringTests.SQLServerInstanceName, "BlankDB10"), "Database '{0}' was not created on Install", "BlankDB10"); Assert.IsTrue(SqlVerifier.TableExists(SqlStringTests.SQLServerHostName, SqlStringTests.SQLServerInstanceName, "ScottDB22", "TestTable1"), "Table '{0}:{1}' was not created on Install", "ScottDB22", "TestTable1"); Assert.IsTrue(SqlVerifier.TableExists(SqlStringTests.SQLServerHostName, SqlStringTests.SQLServerInstanceName, "BlankDB10", "TestTable2"), "Table '{0}:{1}' was not created on Install", "BlankDB10", "TestTable2"); string sqlQuery = "Select * from TestTable2 where name ='FIRST' and value ='Kurtzeborn'"; Assert.IsTrue(SqlVerifier.SqlObjectExists(SqlStringTests.SQLServerHostName, SqlStringTests.SQLServerInstanceName, "BlankDB10", sqlQuery), "Query '{0}' Results were not created on Install", sqlQuery); // Verify The Database BlankDB4 was not created Assert.IsFalse(SqlVerifier.DatabaseExists(SqlStringTests.SQLServerHostName, SqlStringTests.SQLServerInstanceName, "BlankDB44"), "Database '{0}' was created on Install", "BlankDB44"); MSIExec.RepairProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify The Database was added Assert.IsTrue(SqlVerifier.DatabaseExists(SqlStringTests.SQLServerHostName, SqlStringTests.SQLServerInstanceName, "BlankDB44"), "Database '{0}' was Not created on Repair", "BlankDB44"); MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); Assert.IsTrue(SqlVerifier.DatabaseExists(SqlStringTests.SQLServerHostName, SqlStringTests.SQLServerInstanceName, "BlankDB10"), "Database '{0}' was dropped on Uninstall", "BlankDB10"); Assert.IsFalse(SqlVerifier.DatabaseExists(SqlStringTests.SQLServerHostName, SqlStringTests.SQLServerInstanceName, "BlankDB44"), "Database '{0}' was not dropped on Uninstall", "BlankDB44"); SqlStringTests.DropDatabase("BlankDB10"); }
public void CAQuietExec_Install() { string sourceFile = Path.Combine(CAQuietExecTests.TestDataDirectory, @"product.wxs"); string immediateFileName = Path.Combine(Path.GetTempPath(), "ImmediateCommand.cmd"); string immediateOutputFileName = Path.Combine(Path.GetTempPath(), "immediate.txt"); string deferredFileName = Path.Combine(Path.GetTempPath(), "DeferredCommand.cmd"); string deferredOutputFileName = Path.Combine(Path.GetTempPath(), "deferred.txt"); File.Copy(Path.Combine(CAQuietExecTests.TestDataDirectory, @"ImmediateCommand.cmd"), immediateFileName, true); File.Copy(Path.Combine(CAQuietExecTests.TestDataDirectory, @"DeferredCommand.cmd"), deferredFileName, true); if (File.Exists(immediateOutputFileName)) { File.Delete(immediateOutputFileName); } if (File.Exists(deferredOutputFileName)) { File.Delete(deferredOutputFileName); } string msiFile = Builder.BuildPackage(Environment.CurrentDirectory, sourceFile, "test.msi", string.Format("-dimmediate={0} -ddeferred={1} -ext WixUtilExtension", immediateFileName, deferredFileName), "-ext WixUtilExtension"); MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); Assert.True(File.Exists(immediateOutputFileName), String.Format("Immediate Command was not executed. File '{0}' does not exist.", immediateOutputFileName)); Assert.True(File.Exists(deferredOutputFileName), String.Format("Deferred Command was not executed. File '{0}' does not exist.", deferredOutputFileName)); MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); }
public void FileShare_Install_64bit() { string sourceFile = Path.Combine(FileShareTests.TestDataDirectory, @"product_64.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixUtilExtension"); MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify Directory Exists. string physicalTestFolderPath = Path.Combine(Environment.ExpandEnvironmentVariables(@"%ProgramW6432%"), @"WixTestFolder"); Assert.True(Directory.Exists(physicalTestFolderPath), String.Format("Test folder '{0}' was not created on Install.", physicalTestFolderPath)); // Verify Fileshare Exists. string testFolderPath = Path.Combine(@"\\" + System.Environment.MachineName, "TestShareName"); Assert.True(Directory.Exists(testFolderPath), String.Format("Share '{0}' was not created on Install.", testFolderPath)); // Verify Fileshare Permissions. PermissionsVerifier.VerifySharePermession(Environment.GetEnvironmentVariable("tempdomain") + "\\ddrelqa1", testFolderPath, PermissionsVerifier.ACCESS_MASK.READ_CONTROL | PermissionsVerifier.ACCESS_MASK.WRITE_DAC | PermissionsVerifier.ACCESS_MASK.WRITE_OWNER | PermissionsVerifier.ACCESS_MASK.DELETE); PermissionsVerifier.VerifySharePermession(Environment.GetEnvironmentVariable("tempdomain") + "\\ddrelqa2", testFolderPath, PermissionsVerifier.ACCESS_MASK.READ_CONTROL); MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify Fileshare is removed. Assert.False(Directory.Exists(testFolderPath), String.Format("Share '{0}' was not removed on Uninstall.", testFolderPath)); }
public void SqlString_ReInstall() { string sourceFile = Path.Combine(SqlStringTests.TestDataDirectory, @"product.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixSqlExtension"); MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); Assert.IsTrue(SqlVerifier.DatabaseExists(SqlStringTests.SQLServerHostName, SqlStringTests.SQLServerInstanceName, "BlankDB15"), "Database '{0}' was not created on Install", "BlankDB15"); Assert.IsTrue(SqlVerifier.TableExists(SqlStringTests.SQLServerHostName, SqlStringTests.SQLServerInstanceName, "BlankDB15", "TestTable1"), "Table '{0}:{1}' was not created on Install", "BlankDB15", "TestTable1"); // insert a record in the new database string sqlInsertString = "INSERT INTO TestTable1(name, value) Values('test', 'nooverwrite')"; SqlVerifier.ExecuteSQlCommand(SqlStringTests.SQLServerHostName, SqlStringTests.SQLServerInstanceName, "BlankDB15", sqlInsertString); string sqlqueryString = "Select * from TestTable1 where name ='test' and value ='nooverwrite'"; Assert.IsTrue(SqlVerifier.SqlObjectExists(SqlStringTests.SQLServerHostName, SqlStringTests.SQLServerInstanceName, "BlankDB15", sqlqueryString), "Query '{0}' Results were not created on Install", sqlqueryString); MSIExec.RepairProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // verify the change is still in the database Assert.IsTrue(SqlVerifier.SqlObjectExists(SqlStringTests.SQLServerHostName, SqlStringTests.SQLServerInstanceName, "BlankDB15", sqlqueryString), "Query '{0}' Results were not created on Install", sqlqueryString); MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); SqlStringTests.DropDatabase("BlankDB10"); }
public void User_Repair() { string sourceFile = Path.Combine(UserTests.TestDataDirectory, @"product.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixUtilExtension"); MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); UserVerifier.DeleteLocalUser("testName1"); UserVerifier.SetUserInformation(string.Empty, "testName2", true, false, false); MSIExec.RepairProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Validate New User Information. UserVerifier.VerifyUserInformation(string.Empty, "testName1", true, false, false); UserVerifier.VerifyUserIsMemberOf(string.Empty, "testName1", "Administrators", "Power Users"); UserVerifier.VerifyUserInformation(string.Empty, "testName2", true, true, true); UserVerifier.VerifyUserIsMemberOf(string.Empty, "testName2", "Power Users"); UserVerifier.VerifyUserIsMemberOf(Environment.GetEnvironmentVariable("tempdomain"), Environment.GetEnvironmentVariable("tempusername"), "Power Users"); MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify Users marked as RemoveOnUninstall were removed. Assert.IsFalse(UserVerifier.UserExists(string.Empty, "testName1"), "User '{0}' was not removed on Uninstall", "testName1"); Assert.IsTrue(UserVerifier.UserExists(string.Empty, "testName2"), "User '{0}' was removed on Uninstall", "testName2"); // clean up UserVerifier.DeleteLocalUser("testName2"); UserVerifier.VerifyUserIsNotMemberOf(Environment.GetEnvironmentVariable("tempdomain"), Environment.GetEnvironmentVariable("tempusername"), "Power Users"); }
public void PermissionEx_Install() { string sourceFile = Path.Combine(PermissionExTests.TestDataDirectory, @"product.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixUtilExtension"); MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify File Permessions string fileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), @"WixTestFolder\MynewService.exe"); PermissionsVerifier.VerifyFilePermession(@"BUILTIN\Guests", fileName, FileSystemRights.FullControl); PermissionsVerifier.VerifyFilePermession(@"Everyone", fileName, FileSystemRights.FullControl); PermissionsVerifier.VerifyFilePermession(@"NT AUTHORITY\LOCAL SERVICE", fileName, FileSystemRights.FullControl); // Verify Folder Permessions string folderName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), @"WixTestFolder\Create Folder"); PermissionsVerifier.VerifyFolderPermession(@"Everyone", folderName, FileSystemRights.ReadAttributes | FileSystemRights.WriteAttributes | FileSystemRights.ChangePermissions | FileSystemRights.Synchronize); PermissionsVerifier.VerifyFolderPermession(@"BUILTIN\Guests", folderName, FileSystemRights.ReadAttributes); // Verify Registry Permessions PermissionsVerifier.VerifyRegistryKeyPermission(@"BUILTIN\Guests", Microsoft.Win32.Registry.LocalMachine, @"SOFTWARE\Microsoft\Office\Delivery\MynewService", RegistryRights.QueryValues | RegistryRights.SetValue | RegistryRights.CreateSubKey | RegistryRights.EnumerateSubKeys | RegistryRights.Notify | RegistryRights.CreateLink); // Verify Service Permessions // TODO: Check for Service permissions MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); }
public void WixCloseApplication_ApplicationDoesNotExisit() { string sourceFile = Path.Combine(WixCloseApplicationTests.TestDataDirectory, @"product.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixUtilExtension"); MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); }
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_VerifyCommandLineParameters() { string sourceFile = Path.Combine(NativeImageTests.TestDataDirectory, @"product.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixNetFXExtension"); string logFile = MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); Assert.True(LogVerifier.MessageInLogFileRegex(logFile, @"ngen[\.]exe\sinstall(.*)WiXTasks[\.]dll(.*)/Debug\s/Profile\s/NoDependencies"), String.Format("Could not find expected CommandLine paramters in log file: '{0}'.", logFile)); MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); }
public void DependencyExtension_Install() { string packageA = BuildPackage("A", null); string packageB = BuildPackage("B", null); MSIExec.InstallProduct(packageA, MSIExec.MSIExecReturnCode.SUCCESS); MSIExec.InstallProduct(packageB, MSIExec.MSIExecReturnCode.SUCCESS); // Uninstall in reverse order. MSIExec.UninstallProduct(packageB, MSIExec.MSIExecReturnCode.SUCCESS); MSIExec.UninstallProduct(packageA, MSIExec.MSIExecReturnCode.SUCCESS); }
public void WixInternetShortcut_Install() { string sourceFile = Path.Combine(WixInternetShortcutTests.TestDataDirectory, @"product.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixUtilExtension"); MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); string desktopPath = string.Format(@"{0}\Users\Public\Desktop", Environment.ExpandEnvironmentVariables(@"%SystemDrive%")); string secretLinksPath = string.Format(@"{0}\WiX Sample\Secret Links", Environment.ExpandEnvironmentVariables(@"%ProgramFiles%")); string programMenuPath = string.Format(@"{0}\ProgramData\Microsoft\Windows\Start Menu\Programs", Environment.ExpandEnvironmentVariables(@"%SystemDrive%")); string link1Location = Path.Combine(desktopPath, "Joy of Setup.lnk"); string link2Location = Path.Combine(secretLinksPath, "InternetShortcuts announcement.lnk"); string link3Location = Path.Combine(programMenuPath, "Aaron Stebner WebLog.lnk"); string link4Location = Path.Combine(programMenuPath, "Heath Stewart's Blog.lnk"); string link5Location = Path.Combine(programMenuPath, "Peter Marcu's Blog.lnk"); string link6Location = Path.Combine(programMenuPath, "Rob Mensching Openly Uninstalled.lnk"); string link7Location = Path.Combine(programMenuPath, "Setup Sense and Sensibility.lnk"); string link8Location = Path.Combine(programMenuPath, "votive, wix, vsip, and all things microsoft.lnk"); string link9Location = Path.Combine(programMenuPath, "Windows Installer Team Blog.url"); string link10Location = Path.Combine(programMenuPath, "ARP.url"); // Verify that the Internet short cuts were created Assert.True(WixInternetShortcutTests.InterNetShortCutExists(link1Location), String.Format("Shortcut '{0}' was not created on Install.", link1Location)); Assert.True(WixInternetShortcutTests.InterNetShortCutExists(link2Location), String.Format("Shortcut '{0}' was not created on Install.", link2Location)); Assert.True(WixInternetShortcutTests.InterNetShortCutExists(link3Location), String.Format("Shortcut '{0}' was not created on Install.", link3Location)); Assert.True(WixInternetShortcutTests.InterNetShortCutExists(link4Location), String.Format("Shortcut '{0}' was not created on Install.", link4Location)); Assert.True(WixInternetShortcutTests.InterNetShortCutExists(link5Location), String.Format("Shortcut '{0}' was not created on Install.", link5Location)); Assert.True(WixInternetShortcutTests.InterNetShortCutExists(link6Location), String.Format("Shortcut '{0}' was not created on Install.", link6Location)); Assert.True(WixInternetShortcutTests.InterNetShortCutExists(link7Location), String.Format("Shortcut '{0}' was not created on Install.", link7Location)); Assert.True(WixInternetShortcutTests.InterNetShortCutExists(link8Location), String.Format("Shortcut '{0}' was not created on Install.", link8Location)); Assert.True(WixInternetShortcutTests.InterNetShortCutExists(link9Location), String.Format("Shortcut '{0}' was not created on Install.", link9Location)); Assert.True(WixInternetShortcutTests.InterNetShortCutExists(link10Location), String.Format("Shortcut '{0}' was not created on Install.", link10Location)); // verify the shortcuts have the right targets WixInternetShortcutTests.VerifyInterNetShortCutTarget(link9Location, "http://blogs.msdn.com/windows_installer_team/default.aspx", LinkType.URL); WixInternetShortcutTests.VerifyInterNetShortCutTarget(link10Location, Environment.ExpandEnvironmentVariables(@"file:///%SystemDrive%/Windows/Help/addremov.chm"), LinkType.URL); MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify that the Internet short cuts were removed Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link1Location), String.Format("Shortcut '{0}' was not removed on Uninstall.", link1Location)); Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link2Location), String.Format("Shortcut '{0}' was not removed on Uninstall.", link2Location)); Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link3Location), String.Format("Shortcut '{0}' was not removed on Uninstall.", link3Location)); Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link4Location), String.Format("Shortcut '{0}' was not removed on Uninstall.", link4Location)); Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link5Location), String.Format("Shortcut '{0}' was not removed on Uninstall.", link5Location)); Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link6Location), String.Format("Shortcut '{0}' was not removed on Uninstall.", link6Location)); Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link7Location), String.Format("Shortcut '{0}' was not removed on Uninstall.", link7Location)); Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link8Location), String.Format("Shortcut '{0}' was not removed on Uninstall.", link8Location)); Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link9Location), String.Format("Shortcut '{0}' was not removed on Uninstall.", link9Location)); Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link10Location), String.Format("Shortcut '{0}' was not removed on Uninstall.", link10Location)); }
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); }
public void WixShellExecBinary_Install() { string sourceFile = Path.Combine(WixShellExecBinaryTests.TestDataDirectory, @"product.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixUtilExtension"); string fileName = Environment.ExpandEnvironmentVariables(@"%TEMP%\DummyFile.txt"); MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); Assert.IsTrue(File.Exists(fileName), "Command was not executed. File '{0}' does not exist.", fileName); MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); }
public void WixCloseApplication_Install() { string sourceFile = Path.Combine(WixCloseApplicationTests.TestDataDirectory, @"product.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixUtilExtension"); // Start Notepad process Process notepadProcess = Process.Start("notepad.exe"); MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); Assert.True(notepadProcess.HasExited, "Notepad process was NOT closed. It was expected to."); MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); }
public void SqlScript_Install() { string sourceFile = Path.Combine(SqlScriptTests.TestDataDirectory, @"product.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixSqlExtension"); MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); Assert.IsTrue(SqlVerifier.DatabaseExists(SqlScriptTests.SQLServerHostName, SqlScriptTests.SQLServerInstanceName, "BlankDB12"), "Database '{0}' was not created on Install", "BlankDB12"); Assert.IsTrue(SqlVerifier.TableExists(SqlScriptTests.SQLServerHostName, SqlScriptTests.SQLServerInstanceName, "BlankDB12", "TestTable2"), "Table '{0}:{1}' was not created on Install", "BlankDB12", "TestTable2"); MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); Assert.IsFalse(SqlVerifier.DatabaseExists(SqlScriptTests.SQLServerHostName, SqlScriptTests.SQLServerInstanceName, "BlankDB12"), "Database '{0}' was not dropped on Uninstall", "BlankDB12"); }
public void SqlDatabase_Install() { string sourceFile = Path.Combine(SqlDatabaseTests.TestDataDirectory, @"product.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixSqlExtension"); MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); Assert.True(SqlVerifier.DatabaseExists(SqlDatabaseTests.SQLServerHostName, SqlDatabaseTests.SQLServerInstanceName, "BlankDB"), String.Format("Database '{0}' was not created on Install", "BlankDB")); Assert.True(SqlVerifier.DatabaseExists(SqlDatabaseTests.SQLServerHostName, SqlDatabaseTests.SQLServerInstanceName, "Blank[Db11"), String.Format("Database '{0}' was not created on Install", "Blank[Db11")); MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); Assert.False(SqlVerifier.DatabaseExists(SqlDatabaseTests.SQLServerHostName, SqlDatabaseTests.SQLServerInstanceName, "BlankDB"), String.Format("Database '{0}' was not dropped on Uninstall", "BlankDB")); Assert.False(SqlVerifier.DatabaseExists(SqlDatabaseTests.SQLServerHostName, SqlDatabaseTests.SQLServerInstanceName, "Blank[Db11"), String.Format("Database '{0}' was not dropped on Uninstall", "Blank[Db11")); }
public void VSSetup_Install() { string sourceFile = Path.Combine(VSExtensionTests.TestDataDirectory, @"VS90Setup.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixVSExtension"); MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); Assert.True(File.Exists(this.fixture.OutputFileName), "devenv.exe was not called"); string actualParamters = File.ReadAllText(this.fixture.OutputFileName).Trim(); string expectedParamters = "/setup"; Assert.True(actualParamters.ToLowerInvariant().Equals(expectedParamters.ToLowerInvariant()), String.Format("devenv.exe was not called with the expected parameters. Actual: '{0}'. Expected '{1}'.", actualParamters, expectedParamters)); MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); }
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 PerfCounter_Install() { string sourceFile = Path.Combine(PerfCounterTests.TestDataDirectory, @"product.wxs"); string msiFile = Builder.BuildPackage(Environment.CurrentDirectory, sourceFile, "test.msi", "-ext WixUtilExtension -sw5153 ", "-ext WixUtilExtension"); // suppress the depricated warrning message MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); string keyName = @"system\currentcontrolset\services\MyApplication\Performance"; string valueName = "PerfIniFile"; string expectedValue = "SymFile.ini"; RegistryVerifier.VerifyRegistryKeyValue(RegistryHive.LocalMachine, keyName, valueName, expectedValue); MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); }
public void PerformanceCategory_Install_64bit() { string sourceFile = Path.Combine(PerformanceCategoryTests.TestDataDirectory, @"product_64.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixUtilExtension"); MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); string registryKey = @"system\currentcontrolset\services\InstrumentationDemo"; Assert.IsTrue(RegistryVerifier.RegistryKeyExists(RegistryHive.LocalMachine, registryKey), "Registry Key '{0}' was not created on install.", registryKey); MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify that the file was removed Assert.IsFalse(RegistryVerifier.RegistryKeyExists(RegistryHive.LocalMachine, registryKey), "Registry Key '{0}' was not removed on uninstall.", registryKey); }
public void EventManifest_Install() { string sourceFile = Path.Combine(EventManifestTests.TestDataDirectory, @"product.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixUtilExtension"); MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); string registryKey = @"Software\Microsoft\Windows\CurrentVersion\WINEVT\Publishers\{1db28f2e-8f80-4027-8c5a-a11f7f10f62d}"; Assert.True(RegistryVerifier.RegistryKeyExists(RegistryHive.LocalMachine, registryKey), String.Format("Registry Key '{0}' was not created on install.", registryKey)); MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify that the key was removed Assert.False(RegistryVerifier.RegistryKeyExists(RegistryHive.LocalMachine, registryKey), String.Format("Registry Key '{0}' was not removed on uninstall.", registryKey)); }
public void DependencyExtension_UninstallDependencyOverrideSpecific() { 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 productCode = MsiUtils.GetMSIProductCode(packageB); string ignoreDependencies = String.Concat("IGNOREDEPENDENCIES=", productCode); UninstallProductWithProperties(packageA, MSIExec.MSIExecReturnCode.SUCCESS, ignoreDependencies); MSIExec.UninstallProduct(packageB, MSIExec.MSIExecReturnCode.SUCCESS); }
public void IISCertificate_CertificateRef_Install() { string sourceFile = Path.Combine(IISCertificateTests.TestDataDirectory, @"CertificateRef.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixIIsExtension"); // Install Msi MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify Machine certificate was installed Assert.True(IISVerifier.CertificateExists("machinecert", StoreLocation.LocalMachine), String.Format("Certificate '{0}' was not created in the LocalMachine store on Install", "machinecert")); // UnInstall Msi MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify Machine certificate was removed Assert.False(IISVerifier.CertificateExists("machinecert", StoreLocation.LocalMachine), String.Format("Certificate '{0}' was not removed from the LocalMachine store on Uninstall", "machinecert")); }
public void IISWebDir_Install_64bit() { string sourceFile = Path.Combine(IISWebDirTests.TestDataDirectory, @"product_64.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixIIsExtension"); // Install Msi MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify WebDir was created Assert.True(IISVerifier.WebDirExist("webdir", "Test web server"), String.Format("WebDir '{0}' in site '{1}' was not created on Install", "webdir", "Test web server")); // UnInstall Msi MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify WebDir was removed Assert.False(IISVerifier.WebDirExist("webdir", "Test web server"), String.Format("WebDir '{0}' in site '{1}' was not removed on Uninstall", "webdir", "Test web server")); }