简体   繁体   English

WiX安装程序将dll包含到msi中

[英]WiX installer includes dll into msi

I'm trying to create an installer using WiX. 我正在尝试使用WiX创建安装程序。 To includes DLLs into .msi package I tryied two different ways. 为了将DLL包含到.msi包中,我尝试了两种不同的方法。 One of these is: 其中之一是:

<DirectoryRef Id="SETTINGSDIR">
  <Component Id="CMP_CopySettings" Guid="AC7D1AA1-798B-48F5-AF8D-188B1050D47C" KeyPath="yes">
    <CreateFolder />
    <File Id="DBA.bat" Source="$(var.SolutionDir)\scr\A\A.WindowsService\bin\$(var.Configuration)\Settings\A_DB clear.bat" Checksum="yes"/>
    <File Id="AConfiguration.xml" Source="$(var.SolutionDir)\scr\A\A.WindowsService\bin\$(var.Configuration)\Settings\AConfiguration.xml" Checksum="yes"/>
    <File Id="ADB.CE.DEFAULT.sdf" Source="$(var.SolutionDir)\scr\A\A.WindowsService\bin\$(var.Configuration)\Settings\ADB.CE.DEFAULT.sdf" Checksum="yes"/>
    <File Id="ADB.CE.sdf" Source="$(var.SolutionDir)\scr\A\A.WindowsService\bin\$(var.Configuration)\Settings\A.CE.sdf" Checksum="yes"/>
    <RemoveFile Id="RemoveFileSettings" Name="*" On="uninstall"/>
  </Component>
</DirectoryRef>

But as you can easily understand, it's very hard write an xml node for each DLL (6 projects with 200+ DLLs for each one). 但是,您可以轻松理解,为每个DLL编写一个xml节点非常困难(6个项目,每个项目有200多个DLL)。

The second one is faster, but WiX just creates a link to the folder instead of copy DLLs into msi package 第二个速度更快,但是WiX只会创建指向该文件夹的链接,而不是将DLL复制到msi包中

<DirectoryRef Id="SETTINGSDIR">
  <Component Id="CMP_CopySettings" Guid="AC7D1AA1-798B-48F5-AF8D-188B1050D47C" KeyPath="yes">
    <CreateFolder />
    <CopyFile Id="SettingsID" SourceProperty="SETTINGSSOURCEDIRECTORY" DestinationDirectory="SETTINGSDIR" SourceName="*" />
    <RemoveFile Id="RemoveFileSettings" Name="*" On="uninstall"/>
  </Component>
</DirectoryRef>

Is there a quick solution that can I add at my second way or I have to use heat.exe tool? 是否可以使用第二种方法添加快速解决方案,或者必须使用heat.exe工具? In this case, can you explain me how to use it? 在这种情况下,您能解释一下如何使用它吗? The official documentation is very poor 官方文件很差

Thanks 谢谢

What you want is an harvest tool to do this for you. 您想要的是一种收割工具来为您执行此操作。 Luckily it already exists: Heat 幸运的是它已经存在:

In your specific case you might want to use the command heat dir ".\\My Files" -gg -g1 -directoryid "YourDirectoryId" -sfrag -template:fragment -out directory.wxs but check what is exactly your need, which harvesting you want to skip etc... 在您的特定情况下,您可能需要使用命令heat dir ".\\My Files" -gg -g1 -directoryid "YourDirectoryId" -sfrag -template:fragment -out directory.wxs但是请检查您究竟需要什么,哪一个使您收获想跳过等...

Note the -t <xsl> switch which gives you the total control on how you want to tune the final output. 注意-t <xsl>开关,它可以让您完全控制如何调整最终输出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM