I made some code that uses the New-Object command from the command line Powershell, but this error popped up whenever I tried to load anything from System.Windows:
PS C:\Users\USER> New-Object System.Windows.FontWeight
New-Object : Cannot find type [System.Windows.FontWeight]: verify that the assembly containing this type is loaded.
At line:1 char:1
+ New-Object System.Windows.FontWeight
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand
This code works fine in Powershell ISE:
PS C:\Users\USER> New-Object System.Windows.FontWeight
Normal
If anyone can tell me what the problem is and how to fix it, that would be greatly appreciated!