I have the same problem with a completely fresh install of NC4.2. I tried the solution (creating the json file), with no luck. The error (now) is
Exception: A plugin with 'Payments.CashOnDelivery' system name is already defined
What version of VS2019 are you using?
This is a friggin' nightmare! Is there a newer build of NC4.2 out that is compatible w/the latest VS2019?
I just don't get why, now, the build works, I run it, then get errors again - makes zero sense.
UPDATE: Added the settings to the csproj file (with NO LUCK)
Any other tricks?
UPDATE2: Rebooting the computer. Re-cleaning (for the 25th time) and rebuilding (for the 25th time), and now it, magically, works. Go figure! (2 solid days of hair pulling over other people's bugs)