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


C# IPackage.GetFullName方法代码示例

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


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

示例1: AddPackage

 public void AddPackage(IPackage package)
 {
     _logger.Log(MessageLevel.Info, NuGetResources.MirrorCommandPushingPackage, package.GetFullName(), CommandLineUtility.GetSourceDisplayName(_destination.Source));
     _destination.PushPackage(
         _apiKey, 
         package, 
         package.GetStream().Length, 
         (int)_timeout.TotalMilliseconds, 
         disableBuffering: false);
     _logger.Log(MessageLevel.Info, NuGetResources.MirrorCommandPackagePushed);
 }
开发者ID:Newtopian,项目名称:nuget,代码行数:11,代码来源:PackageServerRepository.cs

示例2: Deploy

        public bool Deploy(string taskId, IPackage package, CancellationTokenSource cancellationToken, Action<ProgressReport> reportProgress)
        {
            var unpackFolder = Path.Combine(AgentSettings.AgentProgramDataPath, _agentSettingsManager.Settings.UnpackingLocation);
            var workingFolder = Path.Combine(unpackFolder, package.GetFullName());
            var targetInstallationFolder = Path.Combine(_agentSettingsManager.Settings.BaseInstallationPath, package.Id);
            using (var deploymentContext = new DeploymentContext(package, _agentSettingsManager, workingFolder, targetInstallationFolder, taskId))
            {

                var logger = deploymentContext.GetLoggerFor(this);
                var frameworks = package.GetSupportedFrameworks();
                foreach (var framework in frameworks)
                {
                    logger.DebugFormat("package supports {0}", framework.FullName);
                }

                try
                {
                    reportProgress(ProgressReport.Info(deploymentContext, this, package.Id,
                                                       package.Version.Version.ToString(), taskId,
                                                       "Extracting package to temp folder..."));
                    new NuGetPackageExtractor(Logger).Extract(package, workingFolder);
                }
                catch (Exception ex)
                {
                    logger.Fatal("Could not extract package", ex);
                }

                try
                {
                    BeforeDeploy(deploymentContext, reportProgress);
                    PerformDeploy(deploymentContext, reportProgress);
                    AfterDeploy(deploymentContext, reportProgress);

                    reportProgress(ProgressReport.Info(deploymentContext, this, package.Id,
                                                       package.Version.Version.ToString(), taskId,
                                                       "Deployment complete"));
                    return true;
                }
                catch (Exception ex)
                {
                    logger.Error("An error occurred", ex);
                    reportProgress(ProgressReport.Error(deploymentContext, this, package.Id,
                                                        package.Version.Version.ToString(), taskId,
                                                        "Deployment failed", ex));
                    return false;
                }
                finally
                {
                    deploymentContext.RemoveAppender();
                }
            }
        }
开发者ID:andrewmyhre,项目名称:DeployD,代码行数:52,代码来源:DeploymentService.cs

示例3: ExecutePowerShellScriptIfPresent

        public static void ExecutePowerShellScriptIfPresent(string scriptName, InstallationTarget target, IPackage package, string installPath, IExecutionContext context)
        {
            Debug.Assert(context != null);

            // If we don't have a project, we're at solution level
            //  The <Solution> string is only for tracing so it probably doesn't need to be loc'ed
            string projectName = target.Name;
            var targetFramework = target.GetSupportedFrameworks().FirstOrDefault();

            // Get the install script
            var scriptFile = FindScript(
                package, 
                scriptName,
                targetFramework);

            // If there is a script to run
            if (scriptFile != null)
            {
                NuGetTraceSources.ActionExecutor.Info(
                    "executingps1",
                    "[{0}] Running {2} for {1}",
                    projectName,
                    package.GetFullName(),
                    scriptFile.Path);
                context.ExecuteScript(installPath, scriptFile.Path, package, target);
            }
            else
            {
                NuGetTraceSources.ActionExecutor.Info(
                    "nops1",
                    "[{0}] No {2} script for {1}.",
                    projectName,
                    package.GetFullName(),
                    scriptName);
            }
        }
开发者ID:sistoimenov,项目名称:NuGet2,代码行数:36,代码来源:ActionHandlerHelpers.cs

