I'm looking for the equivalent of an
#if DEBUG
//view elements to show just for debug builds
#if
for views in MVC3/Razor. What's the idiomatic method for implementing this type of a setup?
That's too messy IMO. Views should be dumb, and focused on rendering HTML, not making build-based decisions.
Set properties in your view model if debug is configured, and render them out in the View.
If the properties are null (e.g non-debug), nothing will get rendered.