if you want to visit the church it's free to enter with some little amount as fees. the Duomo in Milan only to pray or to attend a mass. For visiting the Cathedral, you need to buy an entrance ticket, and to visit both the Cathedral and the Terraces a combo ticket is required. You can also buy separate Duomo rooftop tickets which will not have an access to the Cathedral.