Calcium-aluminum-rich inclusions (CAIs) are millimeter-sized refractory objects commonly found in chondritic meteorites and are the oldest solids formed in our solar system. Primary CAI formation may have occurred through condensation and/or evaporation processes near the proto-Sun or, alternatively, during localized events in the asteroid belt. As such, these objects provide us with a unique window into the earliest development of the Sun and into the evolution of the protoplanetary disk. Here we report a Al-26-Mg-26 isochron for bulk CAIs from four CV carbonaceous chondrites, which yields an initial Al-26/Al-27 of (5.85 +/- 0.05) x 10(-5), suggesting that primary formation of the CV CAIs may have occurred within an interval as brief as 20,000 years. This timescale is inconsistent with the secular evolution of T Tauri stars but may be consistent with CAI formation during the infall stage of the protostellar evolution of the Sun. High-precision Mg isotope measurements of samples from the Earth, Moon, Mars, and bulk chondrite meteorites show that these have identically elevated Mg-26 abundances compared to the initial Mg-26 abundance (delta Mg-26* = -0.0317% +/- 0.0038%) defined by the CAI isochron. This observation unequivocally demonstrates the homogeneous distribution of Al-26 within the accretion region of the terrestrial planets. However, the initial Mg-26 abundance of CAIs implies a brief history of elevated Al/Mg in CAI precursor material, which may represent primary condensation of refractory silicates and oxides from the solar nebula.