本文介绍了在为 WIX 安装程序自动收集文件时,我的目录结构有多灵活?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请原谅我的无知——我一直在读一些书,但还没有准备好尝试任何东西.

Forgive me for my ignorance -- I've been doing some reading, but not quite ready to try anything out yet.

目前,我们有一个无法轻松维护的 .wxs 文件.每当从 SVN 提交/删除新文件时,都会手动添加/删除所有文件.由于在创建新文件和更新 .wxs 安装文件之间出现问题,我们经常破坏安装构建.

Currently, we have a .wxs file which is not able to be maintained easily. All of the files are manually added/removed whenever a new file is comitted/removed from SVN. We constantly have broken install builds due to the ball being dropped between creation of a new file and updating of the .wxs install file.

因此,我想自动收集解决方案中的文件.如何在 WIX 安装程序中使用 MSDEPLOY 分级网站输出 似乎概述了我想要做什么,但它没有解决我的主要问题之一.也就是说——像这样收集文件是否允许自定义目录结构,或者安装程序现在将文件安装在模仿我们解决方案的位置?

As such, I would like to automatically harvest the files in the solution. HOW TO CONSUME MSDEPLOY STAGED WEB SITE OUTPUT IN A WIX INSTALLER seems to outline what I want to do, but it doesn't address one of my main concerns. That is -- does harvesting files like this allow for customization of the directory structure, or will the installer now install files in locations mimicing our solution?

我正在努力实现从自动检测新文件和文件夹"到自动知道将新文件放在哪里"的逻辑飞跃.有没有办法设置一些预定义的操作,比如这个父文件夹下的所有文件和文件夹都应该安装到[其他定义的目录]"

I am struggling to make the logical leap from "automatically detect new files and folders" to "know where to put new files automatically." Is there a way to set up some pre-defined actions saying something like "All files and folders under this parent folder should be installed to [other defined directory]"

谢谢.

推荐答案

我在 ASP.net probject 上使用 WiX,它会动态包含在安装过程中运行的所有网站文件和数据库脚本.

I am using WiX on an ASP.net probject do dynamically include all of the website files and database scripts that get run during installation.

我使用像这样的热任务从解决方案中提取文件

I extract the files from the solution using a heat task like so

  <HeatDirectory
                  ToolPath="$(WixToolPath)"
                  Directory="$(WebRoot)"
                  GenerateGuidsNow="yes"
                  ComponentGroupName="MasterPlanWeb"
                  OutputFile="$(MSBuildProjectDirectory)\Setup\Product\Fragments\wwwfiles.wxs"
                  SuppressFragments="yes"
                  DirectoryRefId="WEBROOT"
                  KeepEmptyDirectories="yes"
                  PreprocessorVariable="var.WebRoot"
                  SuppressRegistry="yes"
                  SuppressRootDirectory="yes"
                  SuppressCom="yes" />

然后在我的主要 wix 脚本中被引用为

and then in my main wix script those get referenced as

  <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="INSTALLLOCATION" Name="MasterPlan">
        <Directory Id="WEBROOT" Name="wwwroot" />
        <Directory Id="DATABASESRC" Name="databasesrc" />
      </Directory>
    </Directory>

这两个部分之间的链接,如果第一个 xml 块中的 DirectoryRefId 和第二个块中的 Directory Id.

The link between these two parts if the DirectoryRefId in the first xml chunk and the Directory Id in the second one.

所以基本上直接在我的 HEATed 目录下的解决方案结构按原样复制,但我可以更改根目录.

So basically the solution structure directly under my HEATed directory is copied as is however I am able to change the root.

例如,如果我在 c:\mywebsite 上运行 HEAT 并且该目录包含

For instance if I run HEAT over c:\mywebsite and that directory contains

  • \人\
  • \accounts\
  • \scripts\

将包含这些子目录.

第二部分允许我在安装时设置根目录,所以如果用户选择c:\test作为安装目录,将创建以下目录(带有它们的热门内容)

The second part allows me to set the root directory during installation, so if the user choose c:\test as the directory to install to the following directories would be created (with their heated content)

  • c:\test\people\
  • c:\test\accounts\
  • c:\test\scripts\

例如,如果您真的希望子目录的所有数据都放在根目录下,您可以对每个文件夹进行循环并运行相同的命令,为它们指定相同的 DirectoryRefId.

If you really wanted the subdirectories to have all their data put under the root for instance you might be able to do a loop over every folder and run the same command specifying the same DirectoryRefId for them all.

这篇关于在为 WIX 安装程序自动收集文件时,我的目录结构有多灵活?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 02:05