当前位置: 首页>>代码示例>>C#>>正文


C# IPackageManager.InstallPackage方法代码示例

本文整理汇总了C#中IPackageManager.InstallPackage方法的典型用法代码示例。如果您正苦于以下问题:C# IPackageManager.InstallPackage方法的具体用法?C# IPackageManager.InstallPackage怎么用?C# IPackageManager.InstallPackage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPackageManager的用法示例。


在下文中一共展示了IPackageManager.InstallPackage方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddPackage

        private IPackage AddPackage(IPackageManager manager, string id, string version, string payloadAssemblyFilePath)
        {
            PackageBuilder builder = new PackageBuilder();
            builder.Id = id;
            builder.Title = "dummy title";
            builder.Version = new SemanticVersion(version);
            builder.Description = "dummy description";

            builder.Authors.Add("dummy author 1");
            builder.Authors.Add("dummy author 2");

            builder.Owners.Add("dummy owner 1");
            builder.Owners.Add("dummy owner 2");

            builder.ProjectUrl = new System.Uri("http://dummyurl/");
            builder.LicenseUrl = new Uri("http://my.license/readme.txt");


            PhysicalPackageFile file = new PhysicalPackageFile();
            file.SourcePath = payloadAssemblyFilePath;
            file.TargetPath = "analyzers/" + Path.GetFileName(payloadAssemblyFilePath);
            builder.Files.Add(file);

            using (MemoryStream stream = new MemoryStream())
            {
                builder.Save(stream);
                stream.Position = 0;

                ZipPackage pkg = new ZipPackage(stream);
                manager.InstallPackage(pkg, true, true);

                return pkg;
            }
        }
开发者ID:AtwooTM,项目名称:sonarqube-roslyn-sdk,代码行数:34,代码来源:RoslynGenTests.cs

示例2: AddPackage

        private IPackage AddPackage(IPackageManager manager, string id, string version, string payloadAssemblyFilePath, params IPackage[] dependencies)
        {
            PackageBuilder builder = new PackageBuilder();

            ManifestMetadata metadata = new ManifestMetadata()
            {
                Authors = "dummy author 1,dummy author 2",
                Owners = "dummy owner 1,dummy owner 2",
                Title = "dummy title",
                Version = new SemanticVersion(version).ToString(),
                Id = id,
                Description = "dummy description",
                LicenseUrl = "http://my.license/readme.txt",
                ProjectUrl = "http://dummyurl/"
            };

            List<ManifestDependency> dependencyList = new List<ManifestDependency>();
            foreach (IPackage dependencyNode in dependencies)
            {
                dependencyList.Add(new ManifestDependency()
                {
                    Id = dependencyNode.Id,
                    Version = dependencyNode.Version.ToString(),
                });
            }

            List<ManifestDependencySet> dependencySetList = new List<ManifestDependencySet>()
            {
                new ManifestDependencySet()
                {
                    Dependencies = dependencyList
                }
            };
            metadata.DependencySets = dependencySetList;

            builder.Populate(metadata);

            PhysicalPackageFile file = new PhysicalPackageFile();
            file.SourcePath = payloadAssemblyFilePath;
            file.TargetPath = "analyzers/" + Path.GetFileName(payloadAssemblyFilePath);
            builder.Files.Add(file);

            using (MemoryStream stream = new MemoryStream())
            {
                builder.Save(stream);
                stream.Position = 0;

                ZipPackage pkg = new ZipPackage(stream);
                manager.InstallPackage(pkg, true, true);

                return pkg;
            }
        }
开发者ID:SonarSource-VisualStudio,项目名称:sonarqube-roslyn-sdk,代码行数:53,代码来源:RoslynGenTests.cs

