OneGet / oneget

PackageManagement (aka OneGet) is a package manager for Windows
MIT License
2.38k stars 190 forks source link

Unable to find dependent package(s) (CoreCompat.System.Drawing) #279

Closed VahidN closed 7 years ago

VahidN commented 7 years ago

I'm trying to install iTextSharp.LGPLv2.Core package using PowerShell with the following command:

 Install-Package iTextSharp.LGPLv2.Core -ProviderName NuGet -Source https://www.nuget.org/api/v2/ -Verbose

But it can't find its dependent library

VERBOSE: Using the provider 'NuGet' for searching packages.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='iTextSharp.LGPLv2.Core'' for
 ''.
VERBOSE: Total package yield:'1' for the specified package 'iTextSharp.LGPLv2.Core'.
VERBOSE: Performing the operation "Install Package" on target "Package 'iTextSharp.LGPLv2.Core' version '1.2.4'
 from 'nuget.org'.".

The package(s) come(s) from a package source that is not marked as trusted.
Are you sure you want to install software from 'nuget.org'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): y
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='iTextSharp.LGPLv2.Core'' for
 ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='CoreCompat.System.Drawing''
for ''.
Install-Package : Unable to find dependent package(s) (CoreCompat.System.Drawing)
At line:1 char:2
+  Install-Package iTextSharp.LGPLv2.Core -ProviderName NuGet -Source h ...
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (CoreCompat.System.Drawing:String) [Install-Package], Exception
    + FullyQualifiedErrorId : UnableToFindDependencyPackage,Microsoft.PowerShell.PackageManagement.Cmdlets.Ins
   tallPackage

The dependent package is CoreCompat.System.Drawing.

My Environment

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.14393.953
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14393.953
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

> Get-Module
ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Computer, Add-Content, Checkpoint-Computer, ...
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Ob...
Script     1.2        PSReadline                          {Get-PSReadlineKeyHandler, Get-PSReadlineOption, ...

> Get-Module -ListAvailable PowerShellGet,PackageManagement
Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, G...
Binary     1.0.0.0    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, G...
Script     1.0.0.1    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-...

> Get-PackageProvider
Name                     Version          DynamicOptions
----                     -------          --------------
msi                      3.0.0.0          AdditionalArguments
msu                      3.0.0.0
NuGet                    2.8.5.208        Destination, ExcludeVersion, Scope, SkipDependencies, Headers, Fil...
PowerShellGet            1.0.0.1          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublishe...
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent

> Get-PackageProvider -ListAvailable

Name                     Version          DynamicOptions
----                     -------          --------------
msi                      3.0.0.0          AdditionalArguments
msu                      3.0.0.0
NuGet                    2.8.5.208        Destination, ExcludeVersion, Scope, SkipDependencies, Headers, Fil...
PowerShellGet            1.0.0.1          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublishe...
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent
brywang-msft commented 7 years ago

Can you add -AllowPreleaseVersions? Pre-release versions are ignored in NuGetProvider by default. CoreCompat.System.Drawing only has pre-release versions available.

In the unlikely case that you need to ignore pre-release versions for most dependencies, I would run Install-Package -AllowPrereleaseVersions for those specific packages that need it, then use Install-Package normally for the package you actually want (e.g. iTextSharp.LGPLv2.Core).