Replace the pressure switch. They're $20-$30 from Subaru and super easy - but don't over tighten them or you'll crack the receiving end threads.
Yes the code references the solenoid, which is adjacent to the switch. Replace the switch first.
The switch is a just a one wire harness plug and it screws into the engine directly. that's the part you want to buy and replace.
The solenoids are held down by a 10mm bolt and are like $150-$250 from Subaru. These fail much less frequently than the switches, so it's not a good guess to blindly replace them.
The code is often remedied by the oil switch - additionally it's only $20 instead of $200, easy to replace, and they're prone to hemorrhage oil all over the engine bay so it's just smart to replace them first or even preventatively. So there's almost no reason to not replace it unless you're competing for the guiness book of world records for being frugal.
If that doesn't work - then test or replace the solenoid...after making sure you don't have rodent wiring damage, prior accident in that area damaging connectors or wiring, or it wasn't a shipped replacement engine (which are prone to having those solenoids and respective harnesses damaged during shipment due to location).
If you still have a question - reread this post.