> 25 years at a minimum
So long as the roof itself lasts that long. People who are mid-cycle on their existing roof should not install solar until they get to the next replacement. This is where I am, and why I do not have rooftop solar. I expect to get 15 additional years from my roof, and there's no guarantee I will have hit the break even point by then. Plus, solar installers will not warranty a mid-cycle roof against leaks, so if something goes wrong that quickly eats into your cost savings.
It is also cheaper to get it installed if you're already doing a roof replacement. Especially if you're getting built-in modules instead of retrofit, since they replace some of the roof surface instead of going over it.
Indeed, the best time to install is during a roof replacement. If one can afford it, standing seam metal roof, racking mounted with friction mounts (deck penetrations are the enemy and to be avoided whenever possible, to prevent future water intrusion), and the entire system (roof deck and panels) should last 40+ years. Last roof and solar you put on for your life for many of us.