The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine. - On 64-bit Windows 7

I’ve got a console application that reads plain old txt files into datasets. My new machine (Dell Studio XPS 16) has got Windows 7 64-bit on it. Running the app I got this error:

System.InvalidOperationException: The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.

The reason for this is that the provider does not have a 64-bit version and the application wasn’t compiled for a specified version. So you just need to build it for x86 specifically.

Selecting target CPU

Advanced Compiler Settings – Selecting target CPU