A son of the cotton merchant Giovanni Battista Bonsignori and his wife Giovanna Galeazzi, he began his education under an uncle who was a priest, before moving to the Archepiscopal Seminary of Milan.
During this time he became part of the circle of scholars gathered by cardinal Angelo Maria Durini - others included count Karl Joseph von Firmian, archbishop Giuseppe Pozzobonelli and Carlo Trivulzio.
Probably thanks to contacts with politicians, Bonsignori gained a 1,200 lire pension and met Napoleon after he came to Milan following his victory at the battle of Marengo.
Whilst he waited for the 1801 Concordat to come into force, Bonsignori became a member of the Istituto Nazionale and vice-director of the Biblioteca di Brera.
He was one of the most pro-French bishops, albeit in a passive form, even when the First French Empire annexed the Papal States and when Pius was put under house arrest after excommunicating Napoleon.
He was suitably rewarded with the titles of count, baron, commander of the Order of the Iron Crown and Grand Official of the Kingdom of Italy.