These methods in this gist worked for me on my U.S.-based keyboard layouts. I am unsure about other layouts. If you have problems, revert your changes; delete the registry key you created (and reboot).
Update: you should probably scroll down to approach 4 where I suggest using Microsoft PowerToys Keyboard Manager.
Navigate to and create a new binary value in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout named Scancode Map.
You will enter the raw bytes like this (thanks @quapka):
00 00 00 00 00 00 00 00 02 00 00 00 1d 00 3a 00 00 00 00 00
Save. Reboot. Done.
Thanks @datsuka-qwerty
Create a new .reg file and name it something meaningful like capstoctrl.reg. Edit the file and paste in the following:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00
Save. Run the file. Reboot. Done.
Open PowerShell as an administrator (Win + X)
$hexified = "00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00".Split(',') | % { "0x$_"};
$kbLayout = 'HKLM:\System\CurrentControlSet\Control\Keyboard Layout';
New-ItemProperty -Path $kbLayout -Name "Scancode Map" -PropertyType Binary -Value ([byte[]]$hexified);
Save. Reboot. Done.
Give PowerToys a try for remapping not only capslock, but other keys as well. Microsoft PowerToys: Utilities to customize Windows 10.
Microsoft PowerToys: Keyboard Manager enables you to redefine keys on your keyboard.

PowerToys relies on intercepting key strokes and passing on a different key to the application for each configured mapping. This is why it can do the mapping conditionally on which app is open. And it's also why it sometimes doesn't work... when an app reads keyboard input more directly from the keyboard driver before it gets intercept.
The other methods all use the same underlying mechanism (directly mapping in the keyboard driver) and therefore should work in all apps.