Any idea how to do with PowerShell 7 (.NET core 3)?. This code works with Windows PowerShell 5.1 but when I try to port this to PowerShell 7 (Preview 6) I get this error:
Add-Type: (9,23): error CS1069: The type name 'Icon' could not be found in the namespace 'System.Drawing'. This type has been forwarded to assembly 'System.Drawing.Common, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
Consider adding a reference to that assembly.
public static Icon Extract(string file, int number, bool largeIcon)
^
public static Icon Extract(string file, int number, bool largeIcon)
^
Add-Type: (16,24): error CS0103: The name 'Icon' does not exist in the current context
return Icon.FromHandle(largeIcon ? large : small);
^
return Icon.FromHandle(largeIcon ? large : small);
^
Add-Type: Cannot add type. Compilation errors occurred.
Thanks
NK