首页 文章

在wix中注册com dll

提问于
浏览
8

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

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

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

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

2 回答

  • 2

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

    heat.exe文件-gg -out

    如:

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

    PS . 添加-gg开关将生成guids,否则如果要手动添加它们,可以跳过它 .

  • 18

    我强烈建议使用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>
    

相关问题