如何运行heat.exe并在wix中注册一个dll

我需要在regAsm中注册一个dll,现在我正在使用它

<CustomAction Id='comreg' Directory='INSTALLLOCATION'  
                ExeCommand='"[WindowsFolder]Microsoft.NET\Framework\v4.0.30319\regasm.exe" "[INSTALLLOCATION]myProduct.dll"  /codebase' Return='check' />

注册和注销

<CustomAction Id='comUnreg' Directory='INSTALLLOCATION' ExeCommand='"[WindowsFolder]Microsoft.NET\Framework\v4.0.30319\regasm.exe" /u "[INSTALLLOCATION]myProduct.dll"  /codebase' Return='check' />

我使用它,有时它的安装和somne​​times它给出错误.
但所有人都建议使用Heat.exe,
http://wixtoolset.org/documentation/manual/v3/overview/heat.html甚至我经历了这个链接,但我需要如何在wix中使用它以及如何处理这些东西.我需要一些tuitorial

解决方法

Heat用于刮取目录或文件,并生成.wxs文件以包含在安装程序中.如果您希望使用COM接口从.net DLL生成注册表信息,可以使用如下命令:

Heat.exe file C:\<path_to_com_dll>\com.dll -dr INSTALLFOLDER -srd -gg -sfrag -suid -out C:\<path+wxs_file_name_to_output>

以下是来自上述命令的一些示例输出

<Component Id="ExactaDatabaseAccess.dll" Guid="{96F922A0-38C8-4B58-9E3B-E6B0C24EE09D}">
    <Class Id="{E5CF8A66-AA42-432F-A036-97A3FC7E6EBC}" Context="InprocServer32" Description="ExactaDatabaseAccess.DatabaseAccessObj" ThreadingModel="both" ForeignServer="mscoree.dll">
        <ProgId Id="ExactaDatabaseAccess.DatabaseAccessObj" Description="ExactaDatabaseAccess.DatabaseAccessObj" />
    </Class>
    <File Id="ExactaDatabaseAccess.dll" KeyPath="yes" Source="$(var.BasePath)\ExactaDatabaseAccess.dll" />
    <RegistryValue Root="HKCR" Key="CLSID\{E5CF8A66-AA42-432F-A036-97A3FC7E6EBC}\Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}" Value="" Type="string" Action="write" />
    <RegistryValue Root="HKCR" Key="CLSID\{E5CF8A66-AA42-432F-A036-97A3FC7E6EBC}\InprocServer32\5.5.6.8" Name="Class" Value="ExactaDatabaseAccess.DatabaseAccessObj" Type="string" Action="write" />
    <RegistryValue Root="HKCR" Key="CLSID\{E5CF8A66-AA42-432F-A036-97A3FC7E6EBC}\InprocServer32\5.5.6.8" Name="Assembly" Value="ExactaDatabaseAccess,Version=5.5.6.8,Culture=neutral,PublicKeyToken=null" Type="string" Action="write" />
    <RegistryValue Root="HKCR" Key="CLSID\{E5CF8A66-AA42-432F-A036-97A3FC7E6EBC}\InprocServer32\5.5.6.8" Name="RuntimeVersion" Value="v2.0.50727" Type="string" Action="write" />
    <RegistryValue Root="HKCR" Key="CLSID\{E5CF8A66-AA42-432F-A036-97A3FC7E6EBC}\InprocServer32\5.5.6.8" Name="CodeBase" Value="file:///[#ExactaDatabaseAccess.dll]" Type="string" Action="write" />
    <RegistryValue Root="HKCR" Key="CLSID\{E5CF8A66-AA42-432F-A036-97A3FC7E6EBC}\InprocServer32" Name="Class" Value="ExactaDatabaseAccess.DatabaseAccessObj" Type="string" Action="write" />
    <RegistryValue Root="HKCR" Key="CLSID\{E5CF8A66-AA42-432F-A036-97A3FC7E6EBC}\InprocServer32" Name="Assembly" Value="ExactaDatabaseAccess,PublicKeyToken=null" Type="string" Action="write" />
    <RegistryValue Root="HKCR" Key="CLSID\{E5CF8A66-AA42-432F-A036-97A3FC7E6EBC}\InprocServer32" Name="RuntimeVersion" Value="v2.0.50727" Type="string" Action="write" />
    <RegistryValue Root="HKCR" Key="CLSID\{E5CF8A66-AA42-432F-A036-97A3FC7E6EBC}\InprocServer32" Name="CodeBase" Value="file:///[#ExactaDatabaseAccess.dll]" Type="string" Action="write" />
</Component>

基本上,heat命令会生成一个包含上述组件的wxs文件.然后,您需要做的就是在主安装程序中包含此组件或组件组.然后它将创建注册表项而不是运行regasm.然后卸载将删除这些注册表项.

以下是如何将其包含在主安装程序中:

<Feature Id="ProductFeature" Title="ExactaSmallPick" Level="1">
    <ComponentRef Id="ExactaDatabaseAccess.dll"/>
</Feature>

相关文章

Windows2012R2备用域控搭建 前置操作 域控主域控的主dns:自...
主域控角色迁移和夺取(转载) 转载自:http://yupeizhi.blo...
Windows2012R2 NTP时间同步 Windows2012R2里没有了internet时...
Windows注册表操作基础代码 Windows下对注册表进行操作使用的...
黑客常用WinAPI函数整理之前的博客写了很多关于Windows编程的...
一个简单的Windows Socket可复用框架说起网络编程,无非是建...