我有以下Wix文件,它应该在C:\SampleProgram
中安装内容。生成的msi应该安装为msiexec /i installer.msi IPADDRESS="1.1.1.1"
。参数IPADDRESS
由Custom Action提取,它将在程序自行安装的文件夹中生成如下配置文件。
{
"ip" : "1.1.1.1"
}
问题是生成的安装文件在我的一台机器上工作正常,但它只在其他机器上创建一个配置文件。成功安装MSI的文件夹将在我的wix文件的Component
下定义所有ComponentGroup
个文件。如果安装成功,安装程序将复制已安装文件夹中的所有组件。即使它没有安装文件,但它运行了自定义操作。
详细日志为here。
如果有人搜索组件:BoostThreadLibrary ,我会已安装:缺席,其中here表示当前未安装组件或功能即可。
错误是否与我的机器或此代码有关。
我在下面附上了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>
答案 0 :(得分: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
访问属性。
答案 1 :(得分:0)
我不知道为什么,但将upgrade code
更改为其他GUID
确实解决了问题。