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

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

问题描述

根据Si提出的这个问题,这里是: WiX技巧和窍门.我正在尝试确定基于目录创建wix片段的最佳方法.可以这么说,文件收集.例如,在bin \ release文件夹下,我可以有许多不同的文件夹以及要非常容易地片段捕获的文件.我一直在通过键入它们或使用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\release 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.

请注意,我在这里没有做过刚刚做过reasearch的任何尝试: A)我读了一些热度.( http://installing.blogspot.com/2006/04/heatexe-making-setup-easier.html )我不确定从msbuild运行它吗? B)我从Newagesolution找到了这篇博客文章,其中讨论了如何使用t4脚本:

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)我完全同意使用热量,但是我认为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中实现加热任务/加热目录(包装在msbuild中的加热)的文档.请注意,从msbuild运行的包装器似乎很新,我不承担使用该包装器的风险,等等.由于缺少文档,我向wix用户列表发送了一封电子邮件.我得到了Brian Rogers的帮助.谢谢Brian,这为我解决了所有问题.在这里查看他的博客文章,以更好地了解热量将如何帮助您实现自动化: 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 Installer的知识,我想很多人会在使用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-Introduction http://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​​ 您必须决定是否要在每次安装新版本时进行文件修补或升级. 幸运的是,我不需要进行修补,因此对于每次升级,我都将像这样卸载以前的版本:

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 由于我正在使用带有混合的主要升级,因此我想将颠覆引入我的产品编号中.我认为这很简单,那就是您是否知道该怎么做.我在这里遇到麻烦,也必须为此寻求帮助.

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>..\..\data\HeatDir</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="..\..\data\HeatDir"
      DirectoryRefId="DataDir"
      OutputFile="TestDir.wxs"
      AutogenerateGuids="true"
      ToolPath="$(WixToolPath)" />
 </Target>

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

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上找到了这篇文章:收获.csproj在Visual Studio 2008和WiX(v3)中使用heat.exe .再一次,可以使用加热任务来完成.
两者都讨论使用第三方工具.一个叫锦葵,另一个叫石蜡.我认为石蜡看起来很受支持,几乎可以完成热能. 带有一些附加内容:有关详细信息,请参见此处:

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天全站免登陆