public VsPackageSourceProvider( ISettings settings, IVsShellInfo vsShellInfo, ISolutionManager solutionManager) : this(settings, new PackageSourceProvider(settings, new[] { NuGetV3Source, NuGetDefaultSource }, _feedsToMigrate), vsShellInfo, solutionManager) { }
private VsPackageSourceProvider( ISettings settings, IPackageSourceProvider packageSourceProvider, IVsShellInfo vsShellInfo, ISolutionManager solutionManager) { if (settings == null) { throw new ArgumentNullException("settings"); } if (packageSourceProvider == null) { throw new ArgumentNullException("packageSourceProvider"); } if (vsShellInfo == null) { throw new ArgumentNullException("vsShellInfo"); } _packageSourceProvider = packageSourceProvider; _solutionManager = solutionManager; _settings = settings; _vsShellInfo = vsShellInfo; _packageSources = new List <PackageSource>(); if (null != _solutionManager) { _solutionManager.SolutionClosed += OnSolutionOpenedOrClosed; _solutionManager.SolutionOpened += OnSolutionOpenedOrClosed; } }
internal VsPackageSourceProvider( ISettings settings, IPackageSourceProvider packageSourceProvider, IVsShellInfo vsShellInfo) : this(settings, packageSourceProvider, vsShellInfo, null) { }
public VsPackageSourceProvider( ISettings settings, IVsShellInfo vsShellInfo, ISolutionManager solutionManager) : this(settings, new PackageSourceProvider(settings, new[] { NuGetDefaultSource }, _feedsToMigrate), vsShellInfo, solutionManager) { }
internal VsPackageSourceProvider( ISettings settings, IPackageSourceProvider packageSourceProvider, IVsShellInfo vsShellInfo) :this(settings, packageSourceProvider, vsShellInfo, null) { }
private static PackageSource DeserializeActivePackageSource( ISettings settings, IVsShellInfo vsShellInfo) { var settingValues = settings.GetValues(ActivePackageSourceSectionName, isPath: false); PackageSource packageSource = null; if (settingValues != null && settingValues.Any()) { var setting = settingValues.First(); if (IsAggregateSource(setting.Key, setting.Value)) { packageSource = AggregatePackageSource.Instance; } else { packageSource = new PackageSource(setting.Value, setting.Key); } } if (packageSource != null) { // guard against corrupted data if the active package source is not enabled packageSource.IsEnabled = true; } return(packageSource); }
private VsPackageSourceProvider( ISettings settings, IPackageSourceProvider packageSourceProvider, IVsShellInfo vsShellInfo, ISolutionManager solutionManager) { if (settings == null) { throw new ArgumentNullException("settings"); } if (packageSourceProvider == null) { throw new ArgumentNullException("packageSourceProvider"); } if (vsShellInfo == null) { throw new ArgumentNullException("vsShellInfo"); } _packageSourceProvider = packageSourceProvider; _solutionManager = solutionManager; _settings = settings; _vsShellInfo = vsShellInfo; if (null != _solutionManager) { _solutionManager.SolutionClosed += OnSolutionOpenedOrClosed; _solutionManager.SolutionOpened += OnSolutionOpenedOrClosed; } }
private static void PersistActivePackageSource( ISettings settings, IVsShellInfo vsShellInfo, PackageSource activePackageSource) { settings.DeleteSection(ActivePackageSourceSectionName); if (activePackageSource != null) { settings.SetValue(ActivePackageSourceSectionName, activePackageSource.Name, activePackageSource.Source); } }
private PackageSource DeserializeActivePackageSource( ISettings settings, IVsShellInfo vsShellInfo) { // NOTE: Even though the aggregate source is being disabled, this method can still return it because // it could be reading a v2.x active source setting. The caller of this method will migrate the active source // to the first enabled feed. var enabledSources = new HashSet <string>(StringComparer.CurrentCultureIgnoreCase); foreach (var source in _packageSources.Where(p => p.IsEnabled)) { enabledSources.Add(source.Name); } // The special aggregate source, i.e. "All", is always enabled. enabledSources.Add(Resources.VsResources.AggregateSourceName); var settingValues = settings.GetValues(ActivePackageSourceSectionName); if (settingValues != null) { settingValues = settingValues.Where(s => enabledSources.Contains(s.Key)).ToList(); } PackageSource packageSource = null; if (settingValues != null && settingValues.Any()) { KeyValuePair <string, string> setting = settingValues.First(); if (IsAggregateSource(setting.Key, setting.Value)) { packageSource = AggregatePackageSource.Instance; } else { packageSource = new PackageSource(setting.Value, setting.Key); } } if (packageSource != null) { // guard against corrupted data if the active package source is not enabled packageSource.IsEnabled = true; } return(packageSource); }
internal VsPackageSourceProvider( ISettings settings, IPackageSourceProvider packageSourceProvider, IVsShellInfo vsShellInfo) { if (settings == null) { throw new ArgumentNullException("settings"); } if (packageSourceProvider == null) { throw new ArgumentNullException("packageSourceProvider"); } if (vsShellInfo == null) { throw new ArgumentNullException("vsShellInfo"); } _packageSourceProvider = packageSourceProvider; _settings = settings; _vsShellInfo = vsShellInfo; }
internal VsPackageSourceProvider( ISettings settings, IPackageSourceProvider packageSourceProvider, IVsShellInfo vsShellInfo) { if (settings == null) { throw new ArgumentNullException("settings"); } if (packageSourceProvider == null) { throw new ArgumentNullException("packageSourceProvider"); } if (vsShellInfo == null) { throw new ArgumentNullException("vsShellInfo"); } _packageSourceProvider = packageSourceProvider; _settings = settings; _vsShellInfo = vsShellInfo; }
private static PackageSource DeserializeActivePackageSource( ISettings settings, IVsShellInfo vsShellInfo) { var settingValues = settings.GetValues(ActivePackageSourceSectionName); PackageSource packageSource = null; if (settingValues != null && settingValues.Any()) { KeyValuePair <string, string> setting = settingValues.First(); if (IsAggregateSource(setting.Key, setting.Value)) { packageSource = AggregatePackageSource.Instance; } else { packageSource = new PackageSource(setting.Value, setting.Key); } } if (packageSource != null) { // guard against corrupted data if the active package source is not enabled packageSource.IsEnabled = true; // Unlike NuGet Core, Visual Studio has the concept of an official package source. // If the active package source is the official source, we need to set its IsOfficial it. if (IsOfficialPackageSource(packageSource)) { packageSource.IsOfficial = true; } } return(packageSource); }
public VsPackageSourceProvider( ISettings settings, IVsShellInfo vsShellInfo) : this(settings, new PackageSourceProvider(settings, new[] { NuGetDefaultSource }, _feedsToMigrate), vsShellInfo) { }
private static void PersistPackageSources(IPackageSourceProvider packageSourceProvider, IVsShellInfo vsShellInfo, List<PackageSource> packageSources) { bool windows8SourceIsDisabled = false; // When running Visual Studio Express For Windows 8, we will have previously added a curated package source. // But we don't want to persist it, so remove it from the list. if (vsShellInfo.IsVisualStudioExpressForWindows8) { PackageSource windows8SourceInUse = packageSources.Find(p => p.Equals(Windows8Source)); Debug.Assert(windows8SourceInUse != null); if (windows8SourceInUse != null) { packageSources = packageSources.Where(ps => !ps.Equals(Windows8Source)).ToList(); windows8SourceIsDisabled = !windows8SourceInUse.IsEnabled; } } // Starting from version 1.3, we persist the package sources to the nuget.config file instead of VS registry. // assert that we are not saving aggregate source Debug.Assert(!packageSources.Any(p => IsAggregateSource(p.Name, p.Source))); packageSourceProvider.SavePackageSources(packageSources); if (windows8SourceIsDisabled) { packageSourceProvider.DisablePackageSource(Windows8Source); } }
private static PackageSource DeserializeActivePackageSource( ISettings settings, IVsShellInfo vsShellInfo) { var settingValues = settings.GetValues(ActivePackageSourceSectionName); PackageSource packageSource = null; if (settingValues != null && settingValues.Any()) { KeyValuePair<string, string> setting = settingValues.First(); if (IsAggregateSource(setting.Key, setting.Value)) { packageSource = AggregatePackageSource.Instance; } else { packageSource = new PackageSource(setting.Value, setting.Key); } } if (packageSource != null) { // guard against corrupted data if the active package source is not enabled packageSource.IsEnabled = true; } return packageSource; }
public VsPackageSourceProvider( ISettings settings, IVsShellInfo vsShellInfo) : this(settings, vsShellInfo, null) { }
private static PackageSource DeserializeActivePackageSource( ISettings settings, IVsShellInfo vsShellInfo) { var settingValues = settings.GetValues(ActivePackageSourceSectionName); PackageSource packageSource = null; if (settingValues != null && settingValues.Any()) { KeyValuePair<string, string> setting = settingValues.First(); if (IsAggregateSource(setting.Key, setting.Value)) { packageSource = AggregatePackageSource.Instance; } else { packageSource = new PackageSource(setting.Value, setting.Key); } } if (packageSource != null) { // guard against corrupted data if the active package source is not enabled packageSource.IsEnabled = true; // Unlike NuGet Core, Visual Studio has the concept of an official package source. // If the active package source is the official source, we need to set its IsOfficial it. if (IsOfficialPackageSource(packageSource)) { packageSource.IsOfficial = true; } } return packageSource; }
private static void PersistPackageSources(IPackageSourceProvider packageSourceProvider, IVsShellInfo vsShellInfo, List<PackageSource> packageSources) { // When running Visual Studio Express For Windows 8, we will have previously swapped in a curated package source for the normal official source. // But, we always want to persist the normal official source. So, we swap the normal official source back in for the curated source. if (vsShellInfo.IsVisualStudioExpressForWindows8) { packageSources = packageSources.Select(packageSource => packageSource.IsOfficial ? new PackageSource(NuGetConstants.DefaultFeedUrl, OfficialFeedName, isEnabled: packageSource.IsEnabled, isOfficial: true) : packageSource) .ToList(); } // Starting from version 1.3, we persist the package sources to the nuget.config file instead of VS registry. // assert that we are not saving aggregate source Debug.Assert(!packageSources.Any(p => IsAggregateSource(p.Name, p.Source))); packageSourceProvider.SavePackageSources(packageSources); }
private static void PersistPackageSources(IPackageSourceProvider packageSourceProvider, IVsShellInfo vsShellInfo, List<PackageSource> packageSources) { // Starting from version 1.3, we persist the package sources to the nuget.config file instead of VS registry. // assert that we are not saving aggregate source Debug.Assert(!packageSources.Any(p => IsAggregateSource(p.Name, p.Source))); packageSourceProvider.SavePackageSources(packageSources); }
private static void PersistPackageSources(IPackageSourceProvider packageSourceProvider, IVsShellInfo vsShellInfo, List <PackageSource> packageSources) { bool windows8SourceIsDisabled = false; // When running Visual Studio Express For Windows 8, we will have previously added a curated package source. // But we don't want to persist it, so remove it from the list. if (vsShellInfo.IsVisualStudioExpressForWindows8) { PackageSource windows8SourceInUse = packageSources.Find(p => p.Equals(Windows8Source)); Debug.Assert(windows8SourceInUse != null); if (windows8SourceInUse != null) { packageSources = packageSources.Where(ps => !ps.Equals(Windows8Source)).ToList(); windows8SourceIsDisabled = !windows8SourceInUse.IsEnabled; } } // Starting from version 1.3, we persist the package sources to the nuget.config file instead of VS registry. // assert that we are not saving aggregate source Debug.Assert(!packageSources.Any(p => IsAggregateSource(p.Name, p.Source))); packageSourceProvider.SavePackageSources(packageSources); if (windows8SourceIsDisabled) { packageSourceProvider.DisablePackageSource(Windows8Source); } }
private static void PersistActivePackageSource( ISettings settings, IVsShellInfo vsShellInfo, PackageSource activePackageSource) { if (activePackageSource != null) { // When running Visual Studio Express For Windows 8, we will have previously swapped in a curated package source for the normal official source. // But, we always want to persist the normal official source. So, we swap the normal official source back in for the curated source. if (vsShellInfo.IsVisualStudioExpressForWindows8 && activePackageSource.IsOfficial) { activePackageSource = new PackageSource(NuGetConstants.DefaultFeedUrl, OfficialFeedName, isEnabled: activePackageSource.IsEnabled, isOfficial: true); } settings.SetValue(ActivePackageSourceSectionName, activePackageSource.Name, activePackageSource.Source); } else { settings.DeleteSection(ActivePackageSourceSectionName); } }
private static void PersistPackageSources(IPackageSourceProvider packageSourceProvider, IVsShellInfo vsShellInfo, List <PackageSource> packageSources) { // Starting from version 1.3, we persist the package sources to the nuget.config file instead of VS registry. // assert that we are not saving aggregate source Debug.Assert(!packageSources.Any(p => IsAggregateSource(p.Name, p.Source))); packageSourceProvider.SavePackageSources(packageSources); }
private static void PersistActivePackageSource( ISettings settings, IVsShellInfo vsShellInfo, PackageSource activePackageSource) { settings.DeleteSection(ActivePackageSourceSectionName); if (activePackageSource != null) { settings.SetValue(ActivePackageSourceSectionName, activePackageSource.Name, activePackageSource.Source); } }
public VsPackageSourceProvider( ISettings settings, IVsShellInfo vsShellInfo) : this(settings, new PackageSourceProvider(settings, new[] { _defaultSource }, _feedsToMigrate), vsShellInfo) { }
private PackageSource DeserializeActivePackageSource( ISettings settings, IVsShellInfo vsShellInfo) { // NOTE: Even though the aggregate source is being disabled, this method can still return it because // it could be reading a v2.x active source setting. The caller of this method will migrate the active source // to the first enabled feed. var enabledSources = new HashSet<string>(StringComparer.CurrentCultureIgnoreCase); foreach (var source in _packageSources.Where(p => p.IsEnabled)) { enabledSources.Add(source.Name); } // The special aggregate source, i.e. "All", is always enabled. enabledSources.Add(Resources.VsResources.AggregateSourceName); var settingValues = settings.GetValues(ActivePackageSourceSectionName); if (settingValues != null) { settingValues = settingValues.Where(s => enabledSources.Contains(s.Key)).ToList(); } PackageSource packageSource = null; if (settingValues != null && settingValues.Any()) { KeyValuePair<string, string> setting = settingValues.First(); if (IsAggregateSource(setting.Key, setting.Value)) { packageSource = AggregatePackageSource.Instance; } else { packageSource = new PackageSource(setting.Value, setting.Key); } } if (packageSource != null) { // guard against corrupted data if the active package source is not enabled packageSource.IsEnabled = true; } return packageSource; }
public VsPackageSourceProvider( ISettings settings, IVsShellInfo vsShellInfo) : this(settings, vsShellInfo, null) { }
private static PackageSource DeserializeActivePackageSource( ISettings settings, IVsShellInfo vsShellInfo) { var settingValues = settings.GetValues(ActivePackageSourceSectionName); PackageSource packageSource = null; if (settingValues != null && settingValues.Any()) { KeyValuePair<string, string> setting = settingValues.First(); if (IsAggregateSource(setting.Key, setting.Value)) { packageSource = AggregatePackageSource.Instance; } else { packageSource = new PackageSource(setting.Value, setting.Key); } } if (packageSource != null) { // guard against corrupted data if the active package source is not enabled packageSource.IsEnabled = true; // Unlike NuGet Core, Visual Studio has the concept of an official package source. // If the active package source is the official source, we need to set its IsOfficial it. if (IsOfficialPackageSource(packageSource)) { packageSource.IsOfficial = true; // When running Visual Studio Express for Windows 8, we swap in a curated feed for the normal official feed. if (vsShellInfo.IsVisualStudioExpressForWindows8) { packageSource = new PackageSource(NuGetConstants.VisualStudioExpressForWindows8FeedUrl, VisualStudioExpressForWindows8FeedName, isEnabled: packageSource.IsEnabled, isOfficial: true); } } } return packageSource; }