示例#1
0
        protected override void ProcessRecordCore()
        {
            Preprocess();

            if (All.IsPresent)
            {
                VsSolutionManager.EnsureSolutionIsLoaded();
                var projects = NuGetUIThreadHelper.JoinableTaskFactory.Run(
                    async() => (await VsSolutionManager.GetAllVsProjectAdaptersAsync()).Select(p => p.Project));

                WriteObject(projects, enumerateCollection: true);
            }
            else
            {
                // No name specified; return default project (if not null)
                if (Name == null)
                {
                    var defaultProject = NuGetUIThreadHelper.JoinableTaskFactory.Run(
                        async() => await GetDefaultProjectAsync());
                    if (defaultProject != null)
                    {
                        WriteObject(defaultProject.Project);
                    }
                }
                else
                {
                    // get all projects matching name(s) - handles wildcards
                    NuGetUIThreadHelper.JoinableTaskFactory.Run(
                        async() => WriteObject((await GetProjectsByNameAsync(Name)).Select(p => p.Project), enumerateCollection: true));
                }
            }
        }
示例#2
0
        protected override void ProcessRecordCore()
        {
            Preprocess();

            if (All.IsPresent)
            {
                VsSolutionManager.EnsureSolutionIsLoaded();
                var projects = VsSolutionManager.GetAllVsProjectAdapters().Select(p => p.Project);

                WriteObject(projects, enumerateCollection: true);
            }
            else
            {
                // No name specified; return default project (if not null)
                if (Name == null)
                {
                    var defaultProject = GetDefaultProject();
                    if (defaultProject != null)
                    {
                        WriteObject(defaultProject.Project);
                    }
                }
                else
                {
                    // get all projects matching name(s) - handles wildcards
                    WriteObject(GetProjectsByName(Name).Select(p => p.Project), enumerateCollection: true);
                }
            }
        }