 He was the chief engineer on the five-mile (8 km) Hoosac Tunnel project through the Berkshires in Western Massachusetts from 1856 to 1861.In the spring of 1862, a year after the start of the Civil War, the U.S. War Department organized a new bureau responsible for constructing and operating military railroads in the United States.On April 27, Haupt was appointed chief of the bureau by Secretary of War Edwin M. Stanton, as a colonel and aide-de-camp to major general Irvin McDowell, then in command of the defenses of Washington, D.C. Haupt repaired and fortified war-damaged railroad lines in the vicinity of Washington, armed and trained railroad staff, and improved telegraph communications along the railroad lines.