private void BeforeQueryStatus(object sender, EventArgs e)
        {
            var menuCommand = sender as OleMenuCommand;

            if (menuCommand == null)
            {
                return;
            }

            CommandsUtil.ShowAndEnableCommand(menuCommand, false);

            var dte  = Microsoft.VisualStudio.Shell.ServiceProvider.GlobalProvider.GetService(typeof(SDTE)) as DTE;
            var proj = VisualStudioAutomationHelper.GetActiveProject(dte);

            if (!VisualStudioAutomationHelper.IsANetCoreProject(proj) && (!CommandsUtil.IsWebApiCoreInstalled(proj) || IsWebApiExplorerInstalled()))
            {
                return;
            }

            if (VisualStudioAutomationHelper.IsANetCoreProject(proj) && (!CommandsUtil.IsAspNet5MvcInstalled(proj) || IsNetCoreApiExplorerInstalled()))
            {
                return;
            }

            CommandsUtil.ShowAndEnableCommand(menuCommand, true);
        }
Beispiel #2
0
        private static bool IsAspNet5OrWebApiCoreInstalled()
        {
            var proj = VisualStudioAutomationHelper.GetActiveProject(_dte);

            if (VisualStudioAutomationHelper.IsANetCoreProject(proj))
            {
                return(CommandsUtil.IsAspNet5MvcInstalled(proj));
            }

            return(CommandsUtil.IsWebApiCoreInstalled(proj));
        }
        private static bool IsAspNet5OrWebApiCoreInstalled()
        {
            var dte  = Microsoft.VisualStudio.Shell.ServiceProvider.GlobalProvider.GetService(typeof(SDTE)) as DTE;
            var proj = VisualStudioAutomationHelper.GetActiveProject(dte);

            if (VisualStudioAutomationHelper.IsANetCoreProject(proj))
            {
                return(CommandsUtil.IsAspNet5MvcInstalled(proj));
            }

            return(CommandsUtil.IsWebApiCoreInstalled(proj));
        }
        private void BeforeQueryStatus(object sender, EventArgs e)
        {
            var menuCommand = sender as OleMenuCommand;

            if (menuCommand == null)
            {
                return;
            }

            CommandsUtil.ShowAndEnableCommand(menuCommand, false);

            if (!IsAspNet5OrWebApiCoreInstalled())
            {
                return;
            }

            CommandsUtil.ShowAndEnableCommand(menuCommand, true);
        }