Check the planning ordinance, there usually is a maximum square footage gross for accessory buildings and limits on the infrastructure development such as electricity. Separations are usually specified in the ordinance for all setback conditions such as yards and between buildings. If the ordinance is not specific for existing buildings, then "existing non-conforming" could be justified for separation that is less than current ordinance standards. Use for solar panels may be restricted as well, again verify with the ordinance.
If solar panels are allowed then the structure must be demonstrated as sufficient to carry the loads proposed. It is common for solar panels to be supported at 4 distinct "points" so the loading is concentrated, this can be a problem for older structures that have unconventional rafters/spacing and unknown wood grades including usually less than adequate lateral bracing to resist lateral from wind or seismic, most likely wind will be the controlling load.
A lot of this info is available online from the jurisdiction.
Hope this helps.