本文整理汇总了C#中IPackageSourceProvider.DisablePackageSource方法的典型用法代码示例。如果您正苦于以下问题:C# IPackageSourceProvider.DisablePackageSource方法的具体用法?C# IPackageSourceProvider.DisablePackageSource怎么用?C# IPackageSourceProvider.DisablePackageSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPackageSourceProvider
的用法示例。
在下文中一共展示了IPackageSourceProvider.DisablePackageSource方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PersistPackageSources
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);
}
}