[英]Msi Installer Runs custom Action but leaves File for Installation
我有以下應該將內容安裝在C:\\SampleProgram
Wix文件。 生成的msi應該安裝為msiexec /i installer.msi IPADDRESS="1.1.1.1"
。 參數IPADDRESS
由“自定義操作”獲取,該文件將在程序自身安裝的文件夾中創建以下配置文件。
{
"ip" : "1.1.1.1"
}
問題是,生成的安裝文件可以在我的一台計算機上正常運行,但只能在另一台計算機上創建配置文件。 在MSI安裝成功文件夾將所有的Component
下定義的文件ComponentGroup
我威克斯文件。 如果安裝成功,則安裝程序將復制“已安裝文件夾”中的所有那些組件。 即使它沒有安裝文件,但它運行了自定義操作。
詳細日志在此處給出。
如果一個搜索組件:BoostThreadLibrary,我得到安裝:缺席 ,這給出這里說, 當前未安裝組件或功能。 。
錯誤與我的機器或此代碼有關。
我在下面附加了wix文件:
<?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>
問題的核心是安排自定義操作:
<CustomAction Id="WRITEFILETODISK" Execute="immediate" BinaryKey="SetupCA" DllEntry="WriteFileToDisk" />
<InstallExecuteSequence>
<Custom Action="WRITEFILETODISK" Sequence="2"></Custom>
</InstallExecuteSequence>
作為在InstallFinalize
之前安排的即時操作,在運行此自定義操作時將不會對文件進行任何更改。 例如,這對於卸載很重要,但這可能與您想要的安裝相反。
要讀取安裝過程中安裝的文件,應該安排Execute="deferred"
,並在InstallFiles
之后的某個時間進行。 如果要在系統位置修改項目,則還應該為Impersonate="No"
,它僅在延遲執行上下文中有效。
請注意,一旦推遲操作,您將必須通過CustomActionData
訪問屬性。
我不知道為什么,但是將upgrade code
更改為其他GUID
確實解決了該問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.