This is straightforward with Powertoys (official config utility from Microsoft) on Windows.
Why do you think that? Have you ever done it?
Not OP, but yes it works. I've used the 'Keyboard manager' tool from Powertoys to remap CapsLock to Esc. Never had a problem with it.