In 1744 he distinguished himself at the head of a regiment during the Battle of Velletri, in the war between the Habsburgs and the Bourbons. While in command of the military he built a cannon out of lightweight materials which had a longer range than the standard ones of the time, and wrote a military treatise on the employment of infantry ("Manuale di esercizi militari per la fanteria") for which he was praised by Frederick II of Prussia.