【问题标题】:WiX 3.8 website installer - nothing happens on executing MSIWiX 3.8 网站安装程序 - 执行 MSI 时没有任何反应
【发布时间】:2014-03-13 05:25:54
【问题描述】:

我正在使用 WiX 3.8 为 MVC Web API 项目构建网站安装程序。我已成功按照教程的步骤创建了 MSI 文件,该文件应将所有 Web 应用程序文件复制到我的 IIS 文件夹中。但是在执行它时,我没有看到任何文件被复制并且 MSI 退出没有任何错误。我也检查了事件日志,它说安装程序运行成功。下面是 MS Build 文件:

    <?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <WebSiteSource>..\API\</WebSiteSource>
        <SetupF>..\Setup\</SetupF>
        <PublishF>publish\</PublishF>
        <Publish>$(SetupF)$(PublishF)</Publish>
        <WebSiteContentCode>WebAPIContent.wxs</WebSiteContentCode>
    <WebSiteContentObject>WebSiteContent.wixobj</WebSiteContentObject>
    <MsiOut>bin\Release\Setup.msi</MsiOut>
      </PropertyGroup>
    <!-- Defining group of temporary files which is the content of the web site. -->
     <ItemGroup>
        <WebSiteContent Include="$(WebSiteContentCode)" />
    </ItemGroup>

    <!-- The list of WIX input files -->
    <ItemGroup>
        <WixCode Include="Product.wxs" />
        <WixCode Include="$(WebSiteContentCode)" />
    </ItemGroup>
    <Target Name="Build">
    <!-- Compile in release mode -->
        <MSBuild Projects="..\API\API.csproj" Targets="ReBuild" Properties="Configuration=Release" />
    </Target>
    <Target Name="PublishWebsite">
    <!-- Remove complete publish folder in order to be sure that evrything will be newly compiled -->
        <Message Text="Removing publish directory: $(SetupF)"/>
        <RemoveDir Directories="$(SetupF)" ContinueOnError="false" />
        <Message Text="Start to publish website" Importance="high" />
        <MSBuild Projects="..\API\API.csproj" Targets="ResolveReferences;_CopyWebApplication" Properties="OutDir=$(Publish)bin\;WebProjectOutputDir=$(Publish);Configuration=Release" />
    </Target>
    <Target Name="Harvest">
    <!-- Harvest all content of published result -->
        <Exec
        Command='"$(Wix)bin\heat" dir $(Publish) -dr INSTALLFOLDER -ke -srd -cg apicomponents -var var.publishDir -gg -out $(WebSiteContentCode)'
        ContinueOnError="false"
        WorkingDirectory="." />
    </Target>
  <Target Name="WIX">
    <Message Text="TEST: @(WixCode)"/>

    <Exec
      Command='"$(Wix)bin\candle" -dpublishDir=$(Publish) -dMyWebResourceDir=. @(WixCode, &apos; &apos;)'
      ContinueOnError="false"
      WorkingDirectory="." />

    <Exec
      Command='"$(Wix)bin\light" WebAPIContent.wixobj Product.wixobj -out $(MsiOut)'
      ContinueOnError="false"
      WorkingDirectory="." />

    <Message Text="Install package has been created." />
  </Target>
</Project>

产品.wxs

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" Name="ApiSetup" Language="1033" Version="1.0.0.0" Manufacturer="Fingent" UpgradeCode="20e8d558-9fc4-4bd3-9842-76ae40edd994">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of API is already installed." />
    <Media Id="1" Cabinet="api.cab" EmbedCab="yes" />

    <Feature Id="ProductFeature" Title="api.Setup" Level="1">
      <ComponentGroupRef Id="apicomponents" />
    </Feature>
  </Product>

  <Fragment>
    <!-- Will default to C:\ if that is the main disk -->
    <Directory Id="TARGETDIR" Name="SourceDir">
      <!-- Will reference to C:\wwwroot-->
      <Directory Id="INETPUB" Name="Inetpub">
        <!-- Will reference to c:\wwwroot\api-->
        <Directory Id="INSTALLFOLDER" Name="api" />
      </Directory>
    </Directory>
  </Fragment>
</Wix>

如您所见,我使用 Heat 来生成文件列表。它的 WXS 文件已正确生成,我还获得了 OBJ 文件和 MSI,但在执行后什么也没做。请帮忙。

【问题讨论】:

  • 原来targetdir是我的D盘而不是C:。我在那里找到了文件。不知道如何将其设置为 C 盘。

标签: asp.net-web-api wix installation


【解决方案1】:

问题可能是由于以下原因:

1) 在HeatFile.wxs 代中。 HeatFile.wxs 可能已成功生成,但它可能不包含需要安装软件的目录。

为此,在生成HeatFile.wxs 时将-dr yourinstallationdirectory 标签添加到您的命令行。

完整的命令如下:

heat.exe dir "path to directory which needs to be harvested" -dr INSTALLDIR -cg Components -gg -g1 -srd -var var.MyDir -out HeatFile.wxs

2) 但是,您发现您的TARGETDIR 原来是D:\ 驱动器。发生这种情况是因为 wix 搜索具有最多可用磁盘空间的目录并默认将您的 msi 安装在该目录中。

但是您可以使用以下标签更改您的根目录:

< SetDirectory Id="TARGETDIR" Value="C:\" / > 

希望这会有所帮助:)

【讨论】:

  • 哇!发布问题 7 个月后的答案!感谢您为 Rohit 带来的麻烦。我正在着手另一个安装项目,这次是一个复杂得多的项目。如有任何问题,我会与您联系。 WiX 肯定是一个复杂的野兽!
  • 其实我也是从一个月前开始做wix的。所以,当我遇到类似的问题时,我在谷歌上搜索并到达这里,但是,我在这里没有找到任何解决方案。我再次阅读了我的整个代码并自己发现了这个错误。然后我想到发布解决方案,所以它可能会有所帮助。 :\ :)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-03-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-07-03
  • 2015-04-09
  • 1970-01-01
相关资源
最近更新 更多