2013-08-15 2 views
0

Я использую WIX с MSBuild. Я пытаюсь скопировать библиотеку com и файл .ttf в два разных местоположения, и я хочу зарегистрировать библиотеку com с помощью WIX. Когда я запускаю его с помощью Visual Build Pro, я не вижу никаких ошибок или предупреждений, и я могу видеть, что сценарии копирования добавляются в установочные файлы. Но файлы не копируются в указанный каталог после установки установки.Скопировать файлы с условием, не скопированным фактически в MSBuild

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. Может ли кто-нибудь указать, что было не так в моем сценарии.

+1

Вы определили свойство 'PostHarvestIncludes', потому что ваш Include для' PostHarvestFiles' пуст в противном случае, и это будет означать, что файл не определен, который можно скопировать. – MikeR

ответ

0

Thanks MikeR. Я включил файлы. Но имя свойства (PostHarvestIncludes), которое я использовал, не написано правильно. Он решен.

Смежные вопросы