The sequence of enzymatic reactions by which the 5' cap structure, an inverted 7-methylguanosine linked via a 5'-5' triphosphate bridge (m7G(5')ppp(5')X) to the first transcribed residue, is added to a nascent RNA polymerase II transcript.