How to compile DLL project using library DLL from Unity 2020 or above

I have an old EDITOR tool project which build fine when using DLL files from Unity 2018, 2019.
However, after upgraded to use library from Unity 2020 or 2021, the build fails.

Source code is not changed. I only updated the reference path of the UnityEngine.dll and UnityEditor.dll from my VS project to point to Unity 2020 (or 2021) install folder.
Didn’t expect it to fail. If I point it back to 2019 (or 2018) install folder, it will compile again. Anyone know how to do it using 2020 or newer?

The errors shows that I failed to recognize editor stuff but I am sure its there inside the UnityEditor.dll I am referencing. I wonder if some setting is need to make the project to compile.

error CS0246: The type or namespace name 'EditorWindow' could not be found (are you missing a using directive or an assembly reference?)
error CS0246: The type or namespace name 'MenuItem' could not be found (are you missing a using directive or an assembly reference?)

Any help would be appreciated.

It is solved.
I got an answer from the Unity Forum. I switched to use the demodulized DLLs and it can compile now.