Deductions & credits

I am installing a barn, with solar panels on it's roof, to provide electricity to our primary residence.  Does the cost to build the barn (it serves as supporting structure for the solar panels) count towards the 30% tax credit?