PoshCode / Configuration

A module to help other modules have settings
MIT License
176 stars 27 forks source link

PowerShell 4 Support #6

Closed RamblingCookieMonster closed 7 years ago

RamblingCookieMonster commented 7 years ago

Hi!

If it matters, it looks like this is currently tied to PowerShell 5 or later.

I get the following error when attempting to load/use the module:

$KeyValue = Get-Metadata $Path -PropertyName $PropertyName -Passthru
 +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [<<==>>] Exception: Cannot find an overload for "ParseInput" and the argument count: "4".

Looking at constructors for that method, I only see the three parameter version:

OverloadDefinitions
-------------------
static System.Management.Automation.Language.ScriptBlockAst ParseInput(
    string input,
    [ref]System.Management.Automation.Language.Token[] tokens,
    [ref]System.Management.Automation.Language.ParseError[] errors)

PSVersionTable:

Name                           Value
----                           -----
PSVersion                      4.0
WSManStackVersion              3.0
SerializationVersion           1.1.0.1
CLRVersion                     4.0.30319.34014
BuildVersion                   6.3.9600.17400
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion      2.2

Guessing the doc here just doesn't include the fact (I'm assuming this is true) that this was introduced in PowerShell 5.

For my use case, I can switch over to PowerShell 5, but just a heads up.

Side note: Have you considered splitting this up to include an independent Metadata module? It seems odd that there are no generic Cmdlets for writing/updating PowerShell data files...

Cheers!

Jaykul commented 7 years ago

Fixed for future release 1.0.3