예제 #1
0
        /// <summary>
        /// Return all possibly valid project names in the current solution. This includes all
        /// unique names and safe names.
        /// </summary>
        /// <returns></returns>
        private async Task <IEnumerable <string> > GetAllValidProjectNamesAsync()
        {
            var nugetProjects = await VsSolutionManager.GetNuGetProjectsAsync();

            var safeNames = await Task.WhenAll(nugetProjects?.Select(p => VsSolutionManager.GetNuGetProjectSafeNameAsync(p)));

            var uniqueNames = nugetProjects?.Select(p => NuGetProject.GetUniqueNameOrName(p));

            return(uniqueNames.Concat(safeNames).Distinct());
        }
예제 #2
0
        protected override void Preprocess()
        {
            base.Preprocess();
            if (string.IsNullOrEmpty(ProjectName))
            {
                ProjectName = VsSolutionManager.DefaultNuGetProjectName;
            }

            NuGetUIThreadHelper.JoinableTaskFactory.Run(async() =>
            {
                // Get the projects in the solution that's not the current default or specified project to sync the package identity to.
                _projects = (await VsSolutionManager.GetNuGetProjectsAsync())
                            .Where(p => !StringComparer.OrdinalIgnoreCase.Equals(p.GetMetadata <string>(NuGetProjectMetadataKeys.Name), ProjectName))
                            .ToList();
            });
        }
예제 #3
0
        private void Preprocess()
        {
            UseRemoteSourceOnly = ListAvailable.IsPresent || (!String.IsNullOrEmpty(Source) && !Updates.IsPresent);
            UseRemoteSource     = ListAvailable.IsPresent || Updates.IsPresent || !String.IsNullOrEmpty(Source);
            CollapseVersions    = !AllVersions.IsPresent;
            UpdateActiveSourceRepository(Source);

            NuGetUIThreadHelper.JoinableTaskFactory.Run(async() =>
            {
                await GetNuGetProjectAsync(ProjectName);

                // When ProjectName is not specified, get all of the projects in the solution
                if (string.IsNullOrEmpty(ProjectName))
                {
                    Projects = (await VsSolutionManager.GetNuGetProjectsAsync()).ToList();
                }
                else
                {
                    Projects = new List <NuGetProject> {
                        Project
                    };
                }
            });
        }
예제 #4
0
        protected override void Preprocess()
        {
            base.Preprocess();
            ParseUserInputForVersion();
            if (!_projectSpecified)
            {
                Projects = NuGetUIThreadHelper.JoinableTaskFactory.Run(async() => await VsSolutionManager.GetNuGetProjectsAsync()).ToList();
            }
            else
            {
                Projects = new List <NuGetProject> {
                    Project
                };
            }

            if (Reinstall)
            {
                ActionType = NuGetActionType.Reinstall;
            }
            else
            {
                ActionType = NuGetActionType.Update;
            }
        }