Deductions & credits

This answer seems to conflict with the same question asked 6 months ago entitled "Could I claim the 30% federal solar tax credit for portion or all cost related to a re-roof if I get new solar panels?" which says the roof does not apply. Can you confirm which advice is correct? I'm planning to install solar panels in 2018 and require a new roof to support the new solar structure. I would like to know if the roof and its installation will qualify for the 30% Energy Credit (along with the solar panels).