Wednesday, May 30, 2012

Unable to find type [Parameter]: make sure that the assembly containing this type is loaded

Just learning about parameters in Powershell and came across this error:
Unable to find type [Parameter]: make sure that the assembly containing this type is loaded

Yes, I am running Powershell v2.0 and no I did not easily find any reference to this in my searches.

Through some trial and error, I figured out that in my Param() declaration, I had this:
Param(
...
,
[Parameter]
[String] $Description
,
...
)

The "[Parameter]" declaration was the culprit. My other ones had [Parameter(Mandatory=$true)]. So, I just removed the line and all works fine again.



No comments:

Post a Comment