diff --git a/Tools/msi/common.wxs b/Tools/msi/common.wxs
index d8f3cde99ab52a4263beeeddf11ee0b609c09734..4554e80014a2900f0f229ef8d0062833c330cd74 100644
--- a/Tools/msi/common.wxs
+++ b/Tools/msi/common.wxs
@@ -61,6 +61,7 @@
     </Fragment>
 
     <Fragment>
+        <?ifdef PythonExeComponentGuid ?>
         <!-- Locate TARGETDIR automatically assuming we have executables installed -->
         <Property Id="TARGETDIR">
             <ComponentSearch Id="PythonExe_Directory" Guid="$(var.PythonExeComponentGuid)">
@@ -69,6 +70,7 @@
                 </DirectorySearch>
             </ComponentSearch>
         </Property>
+        <?endif ?>
         <Property Id="DetectTargetDir" Value="1" />
     </Fragment>