A Solar PV system will last as long as it's component parts do. Solar PV Systems can broadly be broken down into 3 categories, each with varying warranty lengths.
Solar Panels Solar Panels have two types of warranty. Linear Output (a.k.a production warranty) and Product Warranty. Solar Panels degrade over time as they get damaged by the sun and as they degrade their output decreases. A typical degradation rate is 15% over 25 years. A linear output warranty allows for a replacement panel if the panel starts producing less than it's expected to - most linear output warranties are 25 years. Although rare, a panel ceasing to function entirely would be covered by product warranty, which are typically 10+ years. Although panels degrade over time, a system's performance should not noticably decrease over 25 years if the panels are a higher wattage than the inverter(s) which is a fairly standard practice.
Inverters Inverters take DC power produced by the solar panels and convert it to AC power to be used by your house and the grid. There are different types (string or central inverters and micro-inverters), each with their pros and cons, and varying costs and warranty lengths. Efficiency Nova Scotia recommends an inverter warranty of at least 10 years.
Racking
Roof Mounted racking is typically aluminium and most types carry at least a 20 year warranty. Ground mounted frames are typically galvanized steel or concrete ballast. Generally speaking, roof mounted racking is rated for higher wind loads than ground mounted frames because most roof mounted racking is not tilted up at an angle away from the roof.
In general, a solar PV system is expected to last 25 years, and potentially much longer.