How to register a COM dll on condition based in WIX Installer

女生的网名这么多〃 提交于 2019-12-11 17:47:27

问题


Am running a Command to register a dll using the below code in WIX installer

 <CustomAction Id='comReg' Directory='INSTALLLOCATION'  Impersonate='no' Execute='deferred'
                ExeCommand='"[NETFRAMEWORK40CLIENTINSTALLROOTDIR]regasm.exe" "[INSTALLLOCATION]myProduct.dll"  /codebase' Return='check' /> 

  <CustomAction Id='comUnreg' Directory='INSTALLLOCATION' Impersonate='no'  Execute='deferred' ExeCommand='"[NETFRAMEWORK40CLIENTINSTALLROOTDIR]regasm.exe" /u "[INSTALLLOCATION]myProduct.dll"  /codebase' Return='check' />

for registry entry and its working fine and my setup is also working cool. But now i need to register this in condition based (ie) in my installer i have given a checkbox ,if its checked then need to register the dll else no need to register.

I have used conditions for other uses by using <Condition>INSTALLADDIN</Condition> but its working only inside a <Component> </Component> but my command was inside <Product></Product> , how to set the condition for the above mentioned.??

and if i used as below

<Condition Message='EA-Addin not installed'>INSTALLADDIN</Condition>

above that code it shows that message and getting terminated.If i didnt set the message property it shows an error that message is a required property.How to overcome this problem.?


回答1:


You need a condition on the custom action in your situation, I assume you've added it to the execute sequence somewhere but there's no condition on it.

Having said that, that's not really the way to do registration. Use Heat to extract it into a component with the Dll. You'd probably need need two components, one with the file+registration and one with just the file, make them mutually exclusive, and use the remember property pattern on the property. Condition the appropriate component on the condition.

There are conditions everywhere - it looks like you are confusing launch conditions (Condition Message...) with component conditions and custom action conditions.



来源:https://stackoverflow.com/questions/25153247/how-to-register-a-com-dll-on-condition-based-in-wix-installer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!