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