Born in Piacenza into a noble family, della Somaglia was sent to Rome at the young age of twelve and at the Collegio Nazzareno and La Sapienza University acquired degrees in both canon and civil law. In 1769 he became domestic prelate of Pope Clement XIV and under Pope Pius VI he was secretary to numerous curial congregations between 1773 and 1787. Although he was only ordained to the priesthood in 1787, he became titular patriarch of Antioch the following year and on June 1 1795 became a cardinal.
In his years as a cardinal della Somaglia played an important role as a negotiator with the revolutionary regime in France. Although he undoubtedly agreed with Pius VI's 1791 condemnation of the French Revolution and was expelled from Rome when Napoleon's army invaded in 1808, he was charged with the examination of the concordat with France several years later and this role actually served to taint della Somaglia's reputation in the eyes of fellow zelanti cardinals. From 1814 he was Secretary of the Inquisition and Dean of the College of Cardinals in 1820.
In the 1823 conclave, della Somaglia was considered papabile. In 1826 he resigned the post of Secretary of State but continued as Secretary of the Inquisition until his death in 1830. When he died, della Somaglia was the last cardinal still alive elevated by Pius VI.