If your using InfoPath 2013 and come across this error when trying to access developer tools, its because this version of VSTA copies the code to a temp folder then then works on it there.
Problem is that temp folder are exactly that… “temp” so if the folder is lost then InfoPath will complain it cant find it.
The way around this is on the developer tab on the ribbon, click ‘Language’, click remove code (dont worry it wont delete your code).
Then click on ‘Code Editor’ again and it will make a new folder for your code in Documents > InfoPath Projects. Overwrite the contents of this new folder with the contents from the original project.
Then in VSTA look at the project properties and you will see the link to the temp folder. Open that folder, overwrite the contents of that also as before.