I am trying to call method Path.GetFileNameWithoutExtension ( ie - [Path]::GetFileNameWithoutExtension( ... ) ).
However, Powershell reports that the assembly containing the type is not loaded: 'Unable to find type [Path]: make sure that the assembly containing this type is loaded.'
So I try to load the assembly containing the Path class (according to msdn, the Path is in the System.IO namespace, but in the mscorlib.dll assembly). I attempt to load the assembly as follows:
add-type -AssemblyName "mscorlib"
Nothing is returned so I retry my method call again, but the same error is reported:
Unable to find type [Path]: make sure that the assembly containing this type is loaded.
So, what am I doing wrong? This is quite confusing because when you search for this error, the fix is to use add-type, but the examples quoted look like they've specified a namespace, not an assembly.
PS, I'm doing this all in a powershell console interactively.
Appreciate a fix to this silly problem, thanks.