示例3: InstallPackage

 internal bool InstallPackage(IPackageManager packageManager, IFileSystem fileSystem, string packageId, SemanticVersion version, bool ignoreDependencies)
 {
     if (AllowMultipleVersions && IsPackageInstalled(packageId, version, packageManager, fileSystem))
     {
         // Use a fast check to verify if the package is already installed. We'll do this by checking if the package directory exists on disk.
         return false;
     }
     else if (!AllowMultipleVersions)
     {
         var installedPackage = packageManager.LocalRepository.FindPackage(packageId);
         if (installedPackage != null)
         {
             if (version != null && installedPackage.Version >= version)
             {
                 // If the package is already installed (or the version being installed is lower), then we do not need to do anything. 
                 return false;
             }
             else if (packageManager.SourceRepository.Exists(packageId, version))
             {
                 // If the package is already installed, but
                 // (a) the version we require is different from the one that is installed, 
                 // (b) side-by-side is disabled
                 // we need to uninstall it.
                 // However, before uninstalling, make sure the package exists in the source repository. 
                 packageManager.UninstallPackage(installedPackage, forceRemove: false, removeDependencies: true);
             }
         }
     }
     packageManager.InstallPackage(packageId, version, ignoreDependencies: ignoreDependencies, allowPrereleaseVersions: Prerelease);
     return true;
 }
开发者ID:monoman,项目名称:NugetCracker,代码行数:31,代码来源:InstallCommand.cs

示例4: InstallPackage

 /// <summary>
 /// Install a package with locking to allow multiple concurrent extractions to work without disk contention.
 /// </summary>
 public static void InstallPackage(IPackageManager packageManager, IPackage package)
 {
     var uniqueToken = GenerateUniqueToken(packageManager, package.Id, package.Version);
     // Prerelease flag does not matter since we already have the package to install and we ignore dependencies.
     ExecuteLocked(uniqueToken, () => packageManager.InstallPackage(package, ignoreDependencies: true, allowPrereleaseVersions: true));
 }
开发者ID:Alxandr,项目名称:NAnt.Nuget.Tasks,代码行数:9,代码来源:PackageExtractor.cs

示例5: PerformInstall

 protected internal virtual void PerformInstall(IPackageManager manager, string id, Version version, bool ignoreDependencies)
 {
     manager.InstallPackage(id, version == null ? null : new SemanticVersion(version), ignoreDependencies, allowPrereleaseVersions: false);
 }
开发者ID:anurse,项目名称:PS-Get,代码行数:4,代码来源:InstallPackageCommand.cs

示例6: BuildAndInstallPackage

        private void BuildAndInstallPackage(IPackageManager manager, string id, string version)
        {
            ManifestMetadata metadata = GenerateTestMetadata(true);
            metadata.Id = id;
            metadata.Version = new SemanticVersion(version).ToString();

            Stream packageStream = BuildPackageToStream(metadata, new MemoryStream());
            packageStream.Position = 0;

            ZipPackage pkg = new ZipPackage(packageStream);
            manager.InstallPackage(pkg, true, true);
        }
开发者ID:p3pijn,项目名称:sonarqube-roslyn-sdk,代码行数:12,代码来源:NuGetPackageHandlerTests.cs

示例7: AddPackage

        private void AddPackage(IPackageManager manager, string id, string version, string payloadAssemblyFilePath)
        {
            PackageBuilder builder = new PackageBuilder();
            builder.Id = id;
            builder.Version = new SemanticVersion(version);
            builder.Description = "dummy description";
            builder.Authors.Add("dummy author");

            PhysicalPackageFile file = new PhysicalPackageFile();
            file.SourcePath = payloadAssemblyFilePath;
            file.TargetPath = "analyzers/" + Path.GetFileName(payloadAssemblyFilePath);
            builder.Files.Add(file);

            using (MemoryStream stream = new MemoryStream())
            {
                builder.Save(stream);
                stream.Position = 0;

                ZipPackage pkg = new ZipPackage(stream);
                manager.InstallPackage(pkg, true, true);
            }
        }
开发者ID:p3pijn,项目名称:sonarqube-roslyn-sdk,代码行数:22,代码来源:RoslynGenTests.cs


注:本文中的IPackageManager.InstallPackage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。