We are now on Photoshop 2024, and I'm curious if we can add a Stroke (layer style), with sharp corners (not rounded) and adjust the stroke opacity. My answer will be NO, but I wanted to reach out to the community to confirm if this is still the case. I hope I'm wrong. ;) Thanks.
I realize this doesn't technically answer the question, but....
Move the layer style stroke to the inside and increase the size of the rectangle to compensate. The result will have sharp corners.
The opacity of the (inside) stroke will override the opacity of any fill.
This has really always worked to get around the rounded layer style stroke. It's only the "outer" or "centered" layer style strokes which have rounded corners. "Inside" strokes will be restricted to the underlying shape.
There are, of course, other methods as well.