using wix to register .Net assembly marked for COM interop
I've got a vanilla .net class library which contains some types which are [ComVisible] and the assembly itself is marked "Register for COM Interop". I'm trying to build a WIX installer for the app which will need to not only copy the .net assembly to the INSTALLATIONDIR on the target machine, but also do the work of registering that the object so that some legacy VB6 applications can make use of the .net assembly.
I've been using heat.exe (the heat file task more precisely) to harvest a fragment which I've included via a componentGroupRef in my main wix file. My question is should the file that heat.exe is harvesting be the .tlb file output by my class library or the dll itself? If I use h开发者_开发百科eat.exe on the .tlb I dont get any registry elements in the fragment but I do with the dll. If I ought to be using the dll what role does the .tlb play in this process?
Im using the below heat task in msbuild
<HeatFile
NoLogo="true"
ToolPath="$(WixToolPath)"
TreatWarningsAsErrors="false"
AutogenerateGuids="true"
GenerateGuidsNow="true"
OutputFile="$(MSBuildProjectDirectory)\fragments\DemoTypeLib.wxs"
File="$(SolutionDir)DemoClassLibrary1\bin\Debug\DemoClassLibrary1.dll"
ComponentGroupName="DemoTypeLibComponent"
PreprocessorVariable="var.DemoClassLibrary1.TargetDir"
SuppressCom="false"
DirectoryRefId="INSTALLLOCATION"
SuppressRegistry="false"
SuppressRootDirectory="true" />
You should harvest both the .tlb and the .dll file. Some tools can use only the DLL registration, but others, like scripting languages, need the type library as well. Simply heat both of them, and include both outputs in your final project. For example, python's win32com and Perl's Win32::OLE libraries both need the type library registered to function.
Just ship the Fragment with the DLL and the COM for it. You don't need the TLB.
精彩评论