diff --git a/src/NuGet.Clients/NuGet.PackageManagement.UI/Xamls/PackageManagerControl.xaml.cs b/src/NuGet.Clients/NuGet.PackageManagement.UI/Xamls/PackageManagerControl.xaml.cs index f8280d239bf..962d4abb145 100644 --- a/src/NuGet.Clients/NuGet.PackageManagement.UI/Xamls/PackageManagerControl.xaml.cs +++ b/src/NuGet.Clients/NuGet.PackageManagement.UI/Xamls/PackageManagerControl.xaml.cs @@ -571,18 +571,15 @@ await RunAndEmitRefreshAsync(async () => private async Task IsCentralPackageManagementEnabledAsync(CancellationToken cancellationToken) { - await NuGetUIThreadHelper.JoinableTaskFactory.RunAsync(async delegate + if (!Model.IsSolution) { - if (!Model.IsSolution) + await NuGetUIThreadHelper.JoinableTaskFactory.RunAsync(async delegate { // Go off the UI thread to perform non-UI operations await TaskScheduler.Default; - foreach (IProjectContextInfo project in Model.Context.Projects) - { - _detailModel.IsCentralPackageManagementEnabled = await project.IsCentralPackageManagementEnabledAsync(Model.Context.ServiceBroker, cancellationToken); - } - } - }); + _detailModel.IsCentralPackageManagementEnabled = await Model.Context.Projects.First().IsCentralPackageManagementEnabledAsync(Model.Context.ServiceBroker, cancellationToken); + }); + } } private async Task GetSettingsKeyAsync(CancellationToken cancellationToken)