-
I have a WPF library project that multi-targets: net48, net6-windows, and net7-windows. I noticed that APIs/types like HWND, WINDOW_STYLE, GetDeviceCaps, GetSystemMetrics, MonitorFromWindow, etc., show as not supported on net48. Is there a reason why? Should I switch back to the olden way of doing PInvoke? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
The error occured when I removed this line from the csproj file as per the readme.md:
When I added it back in the error went away. I'm not sure why. |
Beta Was this translation helpful? Give feedback.
-
These APIs are supported on net48. There must be something else going on in your project that is hiding HWND and the like. It compiles its code that includes and uses HWND for both TFMs just fine:
|
Beta Was this translation helpful? Give feedback.
These APIs are supported on net48. There must be something else going on in your project that is hiding HWND and the like.
Check out this trivial project:
CsWin32Sandbox.zip
It compiles its code that includes and uses HWND for both TFMs just fine: