Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run heat.exe and register a dll in wix

I need to register a dll in regAsm and now i was using

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

to register and to unregister

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

Am using it and sometimes its installing and somnetimes it gives error. But all are recommending to use something Heat.exe, http://wixtoolset.org/documentation/manual/v3/overview/heat.html even i went through this link,but i need how to use it in wix and what to do with this stuff.I need some tuitorial

like image 657
Dah Sra Avatar asked Jun 27 '14 06:06

Dah Sra


1 Answers

Heat is used to scrape directories or files and generate .wxs files to include in your installer. If you wish to generate registry information from a .net dll with a COM interface you can use a command like the following:

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

Here is some sample output from a command like the above:

<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, Version=5.5.6.8, Culture=neutral, 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>

Basically the heat command generates a wxs file with the above component in it. Then all you need to do is to include this component or component group in your main installer. It will then create the registry entries instead of running regasm. The uninstall would then remove these registry entries.

Here is how you might include it in your main installer:

<Feature Id="ProductFeature" Title="ExactaSmallPick" Level="1">
    <ComponentRef Id="ExactaDatabaseAccess.dll"/>
</Feature>
like image 127
Cole W Avatar answered Dec 09 '22 03:12

Cole W



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!