protected override bool OnGetSupportsFramework(TargetFramework framework)
 {
     if (framework.IsNetCoreApp() ||
         framework.IsNetStandard())
     {
         return(true);
     }
     return(base.OnGetSupportsFramework(framework));
 }
 protected override bool OnGetSupportsFramework(TargetFramework framework)
 {
     if (Project.HasMultipleTargetFrameworks)
     {
         // Gets called when assigning the Project.TargetFramework. The framework being set may not be
         // supported by the DotNetCoreProjectExtension but one of the multi-target frameworks will be
         // supported so return true to allow the Project to be loaded.
         return(true);
     }
     return(framework.IsNetCoreApp() || framework.IsNetStandard());
 }
Exemple #3
0
        public static string GetDisplayName(this TargetFramework framework)
        {
            if (framework.IsNetCoreApp())
            {
                return(string.Format(".NET Core {0}", framework.Id.Version));
            }

            if (framework.IsNetStandard())
            {
                return(string.Format(".NET Standard {0}", framework.Id.Version));
            }

            return(framework.Name);
        }
        public IEnumerable <TargetFramework> GetFrameworks()
        {
            if (framework.IsNetStandard())
            {
                return(GetNetStandardTargetFrameworks());
            }
            else if (framework.IsNetCoreApp())
            {
                return(GetNetCoreAppTargetFrameworksWithSdkSupport());
            }
            else if (framework.IsNetFramework())
            {
                return(GetNetFrameworkTargetFrameworks());
            }

            return(new TargetFramework [0]);
        }
Exemple #5
0
        public static string GetParameterName(this TargetFramework framework)
        {
            var parameter = framework.Id.Version;

            //special case for 1.x
            if (framework.IsVersion1x())
            {
                parameter = "1x";
            }

            parameter = parameter.Replace(".", string.Empty);

            if (framework.IsNetCoreApp())
            {
                return($"UseNetCore{parameter}");
            }

            if (framework.IsNetStandard())
            {
                return($"UseNetStandard{parameter}");
            }

            return(string.Empty);
        }
Exemple #6
0
 public static bool IsNetCoreApp1x(this TargetFramework framework)
 {
     return(framework.IsNetCoreApp() &&
            framework.IsVersion1x());
 }
Exemple #7
0
 public static bool IsNetCoreApp20(this TargetFramework framework)
 {
     return(framework.IsNetCoreApp() &&
            framework.Id.Version == "2.0");
 }
 public static bool IsNetStandard20OrNetCore20(this TargetFramework framework)
 {
     return(framework.IsNetStandard20() || framework.IsNetCoreApp());
 }
Exemple #9
0
 public static bool IsNetCoreApp1x(this TargetFramework framework) => framework.IsNetCoreApp() && framework.IsVersion1x();
Exemple #10
0
 public static bool IsNetStandard20OrNetCore20(this TargetFramework framework) => framework.IsNetStandard("2.0") || framework.IsNetCoreApp("2.0");