2015-01-09 58 views
0

我有以下Wix文件,應該安裝C:\SampleProgram中的內容。生成的msi應該被安裝爲msiexec /i installer.msi IPADDRESS="1.1.1.1"。自定義操作獲取參數IPADDRESS,該操作將在程序自行安裝的文件夾中生成如下配置文件。Msi安裝程序運行自定義操作,但留下文件進行安裝

{ 
    "ip" : "1.1.1.1" 
} 

問題是生成的安裝文件在我的一臺機器上工作正常,但它只在其他機器上創建配置文件。 MSI安裝成功的文件夾將具有我的wix文件的ComponentGroup下定義的所有Component文件。如果安裝成功,安裝程序會將所有這些組件複製到已安裝的文件夾中。即使它沒有安裝文件,但它運行了自定義操作。

詳細日誌給出here

如果一個搜索組件:BoostThreadLibrary,我得到安裝:缺席,其給出here說,目前尚未安裝組件或功能。

是與我的機器或此代碼有關的錯誤。

下面我附上威克斯文件:

<?xml version="1.0" encoding="UTF-8"?> 
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> 
    <Product Id="*" Name="SampleProgram" Language="1033" Version="3.0.0" Manufacturer="Learning" UpgradeCode="a0265d05-8e65-4af2-98e1-a675b728dd2d"> 
     <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> 

     <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /> 
     <MediaTemplate EmbedCab="yes" /> 

     <Feature Id="ProductFeature" Title="SampleProgram" Level="1"> 
      <ComponentGroupRef Id="ProductComponents" /> 
     </Feature> 
    </Product> 

    <Fragment> 
    <Directory Id="TARGETDIR" Name="SourceDir"> 
     <Directory Id="WindowsVolume"> 
     <Directory Id="INSTALLFOLDER" Name="SampleProgram" /> 
     </Directory> 
    </Directory> 
    </Fragment> 

    <Fragment> 
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> 
     <Component Id="ProductComponent"> 
     <File 
      Id="LPAEXE" 
      Name="lpa.exe" 
      DiskId="1" 
      Source="$(var.lpa.TargetPath)" 
      Vital="yes" 
      KeyPath="yes" /> 

     <?if $(var.Configuration) = "Release"?> 
      <ServiceInstall Id="ServiceInstaller" Type="ownProcess" Vital="yes" 
          Name="LearningService" DisplayName="LearningService" 
          Description="How to make a Service" Start="auto" 
          Account="LocalSystem" ErrorControl="normal" Interactive="no" /> 

      <ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" 
          Name="LearningService" Wait="yes" /> 
     <?endif?> 
     </Component> 
     <Component Id="BoostThreadLibrary"> 
     <?if $(var.Configuration) = "Debug"?> 
     <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_thread-vc100-mt-gd-1_55.dll" /> 
     <?else?> 
     <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_thread-vc100-mt-1_55.dll" /> 
     <?endif?> 
     </Component> 
     <Component Id="BoostSystemLibrary"> 
     <?if $(var.Configuration) = "Debug"?> 
     <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_system-vc100-mt-gd-1_55.dll" /> 
     <?else?> 
     <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_system-vc100-mt-1_55.dll" /> 
     <?endif?> 
     </Component> 
     <Component Id="BoostChronoLibrary"> 
     <?if $(var.Configuration) = "Debug"?> 
     <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_chrono-vc100-mt-gd-1_55.dll" /> 
     <?else?> 
     <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_chrono-vc100-mt-1_55.dll" /> 
     <?endif?> 
     </Component> 
     <Component Id="BoostFileSystemLibrary"> 
     <?if $(var.Configuration) = "Debug"?> 
     <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_filesystem-vc100-mt-gd-1_55.dll" /> 
     <?else?> 
     <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_filesystem-vc100-mt-1_55.dll" /> 
     <?endif?> 
     </Component> 
     <Component Id="BoostDateTimeLibrary"> 
     <?if $(var.Configuration) = "Debug"?> 
     <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_date_time-vc100-mt-gd-1_55.dll" /> 
     <?else?> 
     <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_date_time-vc100-mt-1_55.dll" /> 
     <?endif?> 
     </Component> 

     <Component Id="BoostZlibLibrary"> 
     <?if $(var.Configuration) = "Debug"?> 
     <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_zlib-vc100-mt-gd-1_55.dll" /> 
     <?else?> 
     <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_zlib-vc100-mt-1_55.dll" /> 
     <?endif?> 
     </Component> 
     <Component Id="BoostIOStreamLibrary"> 
     <?if $(var.Configuration) = "Debug"?> 
     <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_iostreams-vc100-mt-gd-1_55.dll" /> 
     <?else?> 
     <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_iostreams-vc100-mt-1_55.dll" /> 
     <?endif?> 
     </Component> 
     <Component Id="BoostRegexLibrary"> 
     <?if $(var.Configuration) = "Debug"?> 
     <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_regex-vc100-mt-gd-1_55.dll" /> 
     <?else?> 
     <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_regex-vc100-mt-1_55.dll" /> 
     <?endif?> 
     </Component> 
     <Component Id="libeay32"> 
     <File Source ="C:\OpenSSL-Win32\libeay32.dll" /> 
     </Component> 
     <Component Id="ssleay32"> 
     <File Source ="C:\OpenSSL-Win32\ssleay32.dll" /> 
     </Component> 
     <Component Id="czmq"> 
     <?if $(var.Configuration) = "Debug"?> 
     <File Source ="..\..\ext_library\zmq\czmq\czmq-2.1.0\lib\Win32\DebugDLL\czmq.dll" /> 
     <?else?> 
     <File Source ="..\..\ext_library\zmq\czmq\czmq-2.1.0\lib\Win32\ReleaseDLL\czmq.dll" /> 
     <?endif?> 
     </Component> 

     <Component Id="log4cplus"> 
     <?if $(var.Configuration) = "Debug"?> 
     <File Source ="..\..\ext_library\log4cplus\bin\Debug\log4cplusD.dll" /> 
     <?else?> 
     <File Source ="..\..\ext_library\log4cplus\bin\Release\log4cplus.dll" /> 
     <?endif?> 
     </Component> 
     <Component Id="libzmq"> 
     <?if $(var.Configuration) = "Debug"?> 
     <File Source ="..\..\ext_library\zmq\zeromq-4.0.3\lib\Win32\Debug\libzmq.dll" /> 
     <?else?> 
     <File Source ="..\..\ext_library\zmq\zeromq-4.0.3\lib\Win32\Release\libzmq.dll" /> 
     <?endif?> 
     </Component> 
     <Component Id="SSL_Crt_File"> 
     <File Source ="..\..\src\keys\ca.crt" /> 
     </Component> 

    </ComponentGroup>  
    <Binary Id="SetupCA" SourceFile="..\..\ext_library\SetupCA\SetupCA\bin\Release\SetupCA.CA.dll"/> 
    <CustomAction Id="WRITEFILETODISK" Execute="immediate" BinaryKey="SetupCA" DllEntry="WriteFileToDisk" /> 
    <InstallExecuteSequence> 
     <Custom Action="WRITEFILETODISK" Sequence="2"></Custom> 
    </InstallExecuteSequence> 
    </Fragment> 
