簡體   English   中英

WIX在x86 / x64輸出目錄中找不到app.exe

[英]WIX cannot find app.exe in x86/x64 output directory

我有一個C#應用程序,其構建目標是x86或x64。 構建輸出為(例如) ProjectDir/bin/x86|x64/Debug|Release/*

在我的*.wxs文件中,我定義了以下變量

<?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 )上查找,則找不到其他變量。

也許試試這個:

  1. 注釋掉您現有的定義。
  2. 將構建EXE的項目和您的WiX項目添加到同一解決方案。
  3. 從WiX項目添加對EXE / Binary項目的引用。
  4. 嘗試以下標記(用您的標記替換項目名稱"TestConsoleApplication" ):

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

鏈接:

實際上,我通過將整個路徑放在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 ?>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM