A.G*_*ame 20
我强烈建议使用Wix工具Heat.exe来获取注册com组件所需的所有数据,然后引用.wxs文件中的片段,如下所示:
<ComponentGroupRef Id="FooBar.dll" />
Run Code Online (Sandbox Code Playgroud)
或者将它包含在.wxs文件中,如下所示:
<?include FooBar.dll.wxi?>
Run Code Online (Sandbox Code Playgroud)
此方法使您可以完全控制Com组件的注册/取消注册期间发生的情况.
但是,您仍然可以在Wix项目中使用Regsvr32.但它依赖于COM组件中RegisterServer/UnregisterServer函数的正确实现
<CustomAction Id="RegisterFooBar"
Directory="INSTALLDIR"
ExeCommand='regsvr32.exe /s "[INSTALLDIR]FooBar.dll"'>
</CustomAction>
<CustomAction Id="UnregisterFooBar"
Directory="INSTALLDIR"
ExeCommand='regsvr32.exe /s /u "[INSTALLDIR]FooBar.dll"'>
</CustomAction>
Run Code Online (Sandbox Code Playgroud)
然后将您的操作添加到安装序列.
<InstallExecuteSequence>
<Custom Action="RegisterFooBar" After="InstallFinalize">NOT Installed</Custom>
<Custom Action="UnregisterFooBar" After="InstallFinalize">REMOVE="ALL"</Custom>
</InstallExecuteSequence>
Run Code Online (Sandbox Code Playgroud)