</Wix> 

回答

0

我不知道爲什麼,但將upgrade code更改爲其他GUID確實解決了這個問題。

0

你的問題的核心是你的自定義操作的日程安排:

<CustomAction Id="WRITEFILETODISK" Execute="immediate" BinaryKey="SetupCA" DllEntry="WriteFileToDisk" /> 
<InstallExecuteSequence> 
    <Custom Action="WRITEFILETODISK" Sequence="2"></Custom> 
</InstallExecuteSequence> 

按計劃InstallFinalize之前立即採取行動,對文件進行任何更改在此自定義操作運行時不會發生。雖然這對於卸載而言可能很重要,但這可能與您想要安裝的內容相反。

要讀取安裝安裝的文件,您應該安排您的操作Execute="deferred",以及InstallFiles之後的某個時間。如果您正在修改系統位置中的項目,它也應該是Impersonate="No",它只適用於延遲執行上下文。

請注意,一旦您的操作被推遲,您將不得不通過CustomActionData訪問屬性。

+0

事情是,相同的代碼適用於其他機器。一切設置完全和配置創建,但在我的機器我沒有得到任何安裝的文件。相反,在日誌中,我得到了'Installed:Absent' for components – Pant

+0

感謝您將自定義操作問題指向我。我也會修改它。 – Pant

+0

我可能誤讀了你的意思,「問題是我無法獲得Wix應該在安裝文件夾中複製的文件,但安裝程序運行自定義操作」,因爲很多人遇到我描述的問題。你能不能澄清你的期望,以及你遇到的情況,以及這些情況究竟發生在什麼時候 - 即如果總體失敗是最終沒有安裝文件,我的回答最好是切線。 –

相關問題