示例4: PackageDetails

        internal PackageDetails(IPackage package)
        {
            Argument.IsNotNull(() => package);

            Package = package;
            Version = package.Version.Version;
            Id = package.Id;
            Title = string.IsNullOrWhiteSpace(package.Title) ? package.Id : package.Title;
            FullName = package.GetFullName();
            Description = package.Description;
            IconUrl = package.IconUrl;

            Published = package.Published == null ? (DateTime?) null : package.Published.Value.LocalDateTime;
            SpecialVersion = package.Version.SpecialVersion;
            IsAbsoluteLatestVersion = package.IsAbsoluteLatestVersion;

            IsPrerelease = !string.IsNullOrWhiteSpace(SpecialVersion);
        }
开发者ID:WildGums,项目名称:Orc.NuGetExplorer,代码行数:18,代码来源:PackageDetails.cs

示例5: Execute

        public bool Execute(string installPath, string scriptFileName, IPackage package, Project project, FrameworkName targetFramework, ILogger logger)
        {
            string fullPath;
            IPackageFile scriptFile;
            if (package.FindCompatibleToolFiles(scriptFileName, targetFramework, out scriptFile))
            {
                fullPath = Path.Combine(installPath, scriptFile.Path);
            }
            else
            {
                return false;
            }

            if (File.Exists(fullPath))
            {
                if (project != null && scriptFile != null)
                {
                    logger.Log(MessageLevel.Debug, NuGetResources.Debug_TargetFrameworkInfoPrefix, package.GetFullName(), project.Name,
                        VersionUtility.GetShortFrameworkName(targetFramework));

                    logger.Log(MessageLevel.Debug, NuGetResources.Debug_TargetFrameworkInfo_PowershellScripts,
                        Path.GetDirectoryName(scriptFile.Path), VersionUtility.GetTargetFrameworkLogString(scriptFile.TargetFramework));
                }

                string toolsPath = Path.GetDirectoryName(fullPath);
                string logMessage = String.Format(CultureInfo.CurrentCulture, VsResources.ExecutingScript, fullPath);

                // logging to both the Output window and progress window.
                logger.Log(MessageLevel.Info, logMessage);

                IConsole console = OutputConsoleProvider.CreateOutputConsole(requirePowerShellHost: true);
                Host.Execute(console,
                    "[email protected](); $input|%{$__pc_args+=$_}; & " + PathHelper.EscapePSPath(fullPath) + " $__pc_args[0] $__pc_args[1] $__pc_args[2] $__pc_args[3]; Remove-Variable __pc_args -Scope 0",
                    new object[] { installPath, toolsPath, package, project });

                return true;
            }
            return false;
        }
开发者ID:Berzeger,项目名称:NuGet,代码行数:39,代码来源:PSScriptExecutor.cs

示例6: InstallPackage

        public void InstallPackage(IPackage package)
        {
            var directoryToExpandTo = Path.Combine(_localRepository.Source, package.Id);
            foreach (var file in package.GetContentFiles())
            {
                string pathWithoutContextPrefix = file.Path.Substring("content/".Length);
                var fullPath = Path.Combine(directoryToExpandTo, pathWithoutContextPrefix);
                Directory.CreateDirectory(Path.GetDirectoryName(fullPath));

                using (Stream writeStream = File.OpenWrite(fullPath),
                              readStream = file.GetStream())
                {
                    readStream.CopyTo(writeStream);
                }
            }

            var packageFile = Path.Combine(directoryToExpandTo, package.GetFullName() + ".nupkg");
            using (Stream readStream = package.GetStream(),
                          writeStream = File.OpenWrite(packageFile))
            {
                readStream.CopyTo(writeStream);
            }
        }
开发者ID:pranavkm,项目名称:SiteExtensions.Admin,代码行数:23,代码来源:WebProjectManager.cs

示例7: Execute

 private void Execute(IPackage package, IPackageOperationResolver resolver)
 {
     var operations = resolver.ResolveOperations(package);
     if (operations.Any()) {
         foreach (PackageOperation operation in operations) {
             Execute(operation);
         }
     }
     else if (LocalRepository.Exists(package)) {
         Logger.Log(MessageLevel.Info, NuGetResources.Log_PackageAlreadyInstalled, package.GetFullName());
     }
 }
开发者ID:jacksonh,项目名称:nuget,代码行数:12,代码来源:PackageManager.cs

