OneGet / oneget

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

find-package / install-package failling for network share source #373

Open electricJP opened 6 years ago

electricJP commented 6 years ago

I'm trying to setup usage of a local repo. But somehow package cannot be installed:

  PS C:\> 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, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, SkipValidate
    PowerShellGet            1.0.0.1          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, Filter, Tag, Includes, DscResource, RoleCapability, Command, PublishLoc...
    Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent

    PS C:\> Get-PackageSource
    Name                             ProviderName     IsTrusted  Location
    ----                             ------------     ---------  --------
    PSMyGallery                      NuGet            True       \\myserver\packages
    PSGallery                        PowerShellGet    True       https://www.powershellgallery.com/api/v2/

PS C:\> dir \\myserver\packages
    Directory: \\myserver\packages
Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       2018-09-06  10:53 AM                carbon
d-----       2018-09-06  12:46 PM                xrobocopy

PS C:\> Find-Package -Source PSMyGallery
Name                           Version          Source           Summary
----                           -------          ------           -------
Carbon                         2.6.0            PSMyGallery     Carbon is a PowerShell module for automating the configuration Windows 7, 8, 2008, and 2012 and automation the installation and configuration of Window...
xRobocopy                      2.0.0.0          PSMyGallery     This module is used to facilitate large file copies with complex requirements such as multithreading, restarts, and exclusions when recursing content.

PS C:\> Find-Package -name carbon* -Source PSMyGallery
Name                           Version          Source           Summary
----                           -------          ------           -------
Carbon                         2.6.0            PSMyGallery      Carbon is a PowerShell module for automating the configuration Windows 7, 8, 2008, and 2012 and automation the installation and configuration of Window...

PS C:\> Find-Package -name carbon -Source PSMyGallery
Find-Package : No match was found for the specified search criteria and package name 'carbon'. Try Get-PackageSource to see all available registered package sources.
At line:1 char:1
+ Find-Package -name carbon -Source PSMyGallery
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (Microsoft.Power...ets.FindPackage:FindPackage) [Find-Package], Exception
+ FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackage

PS C:\> Find-Package -name xrobocopy -Source PSMyGallery -Provider nuget -Verbose
VERBOSE: Using the provider 'NuGet' for searching packages.
VERBOSE: Total package yield:'0' for the specified package 'xrobocopy'.
Find-Package : No match was found for the specified search criteria and package name 'xrobocopy'. Try Get-PackageSource to see all available registered package sources.
At line:1 char:1
+ Find-Package -name xrobocopy -Source PSMyGallery -Provider nuget -Verb ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ets.FindPackage:FindPackage) [Find-Package], Exception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackage

PS C:\> $psversiontable
Name                           Value
----                           -----
PSVersion                      5.1.14409.1012
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14409.1012
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

PS C:\> get-module
ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Content...}
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Binary     1.0.0.1    PackageManagement                   {Find-Package, Find-PackageProvider, Get-Package, Get-PackageProvider...}

I renamed some text for security reason. Install-package will fail too.

PS C:\> Install-Package -name carbon -Source PSMyGallery -Verbose
VERBOSE: Using the provider 'NuGet' for searching packages.
VERBOSE: Total package yield:'0' for the specified package 'carbon'.
Install-Package : No match was found for the specified search criteria and package name 'carbon'. Try Get-PackageSource to see all available registered package sources.
At line:1 char:1
+ Install-Package -name carbon -Source PSMyGallery -Verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

I tried on several servers (2008R2 and Win2012R2) and got the same behaviour.

JP

monban commented 5 years ago

Have you created the feed using the nuget init or nuget add commands? You can find a good summary of creating a local package feed in the nuget documentation.

electricJP commented 5 years ago

In the end I created a NuGet server to avoid using a network share