Example #1
0
        private static string GetBaseConfig()
        {
            var appPoolConfig = Environment.GetEnvironmentVariable("APP_POOL_CONFIG");

            if (appPoolConfig == null)
            {
                return("");
            }

            var source = new XmlTransformableDocument();

            source.Load(appPoolConfig + ".base");

            // Apply site extensions
            var siteExtensions = Environment.ExpandEnvironmentVariables(@"%HOME%\SiteExtensions");

            foreach (var directory in Directory.GetDirectories(siteExtensions))
            {
                var transformMain = CreateXmlTransformation(Path.Combine(directory, "applicationHost.xdt"));

                transformMain?.Apply(source);

                var transformScm = CreateXmlTransformation(Path.Combine(directory, "scmApplicationHost.xdt"));

                transformScm?.Apply(source);
            }

            return(source.ToFormattedString());
        }
Example #2
0
        public static string GenerateConfig(string newXdt)
        {
            var baseConfig = GetBaseConfig();

            var source = new XmlTransformableDocument();

            source.LoadXml(baseConfig);

            // force default XDT path
            var transform = CreateXmlTransformation(_xdtPath, newXdt);

            transform.Apply(source);

            return(source.ToFormattedString());
        }
Example #3
0
        public static string GetCurrentConfig()
        {
            var baseConfig = GetBaseConfig();

            // Apply D:\home\site\applicationHost.xdt
            var source = new XmlTransformableDocument();

            source.LoadXml(baseConfig);

            var transform = CreateXmlTransformation(_xdtPath);

            transform?.Apply(source);

            return(source.ToFormattedString());
        }