示例8: ReinstallPackageInProject

        /// <summary>
        /// Reinstall the specified package in the specified project, taking care of logging too.
        /// </summary>
        private void ReinstallPackageInProject(
            IProjectManager projectManager,
            IPackage package,
            bool updateDependencies,
            bool allowPrereleaseVersions,
            ILogger logger)
        {
            logger = logger ?? NullLogger.Instance;
            IDisposable disposableAction = StartReinstallOperation(package.Id, package.Version.ToString());

            try
            {
                InitializeLogger(logger, projectManager);

                logger.Log(MessageLevel.Info, VsResources.ReinstallProjectPackage, package, projectManager.Project.ProjectName);

                // Before we start reinstalling, need to make sure the package exists in the source repository.
                // Otherwise, the package will be uninstalled and can't be reinstalled.
                if (SourceRepository.Exists(package))
                {
                    RunSolutionAction(
                        () =>
                        {
                            UninstallPackage(
                                projectManager,
                                package.Id,
                                package.Version,
                                forceRemove: true,
                                removeDependencies: updateDependencies,
                                logger: logger);

                            InstallPackage(
                                projectManager,
                                package.Id,
                                package.Version,
                                ignoreDependencies: !updateDependencies,
                                allowPrereleaseVersions: allowPrereleaseVersions || !package.IsReleaseVersion(),
                                logger: logger);
                        });
                }
                else
                {
                    logger.Log(
                        MessageLevel.Warning,
                        VsResources.PackageRestoreSkipForProject,
                        package.GetFullName(),
                        projectManager.Project.ProjectName);
                }
            }
            finally
            {
                ClearLogger(projectManager);
                disposableAction.Dispose();
            }
        }
开发者ID:Mailaender,项目名称:xamarin-nuget,代码行数:58,代码来源:VSPackageManager.cs

示例9: AskRemoveDependencyAndCheckUninstallPSScript

        protected bool? AskRemoveDependencyAndCheckUninstallPSScript(IPackage package, bool checkDependents)
        {
            if (checkDependents)
            {
                // check if there is any other package depends on this package.
                // if there is, throw to cancel the uninstallation
                var dependentsWalker = new DependentsWalker(LocalRepository);
                IList<IPackage> dependents = dependentsWalker.GetDependents(package).ToList();
                if (dependents.Count > 0)
                {
                    ShowProgressWindow();
                    throw new InvalidOperationException(
                        String.Format(
                            CultureInfo.CurrentCulture,
                            Resources.PackageHasDependents,
                            package.GetFullName(),
                            String.Join(", ", dependents.Select(d => d.GetFullName()))
                        )
                    );
                }
            }

            var uninstallWalker = new UninstallWalker(
                LocalRepository,
                new DependentsWalker(LocalRepository),
                logger: NullLogger.Instance,
                removeDependencies: true,
                forceRemove: false)
                {
                    ThrowOnConflicts = false
                };
            IList<PackageOperation> operations = uninstallWalker.ResolveOperations(package).ToList();

            var uninstallPackageNames = (from o in operations
                                         where o.Action == PackageAction.Uninstall && !PackageEqualityComparer.IdAndVersion.Equals(o.Package, package)
                                         select o.Package.ToString()).ToList();

            bool? removeDependencies = false;
            if (uninstallPackageNames.Count > 0)
            {
                // show each dependency package on one line
                String packageNames = String.Join(Environment.NewLine, uninstallPackageNames);
                String message = String.Format(CultureInfo.CurrentCulture, Resources.Dialog_RemoveDependencyMessage, package)
                        + Environment.NewLine
                        + Environment.NewLine
                        + packageNames;

                removeDependencies = _userNotifierServices.ShowRemoveDependenciesWindow(message);
            }
            if (removeDependencies == null)
            {
                return removeDependencies;
            }

            bool hasScriptPackages;
            if (removeDependencies == true)
            {
                // if user wants to remove dependencies, we need to check all of them for PS scripts
                var scriptPackages = from o in operations
                                     where o.Package.HasPowerShellScript()
                                     select o.Package;
                hasScriptPackages = scriptPackages.Any();
            }
            else
            {
                // otherwise, just check the to-be-uninstalled package
                hasScriptPackages = package.HasPowerShellScript(new string[] { PowerShellScripts.Uninstall });
            }

            if (hasScriptPackages)
            {
                if (!RegistryHelper.CheckIfPowerShell2Installed())
                {
                    throw new InvalidOperationException(Resources.Dialog_PackageHasPSScript);
                }
            }

            return removeDependencies;
        }
开发者ID:xero-github,项目名称:Nuget,代码行数:79,代码来源:InstalledProvider.cs

