FAKE构建任务无法生成Wix msi

时间:2015-10-27 22:28:08

标签: f# wix wix3 build-script f#-fake

试图理解为什么FAKE库中的WixHelper在我的构建脚本中不起作用。我一直收到以下错误。

  

错误:System.Exception:启动进程C:\ Program Files(x86)\ WiX Toolset v3.10 \ bin \ candle.exe失败。系统找不到该文件   指定于   Fake.ProcessHelper.ExecProcessWithLambdas@76-16.Invoke(String message)   在C:\ code \ fake \ src \ app \ FakeLib \ ProcessHelper.fs:第76行at   Fake.ProcessHelper.ExecProcessWithLambdas(FSharpFunc 2 configProcessStartI nfoF, TimeSpan timeOut, Boolean silent, FSharpFunc 2 errorF,FSharpFunc 2 messag eF) in C:\code\fake\src\app\FakeLib\ProcessHelper.fs:line 76 at Fake.WiXHelper.Candle(WiXParams parameters, String wixScript) in C:\code\f ake\src\app\FakeLib\WiXHelper.fs:line 791 at Fake.WiXHelper.WiX(FSharpFunc 2 setParams,String outputFile,String   wixSc ript)在C:\ code \ fake \ src \ app \ FakeLib \ WiXHelper.fs:第849行
  在FSI_0001.Deploy.clo@65-5.Invoke(字符串文件)中   C:\ projects \ main \ deplo y.fsx:第65行at   Microsoft.FSharp.Collections.SeqModule.Iterate [T](FSharpFunc 2 action, IEn umerable 1 source)at FSI_0001.Deploy.clo@59-4.Invoke(Unit   _arg3)在C:\ projects \ main \ deploy .fsx:第64行的Fake.TargetHelper.runSingleTarget(TargetTemplate`1 target)中   C:\ code \ fake \ src \ app \ FakeLib \ TargetHelper.fs:第483行

           

构建时间报告

     

目标持续时间   ------ --------
  清洁00:00:00.0200214
  BuildApp 00:00:01.1277956
  ProcessTemplates 00:00:00.0527962
  总计:00:00:01.2397715
  状态:失败   -------------------------------------------------- ------------------- 1)System.Exception:启动进程C:\ Program Files(x86)\ WiX   工具集v3.10 \ bin \ candle.exe失败。系统找不到该文件   指定于   Fake.ProcessHelper.ExecProcessWithLambdas@76-16.Invoke(String message)   在C:\ code \ fake \ src \ app \ FakeLib \ ProcessHelper.fs:第76行at   Fake.ProcessHelper.ExecProcessWithLambdas(FSharpFunc 2 configProcessStartI nfoF, TimeSpan timeOut, Boolean silent, FSharpFunc 2 errorF,FSharpFunc 2 messag eF) in C:\code\fake\src\app\FakeLib\ProcessHelper.fs:line 76 at Fake.WiXHelper.Candle(WiXParams parameters, String wixScript) in C:\code\f ake\src\app\FakeLib\WiXHelper.fs:line 791 at Fake.WiXHelper.WiX(FSharpFunc 2 setParams,String outputFile,String   wixSc ript)在C:\ code \ fake \ src \ app \ FakeLib \ WiXHelper.fs:第849行
  在FSI_0001.Deploy.clo@65-5.Invoke(字符串文件)中   C:\ projects \ main \ deplo y.fsx:第65行at   Microsoft.FSharp.Collections.SeqModule.Iterate [T](FSharpFunc 2 action, IEn umerable 1 source)at FSI_0001.Deploy.clo@59-4.Invoke(Unit   _arg3)在C:\ projects \ main \ deploy .fsx:第64行的Fake.TargetHelper.runSingleTarget(TargetTemplate`1 target)

     

C:\ code \ fake \ src \ app \ FakeLib \ TargetHelper.fs:第483行

构建脚本

除“Wix”目标外,所有目标似乎都在处理。

    Target "ProcessTemplates" (fun _ ->
  traceHeader "Process Wix Templates"

  let ALLFILES = fun _ -> true

  let dir_bin = directoryInfo (_dir_build_root @@ "bin")
  let dir_mobile = directoryInfo (_dir_files @@ "MobileInstall")

  let wix_directories =
    [dir_bin; dir_mobile]
    |> Seq.map (fun dir -> (wixDir ALLFILES true dir))
    |> Seq.reduce (+)

  trace <| sprintf ""

  let replacements = [
      "@product.name@", "Foobar App"
      "@product.company@", "Foobar Company"
      "@product.description@", "Foobar Description"
      "@product.version@",if not isLocalBuild then buildVersion else "0.1.0.0"
      "@product.content@", wix_directories
      "@product.application@",  wixComponentRefs dir_bin
      "@product.productcode@", "21654944-cf96-447f-890f-f7642e3128ec"]

  trace <| sprintf "%A" replacements

  !! ("./*.wxs")
    |> Copy _dir_temp

  !! (_dir_temp @@ "*.wxs")
    |> processTemplates replacements
)

Target "BuildApp" (fun () ->  
  traceHeader "BuildApp"

  ensureDirectory _dir_compile

  !! (_dir_source @@ "**/*.csproj")
    |> MSBuildRelease _dir_compile "Build"
    |> Log "Build-Output: "
)

