Not sure how many people will see my small blog, but here I go, maybe it helps someone.
I recently had this WiX undefined preprocessor variable issue.
The actual variable was the same old $(var.MyProject.TargetDir)
After looking through the whole internet and not finding anything, the fix was a simple one.
The "MyProject" HAS TO BE EXACTLY THE SAME NAME as the web project that I added as a reference to the Wix project.
So if your project is called WhatewerWebAll, then you have to have something like:
You can say what you want, but the "undefined preprocessor variable $(var.MyProject.TargetDir)" message is actually not really describing the real issue, but maybe that's just me.