基于要在 MSBUILD 中使用的用户定义目录创建 wix 片段文件的最佳方法 [英] Best way to create a wix fragment file based on User-defined directories to be used in MSBUILD

查看:19
本文介绍了基于要在 MSBUILD 中使用的用户定义目录创建 wix 片段文件的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

本着 Si 提出的这个问题的精神:WiX 技巧和提示.我正在尝试确定基于目录创建 wix 片段的最佳方法.文件收割,可以这么说.例如,在 bin elease 文件夹下,我可以有许多不同的文件夹以及我想在片段中轻松捕获的文件.我一直在通过键入它们或使用 wixedit 来做到这一点.

In the spirit of this question by Si here: WiX tricks and tips. I am trying to determine the best way to get create wix fragments based on a directories. File harvesting, so to speak. For example under the bin elease folder I could have many different folders plus files that I want to capture very easily in fragments. I have been doing this by typing them or using wixedit.

请注意,我没有尝试任何东西,只是在这里进行了研究:A)我读了一点关于热量的文章.(http:///installing.blogspot.com/2006/04/heatexe-making-setup-easier.html)我不确定是否要从 msbuild 运行它?B)我从 Newagesolution 中找到了这篇讨论使用 t4 脚本的博客文章:http://blog.newagesolution.net/2008/06/how-to-use-msbuild-and-wix-to-msi.html

Please note I haven't tried anything just done the reasearch here: A)I read a little bit on heat.(http://installing.blogspot.com/2006/04/heatexe-making-setup-easier.html) I am not sure though about running it from msbuild? B)I found this blog article from Newagesolution which discusses using t4 script: http://blog.newagesolution.net/2008/06/how-to-use-msbuild-and-wix-to-msi.html

我想知道其他人正在做什么来解决这个问题.

I would like to know what others are doing to solve this.

问候,布赖恩

推荐答案

好的,Daniel 我绝对同意使用 heat,但我认为 Rob 为我最终使用的东西指明了正确的方向.

Ok, Daniel I definately agree with using heat, but I think Rob pointed me in the right direction for what I ended up using.

我最终使用的是 HeatDirectory.(请注意,我不打算打补丁.如果您想要打补丁,您可能需要查看其他解决方案,但 heat/heat 目录可以用于打补丁.)不幸的是,Rob 的回答非常有限,所以我不会说他真的回答了我的问题.只是为我指明了正确的方向.感谢 Rob 和 Daniel 的帮助.

What I ended up using was HeatDirectory.(Please note, I do not plan on doing patching. If you want patching, you may want to look at another solution, but heat/heat directory can work for patching.) Unfortunately, Rob's answer was quite limited, so I wouldn't say that he really answered my question. Just pointed me in the right direction. Thanks to both Rob and Daniel for your help.

因此,我自己回来回答了这个问题.

Therefore, I came back and answered this question myself.

障碍...

障碍 1我遇到的是,网络上几乎没有关于如何从 Visual Studio 中实现 heat 任务/heat 目录(Heat 包裹在 msbuild 中)的文档.请注意,从 msbuild 运行的包装器似乎很新,我拒绝使用您自担风险等.由于缺乏文档,我向 wix 用户列表发送了一封电子邮件.我得到了布赖恩·罗杰斯的帮助.谢谢布赖恩,这为我解决了一切.在这里查看他的精彩博客文章,以更好地了解热量如何帮助您实现自动化:http://icumove.spaces.live.com/blog/cns!FB93073C6534B681!461.entry

Hurdle 1 I ran into is there is nearly no documentation on the web for how to implement heat tasks/heat directory(Heat wrapped in msbuild) from within visual studio. Please note that the wrapper to run from msbuild appears to be pretty new and I disclaim to use at your own risk, etc. Because of the lack of documentation, I sent an email to the wix user list. I received help from Brian Rogers. Thanks Brian, this solved everything for me. Take a look at his great blog entry here for a better understand how heat is going to help you automate: http://icumove.spaces.live.com/blog/cns!FB93073C6534B681!461.entry

障碍 2在使用热量之后,我发现我没有按照推荐的方式使用组件,但我不得不拼凑所有的推理.如果您没有 Windows 安装程序的先验知识,我认为很多人在使用 Wix 时会遇到这种情况.因此,我推荐一些阅读:如果您是像我一样使用 Windows Installer 的新手,请务必阅读组件规则.MS 的组件规则:http://msdn.microsoft.com/en-us/library/aa370561.aspx.阅读 Rob Mensching 的这些内容,以更好地理解组件:http://robmensching.com/blog/posts/2003/10/4/Windows-Installer-Components-Introductionhttp://robmensching.com/blog/posts/2003/10/18/Component-Rules-101有关 Windows 安装程序的额外阅读,请查看 Windows 安装程序团队的这些规则(规则 16:遵循组件规则):http://blogs.msdn.com/windows_installer_team/archive/2006/05/12/595950.aspx

Hurdle 2 After working with heat, I found out that I was not using components the recommended way, but I had to piece together all the reasoning. I think many people will run into this in the beginning of using Wix if you don't have prior knowledge of windows installer. Therefore I recommend some reading: Make sure you read component rules as well if you are a novice like I was with Windows Installer.Component rules from MS: http://msdn.microsoft.com/en-us/library/aa370561.aspx. Read these from Rob Mensching for a better understanding of components: http://robmensching.com/blog/posts/2003/10/4/Windows-Installer-Components-Introduction http://robmensching.com/blog/posts/2003/10/18/Component-Rules-101 For Extra Reading on Windows installer check these rules from the windows installer team(Rule 16: Follow Component Rules): http://blogs.msdn.com/windows_installer_team/archive/2006/05/12/595950.aspx

障碍 3每次安装新版本时,您必须决定是否要修补文件或升级.幸运的是我不需要打补丁,因此每次升级我都会像这样卸载以前的版本:如何实现 WiX 安装程序升级?.这大大简化了事情.修补时,您将需要完全控制事物.当您希望许多除了 wix 构建 msi 字段之外对 wix 一无所知的开发人员想要自动化/自动构建时,这会更加困难.似乎这可以使用热量,但我不确定.

Hurdle 3 You must decide whether or not you want to do patching of your files or upgrade everytime you install a new version. I fortunately do not need to do patching, therefore for every upgrade I will just uninstall the previous version like this: How to implement WiX installer upgrade?. This simplifies things greatly. When patching you are going to need full control over things. Something that is more difficult when you want automation/automatic building for by many developers that do not know anything about wix other than wix builds msi fields. It seems that this will work with using heat, but I am uncertain.

障碍 4对我来说,我花了一点时间来弄清楚为什么包含我的预处理器变量的包含文件不起作用.我终于弄明白了.您必须在 .wxs 文件中包含该文件,如下所示:有关更多详细信息,请参见此处:将文本文件内容包含到 WiX 脚本中

Hurdle 4 For me it took a little time to figure out why the include file with my preprocessor variables was not working. I finally figured it out. You must include the file in your .wxs file like this: See here for more details: Include a text file content into a WiX script

http://wix.sourceforge.net/manual-wix2/preprocessor.htm

第 5 关由于我正在使用 mix 的主要升级,并且我想将 subversion 挂接到我的产品编号中.我认为这很简单,如果你知道怎么做.我在这里遇到了麻烦,也不得不为此寻求帮助.

Hurdle 5 Since I am using major upgrades with mix and I wanted to hook in subversion into my product number. This I thought would be quite simple and it is if you know how to do it. I had trouble here and had to get help for this as well.

第 6 关通过基于 bin 文件夹的热更新文件,一切正常.好吧,几乎是自动的,如果 dll 引用等有任何冲突,那么文件将不会包含在安装程序中,因此可能无法正常运行.您需要有一个测试过程,以便在安装后测试您的程序.如果您错过了一个 dll,这可能很关键.我还建议您跟踪程序使用的 dll 并与 msi 文件进行比较.

Hurdle 6 With heat updating the files based on a bin folder everything works quite well. Well almost automatic, if there are any conflicts in dll references, etc then files will not be included in the installer and therefore things might not run properly. You need to have a testing process in place so as to test your program after installing. This can be critical if you miss a dll. I would also recommended that you keep track of the program's used dlls and compare against the msi file.

现在使用 HeatDirectory 的解决方案(在 Brian Rogers(wix 团队)的帮助下):

Now for the solution using HeatDirectory(from the help of Brian Rogers(wix team)):

 <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == ''">Debug</Configuration>
   <OutputName>msbuild.heatfile</OutputName>
   <OutputType>Package</OutputType>
   <WixToolPath>....YourHeatDir</WixToolPath>
   <WixToolPath>$(WixToolPath)</WixToolPath>
   <Cultures>en-us</Cultures>
   <LinkerBaseInputPaths>....dataHeatDir</LinkerBaseInputPaths>
 </PropertyGroup>
 <ItemGroup>
   <Compile Include="product.wxs" />
   <Compile Include="TestDir.wxs" />
 </ItemGroup>
 <Import Project="$(WixToolPath)Wix.targets" />
 <UsingTask TaskName="HeatDirectory"
   AssemblyFile="$(WixToolPath)WixUtilExtension.dll" />
 <Target Name="BeforeBuild">
   <HeatDirectory
      Directory="....dataHeatDir"
      DirectoryRefId="DataDir"
      OutputFile="TestDir.wxs"
      AutogenerateGuids="true"
      ToolPath="$(WixToolPath)" />
 </Target>

这需要粘贴到您的项目文件中,并且需要更改适当的设置/路径.这将做的是获取您指定的路径中的所有文件并创建一个 TestDir.wxs 文件,然后您可以按组件组引用该文件.有几个 Heatdirectory 选项,您需要查看 heat 源代码了解详细信息.

This needs to be pasted into your project file and appropriate settings/pathing needs to be changed. What this will do is take all the files in the path you specify and create a TestDir.wxs file which you then can reference by component group. There are several Heatdirectory options see you need to see the heat sourcecode for details.

仅供参考:在我发布问题后,我在 stackoverflow 上找到了这篇文章:如何将整个目录或项目输出添加到 WiX 包另外作为参考,我刚刚在这里看到了这篇文章:Harvesting a .csproj在 Visual Studio 2008 和 WiX(v3) 中使用 heat.exe.同样,这可以使用热任务来完成.
两者都讨论了使用第三方工具.一个叫Mallow,另一个叫Paraffin.我认为石蜡看起来很受支持,并且几乎可以做热所做的事情.有一些补充:详见此处:http://www.wintellect.com/cs/blogs/jrobbins/archive/2007/10/18/wix-hints-for-new-users-part-1-of-3.aspx

Just for reference: I found this post on stackoverflow after I posted my question: How to add a whole directory or project output to WiX package Also for reference I just saw this article here: Harvesting a .csproj with heat.exe in Visual Studio 2008 and WiX(v3). and again this can be done using heat tasks instead.
Both discuss using third party tools. One called Mallow and another called Paraffin. I think paraffin looks supported and can do pretty much what heat does. With a few additions: See here for details: http://www.wintellect.com/cs/blogs/jrobbins/archive/2007/10/18/wix-hints-for-new-users-part-1-of-3.aspx

无论如何希望这对其他人有所帮助.

Anyways hope this helps others.

这篇关于基于要在 MSBUILD 中使用的用户定义目录创建 wix 片段文件的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