I have done this. The best way, is to use the gearbox from an e36. These box's had a 1:1 fifth, therefore you won't need to mess with the diff, as most m20 cars had quite high diffs. The m42 bolts straight up to it and sits on all the original mounts. Theres also no problem with the prop, although you need the front half from an e30 318is.
I had a load of myther with the 20pin plug when I fitted mine. For some reason the ABS pin, no 20 IIRC was neg on the m20 and live on the m42. I melted two looms before I worked out what was going on!!