/// <summary>
        /// Executes the command.
        /// </summary>
        protected override void OnExecute()
        {
            var activeProjectGuid = Guid.Parse(DTEHelper.GetActiveProject(ServiceProvider).Kind);

            LogManager.ActivityLog.Information(string.Format(Resources.RemoveProjectReferencesCmd_StartRemoving, activeProjectGuid.ToString("D")));

            using (var manager = new ExtensionManager(this.ShellGateway))
            {
                manager.ProgressChanged += OnProgressChanged;
                manager.StartProjectCleanup();
            }
        }
Пример #2
0
        /// <summary>
        /// Gets cached project wrapper.
        /// </summary>
        /// <param name="projectName">The project name. If null or empty then gets active project.</param>
        /// <returns>Returns the project wrapper.</returns>
        /// <exception cref="System.InvalidOperationException"/>
        private BaseProjectWrapper GetProjectWrapperByName(string projectName)
        {
            if (string.IsNullOrWhiteSpace(projectName))
            {
                // gets active project
                var project = DTEHelper.GetActiveProject(_serviceProvider);
                if (project == null)
                {
                    throw Error.InvalidOperation(Resources.ShellGateway_CannotGetActiveProject);
                }

                return(CreateProjectWrapperOrGetCached(project.Name));
            }

            // gets project by name
            return(CreateProjectWrapperOrGetCached(projectName));
        }