예제 #1
0
        public static TConfiguration WithTargetFrameworks <TConfiguration>(this TConfiguration configuration, params string[] targetFrameworks)
            where TConfiguration : IConfiguration
        {
            if (configuration.Has(DotNetCoreConstants.TARGET_FRAMEWORK_KEY))
            {
                ListConfigurationItem <string> frameworksConfiguration = configuration.Get <ListConfigurationItem <string> >(DotNetCoreConstants.TARGET_FRAMEWORK_KEY);
                frameworksConfiguration.Values.AddRange(targetFrameworks);
            }
            else
            {
                configuration.Add(DotNetCoreConstants.TARGET_FRAMEWORK_KEY, new ListConfigurationItem <string>(targetFrameworks));
            }

            return(configuration);
        }
        public static void RunOnConfiguredTargetFramework(this IConfiguration configuration, Action <string> onFramework)
        {
            if (configuration.Has(DotNetCoreConstants.TARGET_FRAMEWORK_KEY))
            {
                ListConfigurationItem <string> frameworks = configuration.Get <ListConfigurationItem <string> >(DotNetCoreConstants.TARGET_FRAMEWORK_KEY);

                foreach (var framework in frameworks.Values.Distinct())
                {
                    onFramework(framework);
                }
            }
            else
            {
                onFramework(null);
            }
        }