I know there is a machlokes Rishonim (rambam / Rosh) if Kedushin is a Mitzva or Hecsher Mitzva for Pirya Verivya. Say one has children out of wedlock, is that Mitzva fulfilled or do we say its a Mitzva Haba Bavaira?
The Rema in Even Ha'Ezer 1:6 writes that one fulfills the mitzvah of p'ru u'revu with a child who is a mamzer, which by definition is out of wedlock:
היה הבן ממזר... קים המצוה
If the child is a mamzer, he fulfills the mitzvah.
Minchas Chinuch Mitzvah #1 explains that it is not a mitzvah haba b'aveira using the idea of the Shaar HaMelech Hilchos Lulav 8:5, that a mitzvah haba b'aveira only undermines the fulfillment of a mitzvah when the aveira is done at the time of the fulfillment of the mitzvah, which is not the case by p'ru u'revu which is only fulfilled when the child is born. Minchas Chinuch supports this assertion with the fact that one is not considered to have fulfilled his obligation if he has not borne children, or the children did not survive, no matter how many times he has cohabited with a woman.