private static void CopyTypeAssemblyFileToNetFramework(Type t, Version frameworkVersion) { string path = Installation.GetNetFrameworkDirectory(frameworkVersion); string fileName = Path.GetFileName(t.Assembly.Location); if (Directory.Exists(path)) { File.Copy(t.Assembly.Location, path + fileName, true); } path = path.Replace("Framework", "Framework64"); if (Directory.Exists(path)) { File.Copy(t.Assembly.Location, path + fileName, true); } }
public static ActionResult ForgetOlderVersions(Session session) { string olderVersionDetected = session.GetPropertyValue(PropertyNames.OlderVersionDetected); string path = session.GetInstallDirProperty() + "MsiZap.exe"; if (!string.IsNullOrEmpty(olderVersionDetected)) { string[] olderVersions = olderVersionDetected.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); foreach (var olderVersion in olderVersions) { string args = string.Format("TW {0}", olderVersion); Installation.RunCommand(path, args); } } File.Delete(path); return(ActionResult.Success); }
public static void EncryptConfigSections(string configFilePath, string site, string app, ConfigSectionGroupEncryptionOptions[] configSectionGroupOptions, Version frameworkVersion) { foreach (var sectionGroup in configSectionGroupOptions) { // Copy needed assemblies foreach (var section in sectionGroup.ConfigSectionEncryptionOptions) { CopyTypeAssemblyFileToNetFramework(section.SectionType, frameworkVersion); } // Create section with custom method foreach (var section in sectionGroup.ConfigSectionEncryptionOptions) { if (section.CustomMethod != null) { var config = Installation.OpenConfigFile(configFilePath); section.CustomMethod(config); } } // Encrypt sections foreach (var section in sectionGroup.ConfigSectionEncryptionOptions) { if (section.CustomMethod != null) { RunRegIIS(string.Format("-pe \"{0}/{1}\" -site \"{2}\" -app \"{3}\"", sectionGroup.ConfigSectionGroupName, section.SectionName, site, app), frameworkVersion); } } // Restore sections and delete files // TODO: Seems no longer needed foreach (var section in sectionGroup.ConfigSectionEncryptionOptions) { if (section.CustomMethod == null && section.SectionNode != null) { Dictionary <string, string> dic = new Dictionary <string, string>(); dic["name"] = section.SectionName; dic["type"] = section.SectionType.AssemblyQualifiedName; Installation.AddSectionNode("section", dic, "section", configFilePath, string.Format("//sectionGroup[@name='{0}']", sectionGroup.ConfigSectionGroupName)); } DeleteTypeAssemblyFileFromNetFramework(section.SectionType, frameworkVersion); } } }
private static void InitializeFlatFileLogging(string configFilePath) { Installation.SetFlatFileLogListenerAccessRights(configFilePath); }