示例10: CreatePackageConflictException

        private static InvalidOperationException CreatePackageConflictException(IPackage resolvedPackage, IPackage package, IEnumerable<IPackage> dependents)
        {
            if (dependents.Count() == 1)
            {
                return new InvalidOperationException(String.Format(CultureInfo.CurrentCulture,
                       NuGetResources.ConflictErrorWithDependent, package.GetFullName(), resolvedPackage.GetFullName(), dependents.Single().Id));
            }

            return new InvalidOperationException(String.Format(CultureInfo.CurrentCulture,
                        NuGetResources.ConflictErrorWithDependents, package.GetFullName(), resolvedPackage.GetFullName(), String.Join(", ",
                        dependents.Select(d => d.Id))));
        }
开发者ID:nickfloyd,项目名称:NuGet,代码行数:12,代码来源:InstallWalker.cs

示例11: Do

        private static void Do(LocalPackageRepository inputRepository, PackageManager inputManager, IPackage package, string cacheDirectory, IEnumerable<string> references, string outputDirectory)
        {
            Console.WriteLine("--- Building {0} ---", package.GetFullName());
            var solution = new ProjectCollection();
            var logger = new ConsoleLogger();
            logger.Verbosity = LoggerVerbosity.Minimal;

            inputManager.InstallPackage(package, false, false);
            var packageDirectory = Path.Combine(cacheDirectory, package.Id);
            var moduleDirectory = Directory.GetDirectories(Path.Combine(packageDirectory, "Content", "Modules"))[0];
            var moduleName = Path.GetFileName(moduleDirectory);
            var project = solution.LoadProject(Path.Combine(moduleDirectory, moduleName + ".csproj"));

            var candidateDirectories = references
                   .Select(r => Path.Combine(cacheDirectory, r))
                   .Concat(Directory.EnumerateDirectories(cacheDirectory).Where(d => !Path.GetFileName(d).StartsWith("Orchard.")))
                   .Join(new[] { "net40-full", "net40", "net35", "net20", "net", "" }, l => true, r => true, (l, r) => Path.Combine(l, "lib", r))
                   .Where(Directory.Exists)
                   .ToList();

            foreach (var item in GetReferences(project).ToList())
            {
                var referenceName = GetReferenceName(item);
                var referenceDirectory = candidateDirectories.FirstOrDefault(d => File.Exists(Path.Combine(d, referenceName + ".dll")));

                if (referenceDirectory != null)
                {
                    Console.WriteLine("Replacing reference {0} with {1}", referenceName, referenceDirectory);
                    ReplaceReference(project, item, referenceName, referenceDirectory);
                }
            }

            var dependencies = new List<ManifestDependency>();

            foreach (var item in GetModuleReferences(project).ToList())
            {
                var referencedModuleName = item.GetMetadataValue("Name");
                var referencedPackageId = "Orchard.Module." + item.GetMetadataValue("Name");
                var referencedPackage = inputRepository.FindPackage(referencedPackageId);

                Console.WriteLine("Depends on {0}", referencedModuleName);
                dependencies.Add(new ManifestDependency { Id = referencedPackage.Id, Version = "[" + referencedPackage.Version + "]" });

                Do(inputRepository, inputManager, referencedPackage, cacheDirectory, references, outputDirectory);
                ReplaceReference(project, item, referencedModuleName, Path.Combine(cacheDirectory, referencedPackageId, "Content", "Modules", referencedModuleName, "bin"));
            }

            if (!File.Exists(Path.Combine(moduleDirectory, "bin", moduleName + ".dll")))
                if (!project.Build(logger))
                    throw new Exception("Failed to build");

            var rules = new[]
                {
                    @"bin\" + moduleName + ".dll",
                    @"Module.txt",
                    @"Placement.info",
                    @"Web.config",
                    @"Content\**",
                    @"Scripts\**",
                    @"Recipes\**",
                    @"Styles\**",
                    @"Views\**"
                };

            var manifest = Manifest.Create(package);
            manifest.Metadata.DependencySets = new List<ManifestDependencySet> { new ManifestDependencySet { Dependencies = dependencies } };
            manifest.Files = rules.Select(r => new ManifestFile { Source = @"Content\Modules\" + moduleName + @"\**\" + r, Target = @"Content\Modules\" + moduleName }).ToList();

            var builder = new PackageBuilder();
            builder.Populate(manifest.Metadata);
            builder.PopulateFiles(packageDirectory, manifest.Files);

            Directory.CreateDirectory(outputDirectory);
            var outputPackgeFileName = Path.Combine(outputDirectory, manifest.Metadata.Id + "." + manifest.Metadata.Version + ".nupkg");
            using (var outputPackageFile = File.Create(outputPackgeFileName))
                builder.Save(outputPackageFile);
        }
开发者ID:SymbolSource,项目名称:Orchard,代码行数:77,代码来源:Program.cs

示例12: ExecuteUninstall

        protected virtual void ExecuteUninstall(IPackage package)
        {
            string packageFullName = package.GetFullName();
            Logger.Log(MessageLevel.Info, NuGetResources.Log_BeginUninstallPackage, packageFullName);

            PackageOperationEventArgs args = CreateOperation(package);
            OnUninstalling(args);

            if (args.Cancel)
            {
                return;
            }

            OnRemoveFiles(args);

            LocalRepository.RemovePackage(package);

            Logger.Log(MessageLevel.Info, NuGetResources.Log_SuccessfullyUninstalledPackage, packageFullName);

            OnUninstalled(args);
        }
开发者ID:sistoimenov,项目名称:NuGet2,代码行数:21,代码来源:PackageManager.cs

示例13: CreatePackageHasDependentsException

        protected virtual InvalidOperationException CreatePackageHasDependentsException(IPackage package, IEnumerable<IPackage> dependents)
        {
            if (dependents.Count() == 1)
            {
                return new InvalidOperationException(String.Format(CultureInfo.CurrentCulture,
                       NuGetResources.PackageHasDependent, package.GetFullName(), dependents.Single().GetFullName()));
            }

            return new InvalidOperationException(String.Format(CultureInfo.CurrentCulture,
                        NuGetResources.PackageHasDependents, package.GetFullName(), String.Join(", ",
                        dependents.Select(d => d.GetFullName()))));

        }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:13,代码来源:UninstallWalker.cs

示例14: Walk

        public void Walk(IPackage package)
        {
            // Do nothing if we saw this package already
            if (Marker.IsVisited(package))
            {
                ProcessPackageTarget(package);
                return;
            }

            OnBeforePackageWalk(package);

            // Mark the package as processing
            Marker.MarkProcessing(package);

            if (!IgnoreDependencies)
            {
                foreach (var dependency in package.Dependencies)
                {
                    // Try to resolve the dependency from the visited packages first
                    IPackage resolvedDependency = Marker.ResolveDependency(dependency, AllowPrereleaseVersions, preferListedPackages: false) ??
                                                  ResolveDependency(dependency);

                    if (resolvedDependency == null)
                    {
                        OnDependencyResolveError(dependency);
                        // If we're skipping dependency resolve errors then move on to the next
                        // dependency
                        if (SkipDependencyResolveError)
                        {
                            continue;
                        }

                        // If we're not skipping this is an error in the package config - they need to fix the dependencies.
                        throw new InvalidOperationException(
                           String.Format(CultureInfo.CurrentCulture,
                           NuGetResources.UnableToResolveDependencyForPackage, dependency.Id + " " + dependency.VersionSpec, package.GetFullName()));
                    }

                    if (!IgnoreWalkInfo)
                    {
                        // Set the parent
                        PackageWalkInfo dependencyInfo = GetPackageInfo(resolvedDependency);
                        dependencyInfo.Parent = package;
                    }

                    Marker.AddDependent(package, resolvedDependency);

                    if (!OnAfterResolveDependency(package, resolvedDependency))
                    {
                        continue;
                    }

                    if (Marker.IsCycle(resolvedDependency) ||
                        Marker.IsVersionCycle(resolvedDependency.Id))
                    {
                        if (RaiseErrorOnCycle)
                        {
                            List<IPackage> packages = Marker.Packages.ToList();
                            packages.Add(resolvedDependency);

                            throw new InvalidOperationException(
                               String.Format(CultureInfo.CurrentCulture,
                               NuGetResources.CircularDependencyDetected, String.Join(" => ",
                               packages.Select(p => p.GetFullName()))));
                        }

                        continue;
                    }

                    Walk(resolvedDependency);
                }
            }

            // Mark the package as visited
            Marker.MarkVisited(package);


            ProcessPackageTarget(package);

            OnAfterPackageWalk(package);
        }
开发者ID:xero-github,项目名称:Nuget,代码行数:81,代码来源:PackageWalker.cs

示例15: ExecuteInstall

        private void ExecuteInstall(IPackage package)
        {
            PackageOperationEventArgs args = CreateOperation(package);
            OnInstalling(args);

            if (args.Cancel) {
                return;
            }

            ExpandFiles(package);

            LocalRepository.AddPackage(package);

            Logger.Log(MessageLevel.Info, NuGetResources.Log_PackageInstalledSuccessfully, package.GetFullName());

            OnInstalled(args);
        }
开发者ID:jacksonh,项目名称:nuget,代码行数:17,代码来源:PackageManager.cs


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