PowerShell 5 class: Import module needed for type PowerShell 5 class: Import module needed for type powershell powershell

PowerShell 5 class: Import module needed for type


I think you can fix this problem by using a module manifest

There is a "Required Module" and a "required Assembly" section you could use. This should handle loading the requirements (as long as they are installed) when you load your custom module, which holds the class.


If you have declared a class in a module, you cannot use it if you Import-Module; that only brings in cmdlets, functions, and aliases. Instead, your script should Using module the module; that will bring in the class as well as the other exported items.

(I actually misread the problem; this does not work to solve the querent's specific problem - but for a class that does not use classes from other modules, this will allow importing of classes from modules. The querent has found a known issue in PowerShell; see the comments for further information.)