在wix中注册com dll

rak*_*eep 8 com wix wix3 heat wix3.5

如果不是自我注册.然后我们如何在使用WIX安装时执行COM dll注册?

根据教程,我使用了ComPlusApplication示例(非.net dll).但它不起作用.它无法注册.

我可以成功地从命令行使用regsvr32进行注册.我读到没有创建用于注册com dll的自定义操作.

那么最好的方法是什么?如果我们需要使用heat,我们在哪里编写命令并将结果wxs添加到主项目中?

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)