This just worked for me:
1) Go to the Terraria system folder.
2) Look for a folder named "_redist", and open it.
3) Look for a folder named "XNA_40", and open it.
4) Run the msi file inside the folder, and follow the instructions.
5) Assuming that the installation was successful, try running Terraria again.
It says that the folder is empty.