In 1790, he earned a doctorate in theology and canon law at the University of Pavia.
In 1793, he was ordained as priest, and in 1799 became a leader of the Chapter of Canons of the Cathedral of Milan.
In 1804 Pope Pius VII raised him to the rank of cardinal.
Napoleon named him senator in his arranged Kingdom of Italy, and member of the Order of the Iron Crown.
He would fulfill a number of roles in the subsequent papal administrations, mostly while residing in Bologna, including as Archchancellor of the Pontifical University of Bologna.