本文整理汇总了C#中IVsPackageManager类的典型用法代码示例。如果您正苦于以下问题:C# IVsPackageManager类的具体用法?C# IVsPackageManager怎么用?C# IVsPackageManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IVsPackageManager类属于命名空间,在下文中一共展示了IVsPackageManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VsSolution
public VsSolution(DteSolution dteSolution, ISolutionManager solutionManager, IVsPackageManager packageManager)
{
_name = String.Format(
CultureInfo.CurrentCulture,
Strings.Label_Solution,
dteSolution.GetName());
_solution = solutionManager;
_packageManager = packageManager;
var repo = (SharedPackageRepository)packageManager.LocalRepository;
_installedSolutionLevelPackages = new CoreInteropInstalledPackagesList(
new PackageReferenceRepository(repo.PackageReferenceFile.FullPath, repo));
DteSolution = dteSolution;
// Add V2-related interop features
AddFeature(() => packageManager.LocalRepository);
AddFeature<IPackageManager>(() => packageManager);
AddFeature<IPackageCacheRepository>(() => MachineCache.Default);
// the source repository of the local repo of the solution
AddFeature<SourceRepository>(() =>
{
var localRepo = new NuGet.Client.Interop.V2SourceRepository(
null,
packageManager.LocalRepository,
"");
return localRepo;
});
// Add PowerShell feature
AddFeature<PowerShellScriptExecutor>(() =>
new VsPowerShellScriptExecutor(ServiceLocator.GetInstance<IScriptExecutor>()));
}
示例2: GetActivePackageManager
protected internal override IVsPackageManager GetActivePackageManager()
{
if (_recentPackageManager == null)
{
var repository = _packageSourceProvider.GetAggregate(_packageRepositoryFactory, ignoreFailingRepositories: true);
_recentPackageManager = _packageManagerFactory.CreatePackageManager(repository, useFallbackForDependencies: false);
}
return _recentPackageManager;
}
示例3: InstalledProvider
public InstalledProvider(
IVsPackageManager packageManager,
Project project,
IProjectManager projectManager,
ResourceDictionary resources,
ProviderServices providerServices,
IProgressProvider progressProvider)
: base(project, projectManager, resources, providerServices, progressProvider)
{
_packageManager = packageManager;
}
示例4: SolutionInstalledProvider
public SolutionInstalledProvider(
IVsPackageManager packageManager,
IPackageRepository localRepository,
ResourceDictionary resources,
ProviderServices providerServices,
IProgressProvider progressProvider,
ISolutionManager solutionManager,
IPackageRestoreManager packageRestoreManager)
: base(packageManager, null, localRepository, resources, providerServices, progressProvider, solutionManager, packageRestoreManager)
{
_userNotifierServices = providerServices.UserNotifierServices;
}
示例5: MockPackagesProvider
public MockPackagesProvider(IPackageRepository localRepository, IVsPackageManager packageManagerr, IEnumerable<string> supportedFrameworks)
: base(localRepository,
new ResourceDictionary(),
new ProviderServices(
new Mock<IUserNotifierServices>().Object,
new Mock<IProgressWindowOpener>().Object,
new Mock<IProviderSettings>().Object,
new Mock<IScriptExecutor>().Object,
new MockOutputConsoleProvider(),
new Mock<IVsCommonOperations>().Object),
new Mock<IProgressProvider>().Object,
new Mock<ISolutionManager>().Object)
{
_supportedFrameworks = supportedFrameworks;
}
示例6: InstalledProvider
public InstalledProvider(
IVsPackageManager packageManager,
Project project,
IPackageRepository localRepository,
ResourceDictionary resources,
ProviderServices providerServices,
IProgressProvider progressProvider,
ISolutionManager solutionManager)
: base(localRepository, resources, providerServices, progressProvider, solutionManager)
{
if (packageManager == null)
{
throw new ArgumentNullException("packageManager");
}
_packageManager = packageManager;
_project = project;
_userNotifierServices = providerServices.UserNotifierServices;
}
示例7: InstalledProvider
public InstalledProvider(
IVsPackageManager packageManager,
Project project,
IPackageRepository localRepository,
ResourceDictionary resources,
ProviderServices providerServices,
IProgressProvider progressProvider,
ISolutionManager solutionManager,
IPackageRestoreManager packageRestoreManager)
: base(localRepository, resources, providerServices, progressProvider, solutionManager)
{
if (packageManager == null)
{
throw new ArgumentNullException("packageManager");
}
_packageManager = packageManager;
_project = project;
_targetFramework = _project.GetTargetFrameworkName();
_userNotifierServices = providerServices.UserNotifierServices;
_packageRestoreManager = packageRestoreManager;
_packageRestoreManager.PackagesMissingStatusChanged += OnMissPackagesChanged;
}
示例8: InstallPackage
private void InstallPackage(IVsPackageManager packageManager)
{
if (packageManager == null)
{
return;
}
packageManager.DependencyVersion = DependencyVersion;
packageManager.WhatIf = WhatIf;
packageManager.InstallPackage(ProjectManager, Id, Version, IgnoreDependencies, IncludePrerelease.IsPresent, logger: this);
}
示例9: ShowLicenseAgreement
protected bool ShowLicenseAgreement(IVsPackageManager packageManager, IEnumerable<PackageOperation> operations)
{
var licensePackages = from o in operations
where o.Action == PackageAction.Install &&
o.Package.RequireLicenseAcceptance &&
!packageManager.LocalRepository.Exists(o.Package)
select o.Package;
// display license window if necessary
if (licensePackages.Any())
{
// hide the progress window if we are going to show license window
HideProgressWindow();
bool accepted = _providerServices.UserNotifierServices.ShowLicenseWindow(licensePackages);
if (!accepted)
{
return false;
}
ShowProgressWindow();
}
return true;
}
示例10: OnAfterPackageOperation
public void OnAfterPackageOperation(IVsPackageManager packageManager)
{
}
示例11: ShowLicenseAgreementForAllPackages
protected bool ShowLicenseAgreementForAllPackages(IVsPackageManager activePackageManager, out IList<PackageOperation> allOperations, out IList<IPackage> packagesByDependencyOrder)
{
allOperations = new List<PackageOperation>();
var allPackages = SelectedNode.GetPackages(String.Empty, IncludePrerelease);
if (_project.SupportsINuGetProjectSystem())
{
packagesByDependencyOrder = allPackages.ToList();
foreach (var package in allPackages)
{
allOperations.Add(new PackageOperation(package, PackageAction.Install));
}
}
else
{
var installWalker = new InstallWalker(
LocalRepository,
activePackageManager.SourceRepository,
_project.GetTargetFrameworkName(),
logger: this,
ignoreDependencies: false,
allowPrereleaseVersions: IncludePrerelease,
dependencyVersion: activePackageManager.DependencyVersion);
allOperations = installWalker.ResolveOperations(allPackages, out packagesByDependencyOrder);
}
return ShowLicenseAgreement(activePackageManager, allOperations);
}
示例12: ExecuteCommandOnProject
protected void ExecuteCommandOnProject(Project activeProject, PackageItem item, IVsPackageManager activePackageManager, IList<PackageOperation> operations)
{
IProjectManager projectManager = null;
try
{
projectManager = activePackageManager.GetProjectManager(activeProject);
RegisterPackageOperationEvents(activePackageManager, projectManager);
ExecuteCommand(projectManager, item, activePackageManager, operations);
}
finally
{
if (projectManager != null)
{
UnregisterPackageOperationEvents(activePackageManager, projectManager);
}
}
}
示例13: CreateInstalledProvider
private static InstalledProvider CreateInstalledProvider(
IVsPackageManager packageManager = null,
IPackageRepository localRepository = null,
Project project = null,
IScriptExecutor scriptExecutor = null,
ISolutionManager solutionManager = null,
IPackageRestoreManager packageRestoreManager = null)
{
if (packageManager == null)
{
packageManager = new Mock<IVsPackageManager>().Object;
}
var mockProgressWindowOpener = new Mock<IProgressWindowOpener>();
if (project == null)
{
project = new Mock<Project>().Object;
}
if (scriptExecutor == null)
{
scriptExecutor = new Mock<IScriptExecutor>().Object;
}
var services = new ProviderServices(
null,
mockProgressWindowOpener.Object,
new Mock<IProviderSettings>().Object,
new Mock<IUpdateAllUIService>().Object,
scriptExecutor,
new MockOutputConsoleProvider(),
new Mock<IVsCommonOperations>().Object
);
if (localRepository == null)
{
localRepository = new MockPackageRepository();
}
if (solutionManager == null)
{
solutionManager = new Mock<ISolutionManager>().Object;
}
if (packageRestoreManager == null)
{
packageRestoreManager = new Mock<IPackageRestoreManager>().Object;
}
return new InstalledProvider(
packageManager,
project,
localRepository,
new System.Windows.ResourceDictionary(),
services,
new Mock<IProgressProvider>().Object,
solutionManager,
packageRestoreManager);
}
示例14: ShowLicenseAgreement
protected bool ShowLicenseAgreement(
IPackage package,
IVsPackageManager packageManager,
FrameworkName targetFramework,
out IList<PackageOperation> operations)
{
var walker = new InstallWalker(
LocalRepository,
packageManager.SourceRepository,
targetFramework,
this,
ignoreDependencies: false,
allowPrereleaseVersions: IncludePrerelease,
dependencyVersion: packageManager.DependencyVersion);
operations = walker.ResolveOperations(package).ToList();
return ShowLicenseAgreement(packageManager, operations);
}
示例15: ResolveActionsForUpdateAll
private IEnumerable<Resolver.PackageAction> ResolveActionsForUpdateAll(IVsPackageManager activePackageManager, IProjectManager projectManager)
{
var resolver = new ActionResolver()
{
Logger = this,
AllowPrereleaseVersions = IncludePrerelease,
DependencyVersion = activePackageManager.DependencyVersion
};
var allPackages = SelectedNode.GetPackages(String.Empty, IncludePrerelease);
foreach (var package in allPackages)
{
resolver.AddOperation(PackageAction.Install, package, projectManager);
}
var actions = resolver.ResolveActions();
return actions;
}