The M42 was a 1.8 16v only fitted to E30's in the 318iS model between 1989 and 1991 and will either G or H registration in the UK.
The E36 318iS engines up to 1995 are the M42 (which are 1.8 ), post 1995 E36 engines are M44 (which are 1.9) which are not as straight forward to fit as the M42. The most obvious way to identify an M44 engine is by the crank sensor being at the rear of the block, not the front timing case.
M44 crank sensor location:

M42 crank sensor location:

You need:
1. M42 engine
2. E30 M42/M40 upper and lower sump pan (only required if fitting E36 engine)
3. E30 M42 engine loom and ECU (will work with E36 engines also, saves having to adapt E36 looms)
4. Coil packs and HT leads or COP conversion
5. E30 M42 exhaust manifold
6. E30 318iS exhaust system
7. E30 M42 coolant hoses (3x radiator, 2x heater)
8. M42 radiator (larger than the M40 one although similar in appearance)
9. E30 M42 AFM to TB boot
10. Getrag 240 gearbox (from M42 or M40)
11. Prop shaft to correspond with whether you have M42 or M40 gearbox (explained below)
12. E30 M42 engine mounting arms and 'rubber hydraulic' mounts
13. E30 M42 or M40b18 AFM (M40b16 AFM will not be correct!)
Cam covers:It is worth noting that later E36 M42 engines have the breather spout on the cam cover in a different place to the E30 M42. To use the E30 inlet manifold you will need an E30 cam cover.
Later E36 cover (note the breather is to the rear of the cover):

E30 cover (breather spout at the front of the cover):

Inlet manifolds: You will need the E30 upper and lower manifolds with injector rail if carrying the engine over from an E36. It is worth using the E30 inlet manifold any way as it is better for 'performance' due to the equal lengths of the 'runner's which helps with torque. The upper and lower halves are different so you need both. For the avoidance of doubt here is the difference:
E36 inlets:

E30 inlets:

Exhaust manifolds and systems: The exhaust systems are not compatable between the M40 and M42. The M40 comes with a cast manifold and the M42 comes with a rather nice fabricated manifold. You will need an M42 exhaust system and exhaust manifold. Also note the E36 manifold cannot be used as it will clash with the steering column so an E30 item will be required.
Radiators: just a quick note on radiators. If upgrading from an M40 engine, the M40 radiators are slightly smaller (narrower) than the M42 radiators. You can use the M40 radiator but you will need to shorten the top M42 rad hose to compensate for the narrower radiator. If however you use an M42 radiator (recommended as it will be the correct size and no modification would be required to the hoses) you will need plastic mounting bracket 17 11 1 712 347 which will allow fitment of the wider M42 radiator. The bracket clips to the shell on the expansion tank side of the radiator.
Sump: The E36 M42 sump and E30 M42 sumps are different. On the E36 the sump sits behind the subframe, and on the E30 it sits in front. If you are fitting an E35 M42 you will need the upper and lower sump pan from an E30 M40 or M42 engine.
This is an E36 sump which you cannot use:

This is the E30 M40/M42 upper and lower sump:

Gearbox: A note on the getrag 240 gear box. There are two types, one was fitted to the M40 and the other to the M42. Note that the M42 ones have a different output flange. You need the one with the flange further away in order to use all standard 318iS parts. Be extra careful with the mounting 'prongs' on the rear of the box (where the rubber mountings fix to), they can be weak and break off easily.
Here is the back of the 'M42' box:

Here is the back of the 'M40' box:

Which ever you choose you will need the corresponding prop shaft (M40 box -> M40 prop or M42 box -> M42 prop)
Final drive (diff) ratios: 318iS has a 4.1 ratio diff. Smaller engined cars often came with 4.27 or 4.45. Using either of these ratios will help with acceleration but will make the car rev very high when cruising on the motor way etc. This will then have further effect on fuel economy. It is best to use the 4.1 ratio and there are plenty of small case open 4.1 diffs available. Fitting a 3.91 will have the opposite effect and sacrifice acceleration for lower cruising revs.
Coil packs or COP: If you opt for standard coil packs, you will need the coil packs, HT leads and also the brackets to mount them to the wing which you can get from BMW and the part numbers are: 41 14 8 106 938 and 41 14 8 106 938. They mount on the drivers side of the engine bay:

Another option that costs about the same is COP (Coil On Plug). This works by fitting a set of M52 (P/N: 17 480 17) coil packs directly over the spark plugs mounted on a special plate (conviently I sell kits for this if interested).
Here is how it looks:

Flywheel: 'Word on the street' is that M42's came with dual mass (DM) fly wheels. This is a big part that people stumble on. I have yet to see an M42 in the UK that has been fitted with a DM flywheel they nearly all came with single mass units (unless the car had zircon from the factory). The single mass are exactly that and are one lump of steel. These are still heavy but these can be lightened unlike the DM ones. The same goes for M40 engines.
Single mass:

Dual mass:

Clutches: M40 and M42 use the same clutch so if removing an M40 engine the clutch can be carried over to the M42 (as long as both are running the same single or dual mass flywheels). It is worth checking the clutch condition and thickness against the manufacturers specifications. If the clutch is looking badly worn it is not worth carrying over and it's best to changing it
Fitting M20 flywheel assembly: some people choose to fit an M20 flywheel assembly because it is slightly lighter than the M40/M42 flywheel. The advantage of this is it allows the engine to rev up easier. The gains from this are marginal for the extra work but here is whats required:
M20 flywheel
M40/42 starter with a M20 spur gear.
323i release bearing if you wish but seems to work fine with just an M20 bearing too.
------
If you pull all ancilleries from your M40 out of the engine bay prior to lift it will make it all easier.
Food for thought: Bare in mind the 318iS which came with the M42 came with rear disc brakes, 51mm front struts and larger roll bars which aren't on the smaller engined cars. You might want to upgrade the suspension.
If I've missed anything or any one has any issues with what I've put then please do say
*some of the photo's I have used are my own, or ones sourced from google*







