Cannot bind argument to parameter 'LiteralPath' because it is null.
sheldonhull opened this issue · 3 comments
Error Message
Cannot bind argument to parameter 'LiteralPath' because it is null.
At line:1 char:1
+ invoke-plaster -TemplatePath "C:\foobar...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Invoke-Plaster], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Invoke-Plaster
Versions
Plaster Version: 1.1.1, directly cloned from GIT. Also happened in VSCode packaged version 1.1.3
Environment
Powershell 5.1
Windows 10
Vscode x64 & Powershell ISE both give this error
Command example
invoke-plaster -TemplatePath "C:\foobar\PLASTER" -DestinationPath 'C:\temp\TESTPLASTER'
I ran a trace command on parameter binding like this:
Trace-Command -name ParameterBinding -expression {
invoke-plaster -TemplatePath "C:\foobar\PLASTER" -DestinationPath 'C:\temp\TESTPLASTER' -NoLogo -ErrorAction Continue
} -OutVariable Results -Verbose -PSHost
and this might help with answering what is happening. This is the section that shows some parameter binding failures
DEBUG: ParameterBinding Information: 0 : BIND PIPELINE object to parameters: [Trace-SteroidsOutput]
DEBUG: ParameterBinding Information: 0 : PIPELINE object TYPE = [System.Management.Automation.ErrorRecord]
DEBUG: ParameterBinding Information: 0 : RESTORING pipeline parameter's original values
DEBUG: ParameterBinding Information: 0 : Parameter [InputObject] PIPELINE INPUT ValueFromPipeline NO COERCION
DEBUG: ParameterBinding Information: 0 : BIND arg [Cannot bind argument to parameter 'LiteralPath' because it is null.] to parameter [InputObject]
DEBUG: ParameterBinding Information: 0 : BIND arg [Cannot bind argument to parameter 'LiteralPath' because it is null.] to param [InputObject] SUCCESSFUL
DEBUG: ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Trace-SteroidsOutput]
DEBUG: ParameterBinding Information: 0 : BIND PIPELINE object to parameters: [Out-Default]
DEBUG: ParameterBinding Information: 0 : PIPELINE object TYPE = [System.Management.Automation.ErrorRecord]
DEBUG: ParameterBinding Information: 0 : RESTORING pipeline parameter's original values
DEBUG: ParameterBinding Information: 0 : Parameter [InputObject] PIPELINE INPUT ValueFromPipeline NO COERCION
DEBUG: ParameterBinding Information: 0 : BIND arg [Cannot bind argument to parameter 'LiteralPath' because it is null.] to parameter [InputObject]
DEBUG: ParameterBinding Information: 0 : BIND arg [Cannot bind argument to parameter 'LiteralPath' because it is null.] to param [InputObject] SUCCESSFUL
DEBUG: ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Out-Default]
DEBUG: ParameterBinding Information: 0 : BIND NAMED cmd line args [Out-LineOutput]
DEBUG: ParameterBinding Information: 0 : BIND arg [Microsoft.PowerShell.Commands.Internal.Format.ConsoleLineOutput] to parameter [LineOutput]
DEBUG: ParameterBinding Information: 0 : COERCE arg to [System.Object]
DEBUG: ParameterBinding Information: 0 : Parameter and arg types the same, no coercion is needed.
DEBUG: ParameterBinding Information: 0 : BIND arg [Microsoft.PowerShell.Commands.Internal.Format.ConsoleLineOutput] to param [LineOutput] SUCCESSFUL
DEBUG: ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Out-LineOutput]
DEBUG: ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Out-LineOutput]
DEBUG: ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: ParameterBinding Information: 0 : BIND PIPELINE object to parameters: [Out-LineOutput]
DEBUG: ParameterBinding Information: 0 : PIPELINE object TYPE = [System.Management.Automation.ErrorRecord]
DEBUG: ParameterBinding Information: 0 : RESTORING pipeline parameter's original values
DEBUG: ParameterBinding Information: 0 : Parameter [InputObject] PIPELINE INPUT ValueFromPipeline NO COERCION
DEBUG: ParameterBinding Information: 0 : BIND arg [Cannot bind argument to parameter 'LiteralPath' because it is null.] to parameter [InputObject]
DEBUG: ParameterBinding Information: 0 : BIND arg [Cannot bind argument to parameter 'LiteralPath' because it is null.] to param [InputObject] SUCCESSFUL
DEBUG: ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [out-lineoutput]
DEBUG: ParameterBinding Information: 0 : BIND NAMED cmd line args [Format-Default]
DEBUG: ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Format-Default]
DEBUG: ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Format-Default]
DEBUG: ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: ParameterBinding Information: 0 : BIND PIPELINE object to parameters: [Format-Default]
DEBUG: ParameterBinding Information: 0 : PIPELINE object TYPE = [System.Management.Automation.ErrorRecord]
DEBUG: ParameterBinding Information: 0 : RESTORING pipeline parameter's original values
DEBUG: ParameterBinding Information: 0 : Parameter [InputObject] PIPELINE INPUT ValueFromPipeline NO COERCION
DEBUG: ParameterBinding Information: 0 : BIND arg [Cannot bind argument to parameter 'LiteralPath' because it is null.] to parameter [InputObject]
DEBUG: ParameterBinding Information: 0 : BIND arg [Cannot bind argument to parameter 'LiteralPath' because it is null.] to param [InputObject] SUCCESSFUL
DEBUG: ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [format-default]
DEBUG: ParameterBinding Information: 0 : BIND NAMED cmd line args [Set-StrictMode]
DEBUG: ParameterBinding Information: 0 : BIND arg [1] to parameter [Version]
DEBUG: ParameterBinding Information: 0 : Executing DATA GENERATION metadata: [Microsoft.PowerShell.Commands.SetStrictModeCommand+ArgumentToVersionTransformationAttribute]
DEBUG: ParameterBinding Information: 0 : result returned from DATA GENERATION: 1.0
DEBUG: ParameterBinding Information: 0 : COERCE arg to [System.Version]
DEBUG: ParameterBinding Information: 0 : Parameter and arg types the same, no coercion is needed.
DEBUG: ParameterBinding Information: 0 : Executing VALIDATION metadata: [Microsoft.PowerShell.Commands.SetStrictModeCommand+ValidateVersionAttribute]
DEBUG: ParameterBinding Information: 0 : BIND arg [1.0] to param [Version] SUCCESSFUL
DEBUG: ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Set-StrictMode]
DEBUG: ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Set-StrictMode]
DEBUG: ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: ParameterBinding Information: 0 : CALLING EndProcessing
DEBUG: ParameterBinding Information: 0 : BIND NAMED cmd line args [Set-StrictMode]
DEBUG: ParameterBinding Information: 0 : BIND arg [1] to parameter [Version]
DEBUG: ParameterBinding Information: 0 : Executing DATA GENERATION metadata: [Microsoft.PowerShell.Commands.SetStrictModeCommand+ArgumentToVersionTransformationAttribute]
DEBUG: ParameterBinding Information: 0 : result returned from DATA GENERATION: 1.0
DEBUG: ParameterBinding Information: 0 : COERCE arg to [System.Version]
DEBUG: ParameterBinding Information: 0 : Parameter and arg types the same, no coercion is needed.
DEBUG: ParameterBinding Information: 0 : Executing VALIDATION metadata: [Microsoft.PowerShell.Commands.SetStrictModeCommand+ValidateVersionAttribute]
DEBUG: ParameterBinding Information: 0 : BIND arg [1.0] to param [Version] SUCCESSFUL
DEBUG: ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Set-StrictMode]
DEBUG: ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Set-StrictMode]
DEBUG: ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: ParameterBinding Information: 0 : CALLING EndProcessing
DEBUG: ParameterBinding Information: 0 : BIND NAMED cmd line args [Set-StrictMode]
DEBUG: ParameterBinding Information: 0 : BIND arg [1] to parameter [Version]
DEBUG: ParameterBinding Information: 0 : Executing DATA GENERATION metadata: [Microsoft.PowerShell.Commands.SetStrictModeCommand+ArgumentToVersionTransformationAttribute]
DEBUG: ParameterBinding Information: 0 : result returned from DATA GENERATION: 1.0
DEBUG: ParameterBinding Information: 0 : COERCE arg to [System.Version]
DEBUG: ParameterBinding Information: 0 : Parameter and arg types the same, no coercion is needed.
DEBUG: ParameterBinding Information: 0 : Executing VALIDATION metadata: [Microsoft.PowerShell.Commands.SetStrictModeCommand+ValidateVersionAttribute]
DEBUG: ParameterBinding Information: 0 : BIND arg [1.0] to param [Version] SUCCESSFUL
DEBUG: ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Set-StrictMode]
DEBUG: ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Set-StrictMode]
DEBUG: ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: ParameterBinding Information: 0 : CALLING EndProcessing
DEBUG: ParameterBinding Information: 0 : BIND NAMED cmd line args [Set-StrictMode]
DEBUG: ParameterBinding Information: 0 : BIND arg [1] to parameter [Version]
DEBUG: ParameterBinding Information: 0 : Executing DATA GENERATION metadata: [Microsoft.PowerShell.Commands.SetStrictModeCommand+ArgumentToVersionTransformationAttribute]
DEBUG: ParameterBinding Information: 0 : result returned from DATA GENERATION: 1.0
DEBUG: ParameterBinding Information: 0 : COERCE arg to [System.Version]
DEBUG: ParameterBinding Information: 0 : Parameter and arg types the same, no coercion is needed.
DEBUG: ParameterBinding Information: 0 : Executing VALIDATION metadata: [Microsoft.PowerShell.Commands.SetStrictModeCommand+ValidateVersionAttribute]
DEBUG: ParameterBinding Information: 0 : BIND arg [1.0] to param [Version] SUCCESSFUL
DEBUG: ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Set-StrictMode]
DEBUG: ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Set-StrictMode]
DEBUG: ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: ParameterBinding Information: 0 : CALLING EndProcessing
Test-Path : Cannot bind argument to parameter 'LiteralPath' because it is null.
At C:\GIT\Plaster\src\InvokePlaster.ps1:181 char:40
+ if (Test-Path -LiteralPath $manifestPath -PathType Leaf) ...
+ ~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Test-Path], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.TestPathCommand
I can't seem to replicate the same issue against the templates. Are you running this against one of the in-box ones, or a custom template?
Plaster is looking for you to specify a template folder with a plasterManifest.xml file in it.
I was having the same issue. my Plaster Manifest had a type-o. plasterManifext.xml -ne plasterManifest.xml.
The error message could be a little better in this case.
Sorry, I just got this mixed up with another post I was responding to as this was an old post of mine. I'm using PSModuleDevelopment right now for templates, so this can still be closed if you want. Sorry!