Paint then install hands down! If you do a lot, spraying saves tons of time but not worthwhile because of cleanup for small jobs. I prefer stained/varnished vs. painted...but despise masking no matter what! Try using an old sheet (or think about the touch up an carry with care ) if you bang it up dragging it around.
I always put at least one coat of paint on my molding before installing. I never spray because of the nusance and not to mention if you ding it at some point and need to touch it up and use a brush it will flash because brushes leave brush marks and sraying is quite smooth.