private void InstallWin7Sp1() { this.BeginInvoke(new Action(() => Status = "Installing Win 7 SP 1 ...")); this.BeginInvoke(new Action(() => Progress = "(1/2)")); if (SystemInfo.is64BitOperatingSystem) { if (System.IO.File.Exists(Helper.StartupPath + @"\Requirements\Prerequisites\Installers\Win7PS1\x64\windows6.1-KB976932-X64.exe")) { Helper.Execute(Helper.StartupPath + @"\Requirements\Prerequisites\Installers\Win7PS1\x64\windows6.1-KB976932-X64.exe", //"/quiet /nodialog /norestart", true); "/unattend /norestart", true); } else { MessageDialogue.ShowMessage("Missing File", "Please download Installer with Windows 7 SP 1 included"); } } else { if (System.IO.File.Exists(Helper.StartupPath + @"\Requirements\Prerequisites\Installers\Win7PS1\x86\windows6.1-KB976932-X86.exe")) { Helper.Execute(Helper.StartupPath + @"\Requirements\Prerequisites\Installers\Win7PS1\x86\windows6.1-KB976932-X86.exe", //"/quiet /nodialog /norestart", true); "/unattend /norestart", true); } else { MessageDialogue.ShowMessage("Missing File", "Please download Installer with Windows 7 SP 1 included"); } } this.BeginInvoke(new Action(() => Status = "Installed Win 7 SP 1 ...")); }
private void InstallWebService() { this.BeginInvoke(new Action(() => Status = "Copying files for web service ...")); //Helper.DirectoryCopy("C:\\Program Files\\Complete Distribution\\Client\\Enterprise\\Setup\\Requirements\\Web", "C:\\inetpub\\", true); if (!System.IO.Directory.Exists("C:\\inetpub\\CDS.Web.DataService")) { System.IO.Directory.CreateDirectory("C:\\inetpub\\CDS.Web.DataService"); } Helper.Execute("cmd.exe", String.Format(" /C cd {0}\\Requirements\\Commands\\Zip & " + "unrar x \"{0}\\Requirements\\Prerequisites\\CDS.Web.DataService.rar\" *.* \"C:\\inetpub\\CDS.Web.DataService\" -y", Helper.StartupPath), true, true, "C:\\inetpub\\CDS.Web.DataService\\"); if (SystemInfo.ShouldInstallIIS) { this.BeginInvoke(new Action(() => Status = "Installing IIS ...")); Helper.Execute("cmd.exe", String.Format(" /C start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-DefaultDocument;IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-Security;IIS-BasicAuthentication;IIS-WindowsAuthentication;IIS-RequestFiltering;IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-Metabase;IIS-WMICompatibility;IIS-LegacyScripts;IIS-LegacySnapIn;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI", Helper.StartupPath), true, true); } Helper.Execute("cmd.exe", String.Format(" /C \"%WinDir%\\Microsoft.NET\\Framework64\\v4.0.30319\\aspnet_regiis -i\"", Helper.StartupPath), true, true); this.BeginInvoke(new Action(() => Status = "Configuring web service ...")); Helper.Execute("cmd.exe", "cmd /c %systemroot%\\system32\\inetsrv\\appcmd ADD APPPOOL /name:\".NET v4\" /managedRuntimeVersion:v4.0", true, true, @"%systemroot%\system32\inetsrv\"); this.BeginInvoke(new Action(() => Status = "Starting web service ...")); Helper.Execute("cmd.exe", "cmd /c %systemroot%\\system32\\inetsrv\\APPCMD add site /name:\"CDS.Web.DataService\" /bindings:\"http/*:8090:\" /physicalPath:\"C:\\inetpub\\CDS.Web.DataService\" /applicationDefaults.applicationPool:\".NET v4\"", true, true, @"%systemroot%\system32\inetsrv\"); this.BeginInvoke(new Action(() => Status = "Adding firewall exceptions ...")); Helper.Execute("cmd.exe", "cmd /c netsh advfirewall firewall delete rule name=\"CDS.Web.DataService 8090\" protocol=UDP localport=8090", true, true); Helper.Execute("cmd.exe", "cmd /c netsh advfirewall firewall add rule name=\"CDS.Web.DataService 8090\" dir=in action=allow protocol=UDP localport=8090 & netsh advfirewall firewall add rule name=\"CDS.Web.DataService 8090\" dir=out action=allow protocol=UDP localport=8090 & netsh advfirewall firewall add rule name=\"CDS.Web.DataService 8090\" dir=in action=allow protocol=TCP localport=8090 & netsh advfirewall firewall add rule name=\"CDS.Web.DataService 8090\" dir=out action=allow protocol=TCP localport=8090", true, true); }
private void InstallLocalDB() { this.BeginInvoke(new Action(() => Status = "Installing SQL 2014 LocalDB ...")); this.BeginInvoke(new Action(() => Progress = "")); if (SystemInfo.is64BitOperatingSystem) { if (System.IO.File.Exists(Helper.StartupPath + @"\Requirements\Prerequisites\Installers\SQL\2014 LocalDB\x64\SqlLocalDB.msi")) { Helper.Execute(Helper.StartupPath + @"\Requirements\Prerequisites\Installers\SQL\2014 LocalDB\x64\SqlLocalDB.msi", //"/quiet /nodialog /norestart", true); "IACCEPTSQLLOCALDBLICENSETERMS=YES /passive", true); } else { MessageDialogue.ShowMessage("Missing File", "Please download Installer with Sql LocalDB included"); } } else { if (System.IO.File.Exists(Helper.StartupPath + @"\Requirements\Prerequisites\Installers\SQL\2014 LocalDB\x86\SqlLocalDB.msi")) { Helper.Execute(Helper.StartupPath + @"\Requirements\Prerequisites\Installers\SQL\2014 LocalDB\x86\SqlLocalDB.msi", //"/quiet /nodialog /norestart", true); "IACCEPTSQLLOCALDBLICENSETERMS=YES /passive", true); } else { MessageDialogue.ShowMessage("Missing File", "Please download Installer with Sql LocalDB included"); } } this.BeginInvoke(new Action(() => Status = "Installing SQL 2014 LocalDB ...")); }
private void CopyDllsToServerFolder() { this.BeginInvoke(new Action(() => Status = "Installing CDS Server files ...")); this.BeginInvoke(new Action(() => Progress = "")); Helper.Execute("cmd.exe", String.Format(" /C xcopy \"C:\\Program Files\\Complete Distribution\\Client\\Enterprise\\*.dll\" " + "\"C:\\Program Files\\Complete Distribution\\Client\\Enterprise\\Setup\\Requirements\\Server\" /y", Helper.StartupPath), true, true); }
private void InstallSQLClrTypes() { this.BeginInvoke(new Action(() => Status = "Installing SQL Clr Types ...")); this.BeginInvoke(new Action(() => Progress = "")); if (SystemInfo.is64BitOperatingSystem) { if (System.IO.File.Exists(Helper.StartupPath + @"\Requirements\Prerequisites\Installers\SQL\SQLNCLI\x64\SQLSysClrTypes.msi")) { Helper.Execute("cmd.exe", " /C \"" + "C:\\Program Files\\Complete Distribution\\Client\\Enterprise\\Setup\\Requirements\\Prerequisites\\Installers\\SQL\\SQLNCLI\\x64\\SQLSysClrTypes.msi" + "\" /qn ", true, false, "C:\\Program Files\\Complete Distribution\\Client\\Enterprise\\Setup\\Requirements\\Prerequisites\\Installers\\SQL\\SQLNCLI\\x64\\"); //Helper.Execute("msiexec", "/q /i \"" + Helper.StartupPath + "\\Requirements\\Prerequisites\\Installers\\SQL\\SQLNCLI\\x64\\SQLNCLI_64.MSI\"", // true, false); } else { MessageDialogue.ShowMessage("Missing File", "Please download Installer with Sql Clr Types included"); } } else { if (System.IO.File.Exists(Helper.StartupPath + @"\Requirements\Prerequisites\Installers\SQL\SQLNCLI\x86\SQLSysClrTypes.msi")) { //Helper.Execute("msiexec", "/q /i \"" + Helper.StartupPath + "\\Requirements\\Prerequisites\\Installers\\SQL\\SQLNCLI\\x86\\SQLNCLI_64.MSI \"", // true, false); Helper.Execute("cmd.exe", " /C \"" + "C:\\Program Files\\Complete Distribution\\Client\\Enterprise\\Setup\\Requirements\\Prerequisites\\Installers\\SQL\\SQLNCLI\\x86\\SQLSysClrTypes.msi" + "\" /qn ", true, false, "C:\\Program Files\\Complete Distribution\\Client\\Enterprise\\Setup\\Requirements\\Prerequisites\\Installers\\SQL\\SQLNCLI\\x86\\"); } else { MessageDialogue.ShowMessage("Missing File", "Please download Installer with Sql Clr Types included"); } } }
void BackgroundWorker_InstallServer(object sender, DoWorkEventArgs e) { this.BeginInvoke(new Action(() => Status = "Preparing Setup files")); bool completed = (new PrepareDialogue()).ShowDialog() == System.Windows.Forms.DialogResult.Yes; if (completed) { this.BeginInvoke(new Action(() => Status = "Installing Prerequisites")); completed = (new PrerequisitesDialogue()).ShowDialog() == System.Windows.Forms.DialogResult.Yes; } if (completed) { UnzipFiles(); InstallSQLNCLI(); InstallSQLClrTypes(); InstallSQLSMO(); CopyDllsToServerFolder(); InstallWebService(); CreateShortcut(); CreateUninstaller(); } this.BeginInvoke(new Action(() => Status = "Running CDS Server Setup ...")); Helper.Execute("C:\\Program Files\\Complete Distribution\\Client\\Enterprise\\Setup\\Requirements\\Server\\CDS.Server.Installer.exe", "Install", true, false); this.BeginInvoke(new Action(() => Status = "Setup Complete...")); }
private void UnzipFiles() { this.BeginInvoke(new Action(() => Status = "Installing CDS ...")); this.BeginInvoke(new Action(() => Progress = "")); //this.BeginInvoke(new Action(() => Status = "Installing CDS ...")); Helper.Execute("cmd.exe", String.Format(" /C cd {0}\\Requirements\\Commands\\Zip & " + "unrar x \"{0}\\Requirements\\Prerequisites\\CDS.Client.Desktop.rar\" *.* \"C:\\Program Files\\Complete Distribution\\Client\\Enterprise\" -y", Helper.StartupPath), true, true, "C:\\Program Files\\Complete Distribution\\Client\\Enterprise"); //this.BeginInvoke(new Action(() => Status = "Installed CDS ...")); }
private void InstallDotNet45() { this.BeginInvoke(new Action(() => Status = "Installing .NET 4.5 ...")); this.BeginInvoke(new Action(() => Progress = "(2/2)")); if (System.IO.File.Exists(Helper.StartupPath + @"\Requirements\Prerequisites\Installers\.NET4.5.1\NDP451-KB2858728-x86-x64-AllOS-ENU.exe")) { Helper.Execute(Helper.StartupPath + @"\Requirements\Prerequisites\Installers\.NET4.5.1\NDP451-KB2858728-x86-x64-AllOS-ENU.exe", //"/q /norestart", true); "/passive /norestart", true); } this.BeginInvoke(new Action(() => Status = "Installed .NET 4.5 ...")); }
private void CopyDemoDatabase() { this.BeginInvoke(new Action(() => Status = "Installing Demo Database ...")); this.BeginInvoke(new Action(() => Progress = "")); if (!System.IO.Directory.Exists("C:\\Program Files\\Complete Distribution\\Client\\Enterprise\\DB")) { System.IO.Directory.CreateDirectory("C:\\Program Files\\Complete Distribution\\Client\\Enterprise\\DB"); } //this.BeginInvoke(new Action(() => Status = "Installing CDS ...")); Helper.Execute("cmd.exe", String.Format(" /C cd {0}\\Requirements\\Commands\\Zip & " + "unrar x \"{0}\\Requirements\\Prerequisites\\Installers\\SQL\\2014 LocalDB\\Demo\\DemoDatabase.rar\" *.* \"C:\\Program Files\\Complete Distribution\\Client\\Enterprise\\DB\" -y", Helper.StartupPath), true, true, "C:\\Program Files\\Complete Distribution\\Client\\Enterprise\\DB"); //this.BeginInvoke(new Action(() => Status = "Installed CDS ...")); }
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (args.Length == 0) { args = new string[] { "Install" } } ; switch (args[0]) { case "Install": Application.Run(new SystemInstallDialogue()); break; //case "Prepare": // Application.Run(new PrepareDialogue()); // break; //case "Prerequisites": // Application.Run(new PrerequisitesDialogue()); // break; case "Uninstall": System.IO.File.Copy(Application.ExecutablePath, System.IO.Path.GetTempPath() + "\\CDS.Client.Installer.Prerequisites.exe", true); Helper.Execute(System.IO.Path.GetTempPath() + "\\CDS.Client.Installer.Prerequisites.exe", "Remove", false, false); Application.Exit(); break; case "Remove": if (System.IO.Directory.Exists("C:\\Program Files\\Complete Distribution\\Client\\Enterprise")) { System.IO.Directory.Delete("C:\\Program Files\\Complete Distribution\\Client\\Enterprise", true); } if (System.IO.File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\CDS Enterprise.lnk")) { System.IO.File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\CDS Enterprise.lnk"); } Registry.LocalMachine.DeleteSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{3f8d6197-b112-48fa-a60f-7cf6f3c67c08}", true); Application.Exit(); break; } } }
private void InstallSQLSMO() { this.BeginInvoke(new Action(() => Status = "Installing SQL SMO ...")); this.BeginInvoke(new Action(() => Progress = "")); if (SystemInfo.is64BitOperatingSystem) { if (System.IO.File.Exists(Helper.StartupPath + @"\Requirements\Prerequisites\Installers\SQL\SQLNCLI\x64\SharedManagementObjects.msi")) { Helper.Execute("cmd.exe", " /C \"" + "C:\\Program Files\\Complete Distribution\\Client\\Enterprise\\Setup\\Requirements\\Prerequisites\\Installers\\SQL\\SQLNCLI\\x64\\SharedManagementObjects.MSI" + "\" /qn", true, false, "C:\\Program Files\\Complete Distribution\\Client\\Enterprise\\Setup\\Requirements\\Prerequisites\\Installers\\SQL\\SQLNCLI\\x64\\"); //Microsoft.SqlServer.Management.BatchParser //Need to install x64 and x86 on x64 System Helper.Execute("cmd.exe", " /C \"" + "C:\\Program Files\\Complete Distribution\\Client\\Enterprise\\Setup\\Requirements\\Prerequisites\\Installers\\SQL\\SQLNCLI\\x86\\SharedManagementObjects.MSI" + "\" /qn", true, false, "C:\\Program Files\\Complete Distribution\\Client\\Enterprise\\Setup\\Requirements\\Prerequisites\\Installers\\SQL\\SQLNCLI\\x86\\"); } else { MessageDialogue.ShowMessage("Missing File", "Please download Installer with Sql SMO included"); } } else { if (System.IO.File.Exists(Helper.StartupPath + @"\Requirements\Prerequisites\Installers\SQL\SQLNCLI\x86\SharedManagementObjects.msi")) { //Helper.Execute("msiexec", "/q /i \"" + Helper.StartupPath + "\\Requirements\\Prerequisites\\Installers\\SQL\\SQLNCLI\\x86\\SQLNCLI_64.MSI \"", // true, false); Helper.Execute("cmd.exe", " /C \"" + "C:\\Program Files\\Complete Distribution\\Client\\Enterprise\\Setup\\Requirements\\Prerequisites\\Installers\\SQL\\SQLNCLI\\x86\\SharedManagementObjects.MSI" + "\" /qn", true, false, "C:\\Program Files\\Complete Distribution\\Client\\Enterprise\\Setup\\Requirements\\Prerequisites\\Installers\\SQL\\SQLNCLI\\x86\\"); } else { MessageDialogue.ShowMessage("Missing File", "Please download Installer with Sql SMO included"); } } }
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { Helper.Execute("mailto:[email protected]?subject=Installer Help", "", false); }