Exemplo n.º 1
0
 void EnsureBuildPackagingNuGetPackageIsInstalled(DotNetProject project)
 {
     if (!project.IsBuildPackagingNuGetPackageInstalled())
     {
         var extension = project.GetFlavor <DotNetProjectPackagingExtension> ();
         extension.InstallBuildPackagingNuGetAfterWrite = true;
     }
 }
Exemplo n.º 2
0
        public DotNetCoreRuntimeOptionsPanelWidget(DotNetProject project)
        {
            Build();

            this.project = project;
            if (project == null)
            {
                Sensitive = false;
                return;
            }

            dotNetCoreProject = project.GetFlavor <DotNetCoreProjectExtension> ();
            var supportedTargetFrameworks = new DotNetCoreProjectSupportedTargetFrameworks(project);

            frameworks = supportedTargetFrameworks.GetFrameworks().ToList();

            bool notInstalled = false;

            if (!frameworks.Any(fx => fx.Id == project.TargetFramework.Id))
            {
                frameworks.Add(project.TargetFramework);
                notInstalled = true;
            }

            //sort by id ascending, version descending
            frameworks.Sort((x, y) => {
                var cmp = string.CompareOrdinal(x.Id.Identifier, y.Id.Identifier);
                if (cmp != 0)
                {
                    return(cmp);
                }
                return(string.CompareOrdinal(y.Id.Version, x.Id.Version));
            });

            for (int i = 0; i < frameworks.Count; i++)
            {
                var fx = frameworks[i];
                if (project.TargetFramework.Id == fx.Id)
                {
                    if (notInstalled)
                    {
                        runtimeVersionCombo.AppendText(GettextCatalog.GetString("{0} (Not installed)", fx.GetDisplayName()));
                    }
                    else
                    {
                        runtimeVersionCombo.AppendText(fx.GetDisplayName());
                    }
                    runtimeVersionCombo.Active = i;
                }
                else
                {
                    runtimeVersionCombo.AppendText(fx.GetDisplayName());
                }
            }

            Sensitive = frameworks.Count > 1;
        }
Exemplo n.º 3
0
        public DotNetCoreRuntimeOptionsPanelWidget(DotNetProject project)
        {
            Build();

            this.project = project;
            if (project == null)
            {
                Sensitive = false;
                return;
            }

            dotNetCoreProject = project.GetFlavor <DotNetCoreProjectExtension> ();
            frameworks        = dotNetCoreProject.GetSupportedTargetFrameworks().ToList();

            if (!frameworks.Any(fx => fx.Id == project.TargetFramework.Id))
            {
                frameworks.Add(project.TargetFramework);
            }

            //sort by id ascending, version descending
            frameworks.Sort((x, y) => {
                var cmp = string.CompareOrdinal(x.Id.Identifier, y.Id.Identifier);
                if (cmp != 0)
                {
                    return(cmp);
                }
                return(string.CompareOrdinal(y.Id.Version, x.Id.Version));
            });

            for (int i = 0; i < frameworks.Count; i++)
            {
                var fx = frameworks[i];
                if (project.TargetFramework.Id == fx.Id)
                {
                    runtimeVersionCombo.AppendText(fx.Name);
                    runtimeVersionCombo.Active = i;
                }
                else
                {
                    runtimeVersionCombo.AppendText(fx.Name);
                }
            }

            Sensitive = frameworks.Count > 1;
        }
        public DotNetCoreRuntimeOptionsPanelWidget(DotNetProject project)
        {
            Build();

            this.project = project;
            if (project == null)
            {
                Sensitive = false;
                return;
            }

            if (project.HasMultipleTargetFrameworks)
            {
                runtimeVersionCombo.AppendText(GettextCatalog.GetString("(Multiple Frameworks)"));
                runtimeVersionCombo.Active = 0;
                Sensitive = false;
            }
            else
            {
                dotNetCoreProject = project.GetFlavor <DotNetCoreProjectExtension> ();
                var supportedTargetFrameworks = new DotNetCoreProjectSupportedTargetFrameworks(project);
                var installedFrameworks       = supportedTargetFrameworks.GetFrameworks().ToList();
                knownFrameworks = supportedTargetFrameworks.GetKnownFrameworks()
                                  .Concat(installedFrameworks)
                                  .Distinct()
                                  .ToList();

                if (!knownFrameworks.Any(fx => fx.Id == project.TargetFramework.Id))
                {
                    knownFrameworks.Add(project.TargetFramework);
                }

                //sort by id ascending, version descending
                knownFrameworks.Sort((x, y) => {
                    var cmp = string.CompareOrdinal(x.Id.Identifier, y.Id.Identifier);
                    if (cmp != 0)
                    {
                        return(cmp);
                    }
                    return(string.CompareOrdinal(y.Id.Version, x.Id.Version));
                });

                for (int i = 0; i < knownFrameworks.Count; i++)
                {
                    var fx = knownFrameworks[i];
                    if (installedFrameworks.Any(f => f.Id == fx.Id))
                    {
                        runtimeVersionCombo.AppendText(fx.GetDisplayName());
                    }
                    else
                    {
                        runtimeVersionCombo.AppendText(GettextCatalog.GetString("{0} (Not installed)", fx.GetDisplayName()));
                    }

                    if (project.TargetFramework.Id == fx.Id)
                    {
                        runtimeVersionCombo.Active = i;
                    }
                }

                Sensitive = knownFrameworks.Count > 1;
            }
        }