Target "Wix" (fun _ ->
  traceHeader "Build"

  let wix_path = ProgramFilesX86  @@ "WiX Toolset v3.10" @@ "bin"

  !! (_dir_temp @@ "*.wxs")
    |> Seq.iter (fun file -> WiX (fun p -> { p with ToolDirectory = wix_path; AdditionalLightArgs = [" -ext WiXNetFxExtension";"-ext WixUIExtension.dll";"-ext WixUtilExtension.dll"; "-cultures:en-us"]}) (_dir_deploy @@ (changeExt "msi" (filename file))) file )
)

WiX模板

 <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="*" UpgradeCode="@product.productcode@" Name="@product.name@" Version="@product.version@" Manufacturer="@product.company@" Language="1033">
    <Package InstallerVersion="400" Compressed="yes" InstallScope='perMachine' Comments="@product.version@" Description="@product.description@"/>
    <Media Id="1" Cabinet="product.cab" EmbedCab="yes"/>

    <Property Id="WIXUI_INSTALLDIR" Value="APPLICATIONROOTDIRECTORY" />
    <PropertyRef Id="NETFRAMEWORK35"/>
    <PropertyRef Id="NETFRAMEWORK45"/>
    <!-- Remove repair -->
    <Property Id="ARPNOREPAIR" Value="yes" Secure="yes" />

    <Upgrade Id='@product.productcode@'>
      <UpgradeVersion Minimum='@product.version@'
                      IncludeMinimum='no'
                      OnlyDetect='yes'
                      Property='NEWPRODUCTFOUND' />
      <UpgradeVersion Minimum='@product.version@'
                      IncludeMinimum='yes'
                      Maximum='@product.version@'
                      IncludeMaximum='yes'
                      Property='UPGRADEFOUND' />
    </Upgrade>

    <InstallExecuteSequence>
      <Custom Action='PreventDowngrading' After='FindRelatedProducts'>NEWPRODUCTFOUND</Custom>
      <RemoveExistingProducts After='InstallValidate' />
    </InstallExecuteSequence>

    <InstallUISequence>
      <Custom Action='PreventDowngrading' After='FindRelatedProducts'>NEWPRODUCTFOUND</Custom>
    </InstallUISequence>

    <CustomAction Id='PreventDowngrading' Error='Newer version already installed' />


    <Condition Message="This application requires .NET Framework 3.5. Please install the .NET Framework then run this installer again.">
      <![CDATA[Installed OR NETFRAMEWORK35]]>
    </Condition>
    <Condition Message="This application requires .NET Framework 4.5.2. Please install the .NET Framework then run this installer again.">
      <![CDATA[Installed OR NETFRAMEWORK45]]>
    </Condition>
    <Condition Message="This application requires at least Windows 7 or Windows Server 2008 R2">
      <![CDATA[Installed OR (VersionNT >= 601)]]>
    </Condition>

    <!-- Step 1: Define the directory structure -->
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="APPLICATIONROOTDIRECTORY" Name="@product.name@">
          @product.content@
        </Directory>
      </Directory>
    </Directory>

     <!-- Step 3: Tell WiX to install the files -->
    <Feature Id="Application" Title="Application" Description="The Application." Level="1">
      @product.application@
    </Feature>

    <UI Id="WixUI_InstallDir">
        <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
        <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
        <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />

        <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
        <Property Id="WixUI_Mode" Value="InstallDir" />

        <DialogRef Id="BrowseDlg" />
        <DialogRef Id="DiskCostDlg" />
        <DialogRef Id="ErrorDlg" />
        <DialogRef Id="FatalError" />
        <DialogRef Id="FilesInUse" />
        <DialogRef Id="MsiRMFilesInUse" />
        <DialogRef Id="PrepareDlg" />
        <DialogRef Id="ProgressDlg" />
        <DialogRef Id="ResumeDlg" />
        <DialogRef Id="UserExit" />

        <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>

        <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg">1</Publish>

        <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
        <Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
        <Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="CustomizeDlg" Order="2">1</Publish>
        <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
        <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>

        <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="InstallDirDlg">NOT Installed</Publish>
        <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg">Installed</Publish>
        <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>

        <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="1">NOT Installed</Publish>
        <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed</Publish>

        <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>

        <Publish Dialog="MaintenanceTypeDlg" Control="ChangeButton" Event="NewDialog" Value="CustomizeDlg">1</Publish>
        <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
        <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>

    </UI>

    <UIRef Id="WixUI_Common" />
    <UIRef Id="WixUI_ErrorProgressText" />
  </Product>
</Wix>

这条线似乎失败了:

!! (_dir_temp @@ "*.wxs")
        |> Seq.iter (fun file -> WiX (fun p -> { p with ToolDirectory = wix_path; AdditionalLightArgs = [" -ext WiXNetFxExtension";"-ext WixUIExtension.dll";"-ext WixUtilExtension.dll"; "-cultures:en-us"]}) (_dir_deploy @@ (changeExt "msi" (filename file))) file )

我花了很多时间来处理这个错误,我不确定是什么导致它。

0 个答案:

没有答案