private void BeforeQueryStatus(object sender, EventArgs e) { var button = (OleMenuCommand)sender; button.Visible = button.Enabled = false; if (VsHelpers.DTE.SelectedItems.MultiSelect) { return; } ProjectItem item = VsHelpers.DTE.SelectedItems.Item(1).ProjectItem; if (item.IsConfigFile() && (item.ContainingProject.IsKind(Constants.WAP) || VsHelpers.IsCapabilityMatch(item.ContainingProject, Constants.DotNetCoreWebCapability))) { button.Visible = true; button.Enabled = KnownUIContexts.SolutionExistsAndNotBuildingAndNotDebuggingContext.IsActive; _isPackageInstalled = IsPackageInstalled(item.ContainingProject); if (_isPackageInstalled) { button.Text = Resources.Text.DisableRestoreOnBuild; } else { button.Text = Resources.Text.EnableRestoreOnBuild; } } }