Infopath error: "The required version of the Microsoft .NET Framework is not installed on your computer or the InfoPath Primary Interop Assembly (PIA) is not registered"

Issue

User get’s a listed below error when opening a new or existing InfoPath form because of an error in the form's code

Error
“The required version of the Microsoft .NET Framework is not installed on your computer or the InfoPath Primary Interop Assembly (PIA) is not registered. Use Add or Remove Programs in Control Panel to make sure that the required version of the Microsoft .NET Framework is installed. Or install it using Windows Update and run the Setup program again to confirm that the corresponding version of the .NET Programmability Support is installed, or contact your system administrator.”

Cause\Resolution

As the error message suggests either the Microsoft .NET Framework or the InfoPath Primary Interop Assembly (PIA) is not installed. If Microsoft .NET framework is not present on the system then this will need to be installed. If the user does not have the .NET Framework already installed (when installing Office 2007) then PIAs will not be installed. Additionally, the option to install the PIAs doesn't show up in the Custom setup for Office. If the user does a complete install of Office 2007, then PIAs will get installed into the GAC automatically. It's strongly recommended that a complete install of Office 2007 be performed.

If .Net Framework is installed after installing Office 2007, then PIA does not get installed automatically and this can to be installed by following the steps listed below

1. Go to 'Add or Remove Programs...'
2. Select the Microsoft Office 2007 installation and click on change.
3. Select “Add or remove features” and click Continue.
4. Expand the “Microsoft Office InfoPath” and “.NET Programmability Support” node. Add the '.NET programmability support’. To add, right click on the node and select “Run from my computer”. Press continue and follow the on screen instructions to complete the setup.