I have recently updated to ArcGIS 10.4 and I have to update some code written for ArcGIS 10.2. The code must be run on a 10.2 machine so I thought if I make all the ESRI references 'Copy Local' it would run (with 10.4 compilation) on a 10.2 machine.
Can I use 10.4 code on a 10.2 machine with Copy Local set?
No you can't Unfortunately ArcObjects is only forward compatible (not backward).
You can find this in the Documentation under "compatibility across newer versions of ArcGIS".
Add-ins targeting previous versions of ArcGIS will automatically load in newer releases, there is no need to rebuild or reinstall them. For example, ArcGIS 10.4 will automatically discover and load add-ins from the 10.3 well-known folder location. Add-ins are not backward compatible; for example, and add-in targeting ArcGIS 10.4 will not load in 10.3.
It's possible to develop targeting 10.2 and use your code in 10.4. However subtle changes between ESRI SDK versions can cause hard to find issues. (for example field names on joined tables are different between some versions of the SDK)
When I need to support multiple versions, I compile against the lowest version, and test it on a virtual machine with the newer version (remote debugger).
This might not be the answer you're looking for, but I hope it helps to solve your problem.