I’m attempting to grab DSC modules from PSGallery, but am hitting an error that i couldn’t find on google.
PS C:\WINDOWS\system32> install-module xStorage
WARNING: The property ‘LocalName’ cannot be found on this object. Verify that the property exists.
Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from
‘PSGallery’?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is “N”): A
PackageManagement\Install-Package : The property ‘LocalName’ cannot be found on this object. Verify that the property exists.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1375 char:21
Any ideas?
system
January 12, 2016, 2:00pm
2
What version of the PackageManagement module do you have installed? I can see from your output that you’ve got 1.0.0.1 of PowerShellGet, and I’m wondering if you’ve somehow gotten the two modules out of sync. The version of the Nuget provider may also be involved. What do you get from these two commands?
Get-Module PackageManagement -ListAvailable | Out-Host
Get-PackageProvider Nuget | Out-Host
Hi Dave,
PS C:\Users\bcouh\OneDrive\Documents\Visual Studio 2015\Projects\DSCLab\DSCLab\DSC> Get-Module PackageManagement -ListAvailable | Out-Host
Directory: C:\Program Files\WindowsPowerShell\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Binary 1.0.0.1 PackageManagement {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}
Binary 1.0.0.0 PackageManagement {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}
PS C:\Users\bcouh\OneDrive\Documents\Visual Studio 2015\Projects\DSCLab\DSCLab\DSC> Get-Module PackageManagement -ListAvailable | Out-Host
Directory: C:\Program Files\WindowsPowerShell\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Binary 1.0.0.1 PackageManagement {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}
system
January 12, 2016, 4:40pm
4
OK, that’s the same thing I’ve got. What about Get-PackageProvider Nuget ?
system
January 12, 2016, 4:56pm
5
Another bit of troubleshooting:
$xStorage = Find-Package xStorage
$xStorage | Get-Member | Out-Host
$xStorage.Metadata | Get-Member | Out-Host
$xStorage.Metadata.Keys | Get-Member | Out-Host
Here’s what I get when I run those commands:
<#
C:\
λ $xStorage = Find-Package xStorage
C:\
λ $xStorage | Get-Member | Out-Host
TypeName: Microsoft.PackageManagement.Packaging.SoftwareIdentity
Name MemberType Definition
---- ---------- ----------
AddDependency Method string AddDependency(string providerName, string packageName, string version, string source, string appliesTo)
AddMetadataValue Method string AddMetadataValue(string elementPath, uri namespace, string name, string value)
ContainsKey Method bool ContainsKey(System.Xml.Linq.XName key)
Equals Method bool Equals(System.Object obj)
FetchPackageDetails Method void FetchPackageDetails(Microsoft.PackageManagement.Internal.Api.IHostApi api)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
IsApplicable Method bool IsApplicable(hashtable environment)
ToString Method string ToString()
AppliesToMedia Property string AppliesToMedia {get;}
Attributes Property Microsoft.PackageManagement.Internal.Packaging.AttributeIndexer Attributes {get;}
CanonicalId Property string CanonicalId {get;}
Dependencies Property System.Collections.Generic.IEnumerable[string] Dependencies {get;}
Entities Property System.Collections.Generic.IEnumerable[Microsoft.PackageManagement.Internal.Packaging.Entity] Entities {get;}
Evidence Property Microsoft.PackageManagement.Internal.Packaging.Evidence Evidence {get;}
FromTrustedSource Property bool FromTrustedSource {get;}
FullPath Property string FullPath {get;}
IsCorpus Property System.Nullable[bool] IsCorpus {get;}
IsPatch Property System.Nullable[bool] IsPatch {get;}
IsSupplemental Property System.Nullable[bool] IsSupplemental {get;}
Links Property System.Collections.Generic.IEnumerable[Microsoft.PackageManagement.Internal.Packaging.Link] Links {get;}
Meta Property System.Collections.Generic.IEnumerable[Microsoft.PackageManagement.Internal.Packaging.SoftwareMetadata] Meta {get;}
Metadata Property Microsoft.PackageManagement.Internal.Packaging.MetadataIndexer Metadata {get;}
Name Property string Name {get;}
PackageFilename Property string PackageFilename {get;}
Payload Property Microsoft.PackageManagement.Internal.Packaging.Payload Payload {get;}
ProviderName Property string ProviderName {get;}
SearchKey Property string SearchKey {get;}
Source Property string Source {get;}
Status Property string Status {get;}
Summary Property string Summary {get;}
SwidTags Property System.Collections.Generic.IEnumerable[Microsoft.PackageManagement.Internal.Packaging.Swidtag] SwidTags {get;}
SwidTagText Property string SwidTagText {get;}
TagId Property string TagId {get;}
TagVersion Property string TagVersion {get;}
Version Property string Version {get;}
VersionScheme Property string VersionScheme {get;}
XmlLang Property string XmlLang {get;}
C:\
λ $xStorage.Metadata | Get-Member | Out-Host
TypeName: Microsoft.PackageManagement.Internal.Packaging.MetadataIndexer
Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
Item ParameterizedProperty System.Collections.Generic.IEnumerable[string] Item(string key) {get;}
Count Property int Count {get;}
Keys Property System.Collections.Generic.IEnumerable[System.Xml.Linq.XName] Keys {get;}
Values Property System.Collections.Generic.IEnumerable[string] Values {get;}
C:\
λ $xStorage.Metadata.Keys | Get-Member | Out-Host
TypeName: System.Xml.Linq.XName
Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj), bool IEquatable[XName].Equals(System.Xml.Linq.XName other)
GetHashCode Method int GetHashCode()
GetObjectData Method void ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
GetType Method type GetType()
ToString Method string ToString()
LocalName Property string LocalName {get;}
Namespace Property System.Xml.Linq.XNamespace Namespace {get;}
NamespaceName Property string NamespaceName {get;}
C:\
λ
#>
Hey Dave,
That error came up again (as a warning) after running the second set of commands.
PS C:\Users\bcouh\OneDrive\Documents\Visual Studio 2015\Projects\DSCLab\DSCLab\bin> Get-PackageProvider Nuget
Name Version DynamicOptions
---- ------- --------------
NuGet 2.8.5.202 Destination, ExcludeVersion, Headers, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, SkipValidate
PS C:\Users\bcouh\OneDrive\Documents\Visual Studio 2015\Projects\DSCLab\DSCLab\bin> $xStorage = Find-Package xStorage
>> $xStorage | Get-Member | Out-Host
>> $xStorage.Metadata | Get-Member | Out-Host
>> $xStorage.Metadata.Keys | Get-Member | Out-Host
WARNING: The property 'LocalName' cannot be found on this object. Verify that the property exists.
TypeName: Microsoft.PackageManagement.Packaging.SoftwareIdentity
Name MemberType Definition
---- ---------- ----------
AddDependency Method string AddDependency(string providerName, string packageName, string version, string source, string appliesTo)
AddMetadataValue Method string AddMetadataValue(string elementPath, uri namespace, string name, string value)
ContainsKey Method bool ContainsKey(System.Xml.Linq.XName key)
Equals Method bool Equals(System.Object obj)
FetchPackageDetails Method void FetchPackageDetails(Microsoft.PackageManagement.Internal.Api.IHostApi api)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
IsApplicable Method bool IsApplicable(hashtable environment)
ToString Method string ToString()
AppliesToMedia Property string AppliesToMedia {get;}
Attributes Property Microsoft.PackageManagement.Internal.Packaging.AttributeIndexer Attributes {get;}
CanonicalId Property string CanonicalId {get;}
Dependencies Property System.Collections.Generic.IEnumerable[string] Dependencies {get;}
Entities Property System.Collections.Generic.IEnumerable[Microsoft.PackageManagement.Internal.Packaging.Entity] Entities {get;}
Evidence Property Microsoft.PackageManagement.Internal.Packaging.Evidence Evidence {get;}
FromTrustedSource Property bool FromTrustedSource {get;}
FullPath Property string FullPath {get;}
IsCorpus Property System.Nullable[bool] IsCorpus {get;}
IsPatch Property System.Nullable[bool] IsPatch {get;}
IsSupplemental Property System.Nullable[bool] IsSupplemental {get;}
Links Property System.Collections.Generic.IEnumerable[Microsoft.PackageManagement.Internal.Packaging.Link] Links {get;}
Meta Property System.Collections.Generic.IEnumerable[Microsoft.PackageManagement.Internal.Packaging.SoftwareMetadata] Meta {get;}
Metadata Property Microsoft.PackageManagement.Internal.Packaging.MetadataIndexer Metadata {get;}
Name Property string Name {get;}
PackageFilename Property string PackageFilename {get;}
Payload Property Microsoft.PackageManagement.Internal.Packaging.Payload Payload {get;}
ProviderName Property string ProviderName {get;}
SearchKey Property string SearchKey {get;}
Source Property string Source {get;}
Status Property string Status {get;}
Summary Property string Summary {get;}
SwidTags Property System.Collections.Generic.IEnumerable[Microsoft.PackageManagement.Internal.Packaging.Swidtag] SwidTags {get;}
SwidTagText Property string SwidTagText {get;}
TagId Property string TagId {get;}
TagVersion Property string TagVersion {get;}
Version Property string Version {get;}
VersionScheme Property string VersionScheme {get;}
XmlLang Property string XmlLang {get;}
TypeName: Microsoft.PackageManagement.Internal.Packaging.MetadataIndexer
Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
Item ParameterizedProperty System.Collections.Generic.IEnumerable[string] Item(string key) {get;}
Count Property int Count {get;}
Keys Property System.Collections.Generic.IEnumerable[System.Xml.Linq.XName] Keys {get;}
Values Property System.Collections.Generic.IEnumerable[string] Values {get;}
TypeName: System.Xml.Linq.XName
Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj), bool IEquatable[XName].Equals(System.Xml.Linq.XName other)
GetHashCode Method int GetHashCode()
GetObjectData Method void ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
GetType Method type GetType()
ToString Method string ToString()
LocalName Property string LocalName {get;}
Namespace Property System.Xml.Linq.XNamespace Namespace {get;}
NamespaceName Property string NamespaceName {get;}
PS C:\Users\bcouh\OneDrive\Documents\Visual Studio 2015\Projects\DSCLab\DSCLab\bin>
I also got weird messages.
Either:
WARNING: Cannot bind argument to parameter ‘null’ because it is an empty string
or
WARNING: The property ‘LocalName’ cannot be found on this object. Verify that the property exists.
With the latter, install actually fails and the warning is duplicated with an error message.
This is apparently a regression in NuGet package provider 2.8.5.202, because removing 202 and installing specifically 201 fixes these issues
I can agree to that.
I wanted to
Install-Module -Name MVA_DSC_2015_DAY1 due to training purposes, which failed in the same way. After deleting the directories under:
$env:ProgramFiles\PackageManagement\ProviderAssemblies\nuget
$env:LOCALAPPDATA\PackageManagement\ProviderAssemblies\nuget
where nuget was located and installing another version
install-packageprovider -name NuGet -minimumversion 2.8.5.201 -maximumversion 2.8.5.201 -force everything was fine.
Thanks for the tip.
Worked for me as well, thanks everyone for the assistance!