Skip to content

Install-NuGetClientBinaries : The property 'Path' cannot be found on this object. Verify that the property exists. #18

@josheinstein

Description

@josheinstein

If you have a command alias set up for nuget or dotnet, PowerShellGet produces the above error when it attempts to look for these commands in the path. This is because the alias command object does not have a Path property, and the module has turned on strict mode internally.

Adding the -CommandType parameter to Get-Command and specifying Application should work around the issue, since the alias command won't be returned.

Steps to reproduce

Define an alias for the dotnet.exe executable or nuget.exe. Then try publishing a script or module.

Set-Alias dotnet "${ENV:ProgramFiles}\dotnet\dotnet.exe"
Publish-Script -Path C:\path\to\some\script.ps1

Expected behavior

Expect no errors, or a more descriptive error about what went wrong.

Actual behavior

Install-NuGetClientBinaries : The property 'Path' cannot be found on this object. Verify that the property exists.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2\PSModule.psm1:10997 char:9
+         Install-NuGetClientBinaries -CallerPSCmdlet $PSCmdlet -Bootst ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-NuGetClientBinaries], PropertyNotFoundException
    + FullyQualifiedErrorId : PropertyNotFoundStrict,Install-NuGetClientBinaries

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.18362.145
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.18362.145
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
> Get-Module -ListAvailable PowerShellGet,PackageManagement
Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.4.3      PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-Packa... Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...
Script     2.2        PowerShellGet                       {Find-Command, Find-DSCResource, Find-Module, Find-RoleCap... Script     1.0.0.1    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}  
> Get-PackageProvider -ListAvailable
Name                     Version          DynamicOptions
----                     -------          --------------
msi                      3.0.0.0          AdditionalArguments
msu                      3.0.0.0
nuget                    2.8.5.208
NuGet                    3.0.0.1          Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag...
PowerShellGet            2.2.0.0          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, ...
PowerShellGet            1.0.0.1
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions