I have written this code after reading the link: http://blogs.technet.com/b/alexshev/archive/2008/03/25/property-does-not-exist-or-empty-when-accessed-from-deferred-custom-action.aspx
我在阅读完链接后编写了这段代码:http://blogs.technet.com/b/alexshev/archive/2008/03/25/property-does-not-exist-or-empty-when-accessed-from-延期定制action.aspx
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Module Id="MergeModule1" Language="1033" Version="1.0.0.0">
<Package Id="cffa568e-1bf0-4eb3-bee3-eb5801a0bbd0" Manufacturer="Microsoft" InstallerVersion="200" />
<Binary Id="myCustomActionsDLL" SourceFile="CustomAction1.CA.dll" />
<CustomAction Id="SetProperty" Execute="immediate"
Property="CA_myCustomAction"
Value="InstallDir=[PRIMARYFOLDER];SourceDir=[SourceDir]" />
<CustomAction
Id="CA_myCustomAction"
BinaryKey="myCustomActionsDLL"
DllEntry="CustomAction1"
Execute="deferred" Impersonate="no"
Return="check" />
<InstallExecuteSequence>
<Custom Action="SetProperty" Before="InstallInitialize">Not Installed</Custom>
<Custom Action="CA_myCustomAction" Before="InstallFinalize">Not Installed</Custom>
</InstallExecuteSequence>
<!--<InstallUISequence>
<Custom Action="CA_myCustomAction" After="CostFinalize"></Custom>
</InstallUISequence>-->
</Module>
</Wix>
In place of InstallDir - PRIMARYFOLDER
, I have tried - INSTALLLOCATION, InstallDir, TargetDir but I am unable to get the installation folder specified for the application which is under ProgramFiles(x86).
代替InstallDir - PRIMARYFOLDER,我试过--INSTALLLOCATION,InstallDir,TargetDir但是我无法获得为ProgramFiles(x86)下的应用程序指定的安装文件夹。
The value of the SourceDir
is coming out as proper value where the MSI file is located while it is running.
SourceDir的值将在MSI文件运行时找到正确的值。
1 个解决方案
#1
4
Your troubleshooting should always start with generating and reading a verbose log. There are probably several problems all at once and all need to be fixed at the same time.
您的故障排除应始终从生成和读取详细日志开始。可能同时存在几个问题,所有问题都需要同时修复。
First is that your Type 51 set property custom action is scheduled before InstallInitialize. The property is not a secure custom property so it doesn't get passed into the transaction. Try scheduling it after InstallInitialize instead.
首先,您的Type 51设置属性自定义操作是在InstallInitialize之前安排的。该属性不是安全的自定义属性,因此不会传递到事务中。请尝试在InstallInitialize之后安排它。
Second is you are in a merge module and merge modules modularize (append GUID) pretty much all identifiers. If you look at the build merge module in ORCA you'll see it's not looking for INSTALLDIR it's looking for INSTALLDIR.GUID.
其次是你在合并模块和合并模块模块化(附加GUID)几乎所有标识符。如果你看看ORCA中的构建合并模块,你会发现它不是在寻找INSTALLDIR,它正在寻找INSTALLDIR.GUID。
If you really must use INSTALLDIR you want to define a property called INSTALLDIR with no value and use the SuppressModularization attribute to prevent the GUID. The approach I usually take though is to define a MergeRedirectFolder directory and use that instead. Then when I add the merge module to InstallShield I associate the module to INSTALLDIR and the transitive nature then takes over.
如果你真的必须使用INSTALLDIR,你想要定义一个没有值的名为INSTALLDIR的属性,并使用SuppressModularization属性来阻止GUID。我通常采用的方法是定义一个MergeRedirectFolder目录并使用它。然后,当我将合并模块添加到InstallShield时,我将模块关联到INSTALLDIR,然后传递性质接管。
There may be other problems but it's hard to see without looking at the final MSI and reading through the logs.
可能还有其他问题,但如果不查看最终的MSI并阅读日志,很难看到。
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Module Id="MergeModule2" Language="1033" Version="1.0.0.0">
<Package Id="c4acbfbc-a0e8-4d52-b516-bee471a76e8a" Manufacturer="" InstallerVersion="200" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="MergeRedirectFolder"/>
</Directory>
<Binary Id="myCustomActionsDLL" SourceFile="CustomAction1.CA.dll" />
<CustomAction Id="SetProperty" Execute="immediate"
Property="CA_myCustomAction"
Value="InstallDir=[MergeRedirectFolder];SourceDir=[SourceDir]" />
<CustomAction Id="CA_myCustomAction"
BinaryKey="myCustomActionsDLL"
DllEntry="CustomAction1"
Execute="deferred" Impersonate="no"
Return="check" />
<InstallExecuteSequence>
<Custom Action="SetProperty" After="InstallInitialize">Not Installed</Custom>
<Custom Action="CA_myCustomAction" Before="InstallFinalize">Not Installed</Custom>
</InstallExecuteSequence>
</Module>
</Wix>
#1
4
Your troubleshooting should always start with generating and reading a verbose log. There are probably several problems all at once and all need to be fixed at the same time.
您的故障排除应始终从生成和读取详细日志开始。可能同时存在几个问题,所有问题都需要同时修复。
First is that your Type 51 set property custom action is scheduled before InstallInitialize. The property is not a secure custom property so it doesn't get passed into the transaction. Try scheduling it after InstallInitialize instead.
首先,您的Type 51设置属性自定义操作是在InstallInitialize之前安排的。该属性不是安全的自定义属性,因此不会传递到事务中。请尝试在InstallInitialize之后安排它。
Second is you are in a merge module and merge modules modularize (append GUID) pretty much all identifiers. If you look at the build merge module in ORCA you'll see it's not looking for INSTALLDIR it's looking for INSTALLDIR.GUID.
其次是你在合并模块和合并模块模块化(附加GUID)几乎所有标识符。如果你看看ORCA中的构建合并模块,你会发现它不是在寻找INSTALLDIR,它正在寻找INSTALLDIR.GUID。
If you really must use INSTALLDIR you want to define a property called INSTALLDIR with no value and use the SuppressModularization attribute to prevent the GUID. The approach I usually take though is to define a MergeRedirectFolder directory and use that instead. Then when I add the merge module to InstallShield I associate the module to INSTALLDIR and the transitive nature then takes over.
如果你真的必须使用INSTALLDIR,你想要定义一个没有值的名为INSTALLDIR的属性,并使用SuppressModularization属性来阻止GUID。我通常采用的方法是定义一个MergeRedirectFolder目录并使用它。然后,当我将合并模块添加到InstallShield时,我将模块关联到INSTALLDIR,然后传递性质接管。
There may be other problems but it's hard to see without looking at the final MSI and reading through the logs.
可能还有其他问题,但如果不查看最终的MSI并阅读日志,很难看到。
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Module Id="MergeModule2" Language="1033" Version="1.0.0.0">
<Package Id="c4acbfbc-a0e8-4d52-b516-bee471a76e8a" Manufacturer="" InstallerVersion="200" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="MergeRedirectFolder"/>
</Directory>
<Binary Id="myCustomActionsDLL" SourceFile="CustomAction1.CA.dll" />
<CustomAction Id="SetProperty" Execute="immediate"
Property="CA_myCustomAction"
Value="InstallDir=[MergeRedirectFolder];SourceDir=[SourceDir]" />
<CustomAction Id="CA_myCustomAction"
BinaryKey="myCustomActionsDLL"
DllEntry="CustomAction1"
Execute="deferred" Impersonate="no"
Return="check" />
<InstallExecuteSequence>
<Custom Action="SetProperty" After="InstallInitialize">Not Installed</Custom>
<Custom Action="CA_myCustomAction" Before="InstallFinalize">Not Installed</Custom>
</InstallExecuteSequence>
</Module>
</Wix>