NuGet.PackageManager.InstallPackage C# (CSharp) Méthode

InstallPackage() protected méthode

protected InstallPackage ( IPackage package, FrameworkName targetFramework, bool ignoreDependencies, bool allowPrereleaseVersions ) : void
package IPackage
targetFramework FrameworkName
ignoreDependencies bool
allowPrereleaseVersions bool
Résultat void
        protected void InstallPackage(IPackage package, FrameworkName targetFramework, bool ignoreDependencies, bool allowPrereleaseVersions)
        {
            Execute(package, new InstallWalker(LocalRepository,
                                               SourceRepository,
                                               targetFramework,
                                               Logger,
                                               ignoreDependencies,
                                               allowPrereleaseVersions));
        }

Same methods

PackageManager::InstallPackage ( IPackage package, bool ignoreDependencies, bool allowPrereleaseVersions ) : void
PackageManager::InstallPackage ( string packageId ) : void
PackageManager::InstallPackage ( string packageId, SemanticVersion version ) : void
PackageManager::InstallPackage ( string packageId, SemanticVersion version, bool ignoreDependencies, bool allowPrereleaseVersions ) : void

Usage Example

Exemple #1
0
        /// <summary>
        /// Installs the specified package.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns>Null on error, otherwise the package belonging to the name.</returns>
        public IPackage Install(string name)
        {
            try
            {
                IPackage package = Repo.FindPackage(name);

                // important: the following line will throw an exception when debugging
                // if using the official Nuget.Core dll.
                // Run without debugging to avoid the exception and install the package
                // more at http://nuget.codeplex.com/discussions/259099
                // We include a custom nuget.core without SecurityTransparent to avoid the error.
                if (package != null)
                {
                    _packageManager.InstallPackage(package, true, false);
                    return(package);
                }
            }
            catch (WebException ex)
            {
                // Timed out.
                Debug.WriteLine(ex.Message);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                Debug.WriteLine(ex.StackTrace);
            }

            return(null);
        }
All Usage Examples Of NuGet.PackageManager::InstallPackage