public override void Install( IDictionary stateSaver) { // enable the line below to debug this installer; disable otherwise //MessageBox.Show("Attach the .NET debugger to the 'MSI Debug' msiexec.exe process now for debug. Click OK when ready...", "MSI Debug"); // if the installer is running in repair mode, it will try to re-install Myrtille... which is fine // problem is, it won't uninstall it first... which is not fine because some components can't be installed twice! // thus, prior to any install, try to uninstall first Trace.TraceInformation("Myrtille.Web is being installed, cleaning first"); try { Uninstall(null); } catch (Exception exc) { Trace.TraceInformation("Failed to clean Myrtille.Web ({0})", exc); } base.Install(stateSaver); Trace.TraceInformation("Installing Myrtille.Web"); try { Process process = null; // register Myrtille.Web to local IIS if (!IISHelper.IsIISApplicationPoolExists("MyrtilleAppPool")) { IISHelper.CreateIISApplicationPool("MyrtilleAppPool", "v4.0"); } if (!IISHelper.IsIISApplicationExists("/Myrtille")) { IISHelper.CreateIISApplication("/Myrtille", Path.GetFullPath(Context.Parameters["targetdir"]), "MyrtilleAppPool"); } // add write permission to the targetdir "log" folder for MyrtilleAppPool, so that Myrtille.Web can save logs into it PermissionsHelper.AddDirectorySecurity( Path.Combine(Path.GetFullPath(Context.Parameters["targetdir"]), "log"), "IIS AppPool\\MyrtilleAppPool", FileSystemRights.Write, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, PropagationFlags.None, AccessControlType.Allow); // create a default rdp user (myrtille) on the local server AccountHelper.CreateLocalUser( "Myrtille", "Myrtille User", "/Passw1rd/", true, true); // add myrtille to the windows users group AccountHelper.AddLocalUserToGroup( "Myrtille", AccountHelper.GetUsersGroupName()); // add myrtille to the remote desktop users group AccountHelper.AddLocalUserToGroup( "Myrtille", AccountHelper.GetRemoteDesktopUsersGroupName()); // import the rdp registry keys required by myrtille on the local server process = new Process(); #if !DEBUG process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; #endif process.StartInfo.FileName = "regedit.exe"; process.StartInfo.Arguments = "/s \"" + Path.Combine(Path.GetFullPath(Context.Parameters["targetdir"]), "RDPSetup.reg") + "\""; process.Start(); Trace.TraceInformation("Installed Myrtille.Web"); } catch (Exception exc) { Context.LogMessage(exc.InnerException != null ? exc.InnerException.Message: exc.Message); Trace.TraceError("Failed to install Myrtille.Web ({0})", exc); throw; } }