0

我正在将 WIX 与 MSBuild 一起使用。我正在尝试将 com 库和 .ttf 文件复制到两个不同的位置,并且我想使用 WIX 注册 com 库。当我使用 Visual Build Pro 运行它时,我看不到任何错误或警告,并且我可以看到复制脚本被添加到安装文件中。但是安装设置后文件不会复制到指定目录。

Build.msbuild<Target>如下:

<Target Name="Setup">
<!-- Setup the source directory structure as it should appear on the target machine -->

<ItemGroup>
  <DeployFiles Include="$(Includes)" Exclude="$(Excludes)" />
  <PostHarvestFiles Include="$(PostHarvestIncludes)" Exclude="$(PostHarvestExcludes)" />
</ItemGroup>

<MakeDir Directories="$(OutputDir)" />
<MakeDir Directories="$(FinalOutputDir)" />
<MakeDir Directories="$(FilesToInstallDir)" />

<!-- Harvest the newly created directory structure for the MSI -->
<Copy SourceFiles="@(DeployFiles)" DestinationFiles="@(DeployFiles->'$(FilesToInstallDir)\%(RecursiveDir)%(Filename)%(Extension)')" />    
<Exec Command='$(BuildToolsDir)\Wix\heat.exe dir "$(FilesToInstallDir)" -dr INSTALLDIR -gg -cg FilesToInstall -sfrag -srd -sreg -out "$(MSBuildThisFileDirectory)Files.wxs" -var var.BaseDir' />

 <Copy Condition="'%(Extension)' == '.ttf'" SourceFiles="@(PostHarvestFiles)"  DestinationFiles="@(PostHarvestFiles->'$(FilesToInstallDir)\%(RecursiveDir)%(Filename)%(Extension)')" />

<!-- Harvest the old renderer DLL. This is a COM object and needs special handling -->
<Copy Condition="'%(Extension)' == '.dll'" SourceFiles="@(PostHarvestFiles)" DestinationFiles="@(PostHarvestFiles->'$(ComFilesToInstallDir)\%(RecursiveDir)%(Filename)%(Extension)')" />
<Exec Command='$(BuildToolsDir)\Wix\heat.exe file "$(ComFilesToInstallDir)\ComSrv.dll" -dr COMINSTALLDIR -ag -cg COMObjectsToInstall -out "$(MSBuildThisFileDirectory)COMDlls.wxs" -var var.ExternalsDir' />
</Target>


 <Target Name="CompileWix" DependsOnTargets="Setup">
 <!--  Create the Wix object files for linking in the next task  -->
<ItemGroup>
  <WixFiles Include="$(SourceDir)\Installer-Website\*.wxs" />
</ItemGroup>

<!-- Compile the Wix object files -->
<Exec Command="$(BuildToolsDir)\Wix\candle.exe -dBaseDir=&quot;$(FilesToInstallDir)&quot; -dBuildToolsDir=&quot;$(BuildToolsDir)&quot; -dExternalsDir=&quot;$(SourceDir)\ExternalAssembly&quot; -dFinalVersion=$(FinalVersion) -ext WiXNetFxExtension -ext WixIisExtension -out $(OutputDir)\ @(WixFiles->'%(Filename)% (Extension)',' ')" />
</Target>


<Target Name="BuildMsi" DependsOnTargets="CompileWix">
<!--   Link the Wix object files into the final MSI -->
<ItemGroup>
  <WixObjectFiles Include="$(OutputDir)\*.wixobj" />
</ItemGroup>

<!--  Link the Wix object files into the final MSI  -->
<Exec Command="$(BuildToolsDir)\Wix\light.exe -cultures:en-us -loc      &quot;$(MSBuildThisFileDirectory)WebAppInstallDlg_en-us.wxl&quot; -sice:ICE17 -sice:ICE38 -sice:ICE43 -sice:ICE57 -sice:ICE64 -ext WixUIExtension -ext WiXNetFxExtension -ext WixIisExtension -out $(OutputDir)\$(MsiName) @(WixObjectFiles->'%(FullPath)',' ')" />
<Copy SourceFiles="$(OutputDir)\$(MsiName)" DestinationFolder="$(FinalOutputDir)" />

 </Target>

Product.wxs 文件,目录如下:

 <Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="INSTALLDIR" Name="$(var.BaseProductName)">
    <Directory Id="FontsFolder">
      <Component Id="cmp_FontsToInstall" Guid="{C286A08B-28CB-4A62-9BF8-833A6B141CB4}">
        <File Id="fil82FBA6D3A96B47C48C72FA2F03739758" KeyPath="yes" TrueType="yes" Source="$(var.BaseDir)\OOCA.ttf" />
      </Component>        
    </Directory>

    <Directory Id="COMINSTALLDIR" >
      <Component Id="COMObjectsToInstall" Guid="{5BAD46DE-D6AB-42D0-A13E-2407F8FBC97B}" >
        <File Id="filE617B0B38D366E756290A5B22F2660C4" KeyPath="yes" TrueType="no" Source="$(var.BaseDir)\bin\ComSrv.dll" />
      </Component>
    </Directory>

  .
  .
  .
  .
   </Directory>
 </Directory>

我是这个 MSBuild 和 Wix 的新手。任何人都可以指出我的脚本中有什么问题。

4

1 回答 1

0

谢谢迈克R。我已经包含了这些文件。但是我使用的属性名称(PostHarvestIncludes)拼写不正确。解决了。

于 2013-08-22T04:30:23.473 回答