WIX在x86 / x64输出目录中找不到app.exe

时间:2019-01-21 13:12:14

标签: wix wix3.11

我有一个C#应用程序,其构建目标是x86或x64。构建输出为(例如)ProjectDir/bin/x86|x64/Debug|Release/*

在我的*.wxs文件中,我定义了thr后变量

<?define AppTargetPath = "$(var.MyApp.TargetPath)" ?>

哪个指向ProjectDir/bin/Debug|Release/app.exe

如果我生成安装程序,则安装失败,因为它找不到我的应用exe

<File Id="AppExe" Source="$(var.AppTargetPath)" KeyPath="yes"/>

如果我在使用项目引用和变量网站(http://wixtoolset.org/documentation/manual/v3/votive/votive_project_references.html)上查找,则找不到其他变量。

2 个答案:

答案 0 :(得分:0)

也许尝试一下:

  1. 注释掉您现有的定义。
  2. 将构建EXE的项目和您的WiX项目添加到同一解决方案中。
  3. 将WiX项目中的引用添加到EXE /二进制项目中。
  4. 尝试使用此标记(将项目名称 "TestConsoleApplication" 替换为您的):

    <Fragment>
      <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
       <Component>
        <File Source="$(var.TestConsoleApplication.TargetPath)" />
       </Component>
      </ComponentGroup>
    </Fragment>
    
  5. 全部重建。
  6. 切换版本和调试版本,然后再次全部重建。

链接:

答案 1 :(得分:0)

实际上,我通过将整个路径放到wxs文件顶部来解决了这个问题:

<?define AppTargetFileName = "$(var.myApp.TargetFileName)" ?>

<?if $(var.Platform) = x64 ?>
  <?define AppTargetPath = "$(var.myApp.ProjectDir)\bin\x64\$(var.myApp.Configuration)\$(var.AppTargetFileName)" ?>
<?elseif  $(var.Platform) = x86 ?>
  <?define AppTargetPath = "$(var.myApp.ProjectDir)\bin\x86\$(var.myApp.Configuration)\$(var.AppTargetFileName)" ?>
<?else ?>
  <?define AppTargetPath = "$(var.myApp.TargetPath)" ?>
<?endif ?>