在wix中注册com dll

时间:2012-05-09 06:13:53

标签: com wix wix3.5 wix3 heat

如果不是自我注册。那么我们如何在使用WIX进行安装时执行COM dll注册?

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

我可以从命令行成功注册regsvr32。 我读到没有为注册com dlls创建自定义操作。

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

2 个答案:

答案 0 :(得分:19)

我强烈建议使用Wix工具Heat.exe来获取注册com组件所需的所有数据,然后引用.wxs文件中的片段,如下所示:

    <ComponentGroupRef Id="FooBar.dll" />

或者将它包含在.wxs文件中,如下所示:

    <?include FooBar.dll.wxi?>

此方法可让您完全控制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>

然后将您的操作添加到安装顺序。

    <InstallExecuteSequence> 
        <Custom Action="RegisterFooBar" After="InstallFinalize">NOT Installed</Custom>
        <Custom Action="UnregisterFooBar" After="InstallFinalize">REMOVE="ALL"</Custom>
    </InstallExecuteSequence>

答案 1 :(得分:2)

您可以尝试使用heat.exe程序,然后在您的wix代码中引用该片段。

heat.exe文件-gg -out

如:

heat.exe文件my.dll -gg -out my.wxs

聚苯乙烯。添加-gg开关将生成guids,否则如果要手动添加它们,可以跳过它。