Can anyone please explain how to pass the installation location to the installer by code?
Use customactiondata property in your installer project as output to your msi, for example:
InstallLoc = "[TARGETDIR] \"
and in the project installer project like:
installDir = this.Context.Parameters["InstallLoc"];