Ejemplo n.º 1
0
        public CsprojProject(Project project, string targetFramework)
        {
            GcpOutputWindow.OutputDebugLine($"Found project {project.FullName} targeting {targetFramework}");

            _project = project;
            switch (targetFramework)
            {
            case "netcoreapp1.0":
                ProjectType = KnownProjectTypes.NetCoreWebApplication1_0;
                break;

            case "netcoreapp1.1":
                ProjectType = KnownProjectTypes.NetCoreWebApplication1_1;
                break;

            case "netcoreapp2.0":
                ProjectType = KnownProjectTypes.NetCoreWebApplication2_0;
                break;

            default:
                GcpOutputWindow.OutputDebugLine($"Unsopported target framework {targetFramework}");
                ProjectType = KnownProjectTypes.None;
                break;
            }
        }
        /// <summary>
        /// Returns true if <paramref name="project"/> can be published using this wizard.
        /// </summary>
        /// <param name="project">The project to check.</param>
        /// <returns>True if the project is supported by this wizard, false otherwise.</returns>
        public static bool CanPublish(IParsedProject project)
        {
            KnownProjectTypes projectType = project.ProjectType;

            return(projectType == KnownProjectTypes.WebApplication ||
                   projectType == KnownProjectTypes.NetCoreWebApplication);
        }
        public void TestCanPublish_False(KnownProjectTypes invalidKnownProjectType)
        {
            bool result = PublishDialogWindow.CanPublish(
                Mock.Of <IParsedProject>(p => p.ProjectType == invalidKnownProjectType));

            Assert.IsFalse(result);
        }
Ejemplo n.º 4
0
        private IEnumerable <Choice> GetChoicesForCurrentProject()
        {
            KnownProjectTypes projectType = PublishDialog.Project.ProjectType;

            return(new List <Choice>
            {
                new Choice
                {
                    Name = Resources.PublishDialogChoiceStepAppEngineFlexName,
                    Command = new ProtectedCommand(
                        OnAppEngineChoiceCommand,
                        canExecuteCommand: PublishDialog.Project.IsAspNetCoreProject()),
                    Icon = s_appEngineIcon.Value,
                    ToolTip = Resources.PublishDialogChoiceStepAppEngineToolTip
                },
                new Choice
                {
                    Name = Resources.PublishDialogChoiceStepGkeName,
                    Command = new ProtectedCommand(
                        OnGkeChoiceCommand,
                        canExecuteCommand: PublishDialog.Project.IsAspNetCoreProject()),
                    Icon = s_gkeIcon.Value,
                    ToolTip = Resources.PublishDialogChoiceStepGkeToolTip
                },
                new Choice
                {
                    Name = Resources.PublishDialogChoiceStepGceName,
                    Command = new ProtectedCommand(
                        OnGceChoiceCommand,
                        canExecuteCommand: projectType == KnownProjectTypes.WebApplication),
                    Icon = s_gceIcon.Value,
                    ToolTip = Resources.PublishDialogChoiceStepGceToolTip
                },
            });
        }