blob: d692d7420d2177d528df15e04f62dedd4d1c2f89 [file] [log] [blame]
<?xml version="1.0" encoding="utf-8" ?>
<!--
<copyright file="wix.ca.targets" company="Outercurve Foundation">
Copyright (c) 2004, Outercurve Foundation.
This software is released under Microsoft Reciprocal License (MS-RL).
The license and further copyright text can be found in the file
LICENSE.TXT at the root directory of the distribution.
</copyright>
<remarks>
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.
This file defines properties used in the post-build process for WiX/DTF managed custom action projects.
</remarks>
-->
<Project
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
InitialTargets="_SetDefaultPathValues">
<Import Project="$(CustomBeforeWixCATargets)" Condition=" '$(CustomBeforeWixCATargets)' != '' and Exists('$(CustomBeforeWixCATargets)')" />
<PropertyGroup>
<WixCATargetsPath Condition=" '$(WixCATargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\wix.ca.targets</WixCATargetsPath>
<WixTasksPath Condition=" '$(WixTasksPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\..\WiX Toolset v3.8\bin\WixTasks.dll</WixTasksPath>
<WixCATargetsPath Condition=" '$(WixCATargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\wix.ca.targets</WixCATargetsPath>
<WixTasksPath Condition=" '$(WixTasksPath)' == '' ">$(MSBuildExtensionsPath)\..\WiX Toolset v3.8\bin\WixTasks.dll</WixTasksPath>
<TargetCAFileName Condition=" '$(TargetCAFileName)' == '' ">$(TargetName).CA$(TargetExt)</TargetCAFileName>
</PropertyGroup>
<UsingTask TaskName="ReadRegistry" AssemblyFile="$(WixTasksPath)"/>
<!--
==================================================================================================
_SetDefaultPathValues
Gets the default values of some paths from the registry.
[OUT]
$(WixExtDir) - Default Wix Extension Directory
$(WixToolPath) - Default Wix Tool install folder
==================================================================================================
-->
<PropertyGroup>
<WixInstallRegKey>SOFTWARE\Microsoft\Windows Installer XML\3.8</WixInstallRegKey>
<WixInstallRegKeyWow64>SOFTWARE\Wow6432Node\Microsoft\Windows Installer XML\3.8</WixInstallRegKeyWow64>
</PropertyGroup>
<Target
Name="_SetDefaultPathValues">
<ReadRegistry
Hive="LocalMachine"
Key="$(WixInstallRegKey)"
Name="InstallRoot"
FailIfMissing="false"
Condition=" '$(WixToolPath)' == '' ">
<Output TaskParameter="Value" PropertyName="WixToolPath" />
</ReadRegistry>
<!-- If we didn't find the first registry path, assume we're in a 64bit process. -->
<ReadRegistry
Hive="LocalMachine"
Key="$(WixInstallRegKeyWow64)"
Name="InstallRoot"
FailIfMissing="false"
Condition=" '$(WixToolPath)' == '' ">
<Output TaskParameter="Value" PropertyName="WixToolPath" />
</ReadRegistry>
<CreateProperty Value="$(WixToolPath)..\sdk\" Condition=" '$(WixSdkPath)' == '' ">
<Output TaskParameter="Value" PropertyName="WixSdkPath" />
</CreateProperty>
<CreateProperty Value="$(WixSdkPath)x86\" Condition=" '$(WixSdkX86Path)' == '' ">
<Output TaskParameter="Value" PropertyName="WixSdkX86Path" />
</CreateProperty>
<CreateProperty Value="$(WixSdkPath)x64\" Condition=" '$(WixSdkX64Path)' == '' ">
<Output TaskParameter="Value" PropertyName="WixSdkX64Path" />
</CreateProperty>
<CreateProperty Value="$(WixSdkPath)MakeSfxCA.exe" Condition=" '$(MakeSfxCA)' == '' ">
<Output TaskParameter="Value" PropertyName="MakeSfxCA" />
</CreateProperty>
<CreateProperty Value="$(WixSdkX86Path)SfxCA.dll" Condition=" '$(SfxCADll)' == '' and '$(Platform)' != 'x64'">
<Output TaskParameter="Value" PropertyName="SfxCADll" />
</CreateProperty>
<CreateProperty Value="$(WixSdkX64Path)SfxCA.dll" Condition=" '$(SfxCADll)' == '' and '$(Platform)' == 'x64'">
<Output TaskParameter="Value" PropertyName="SfxCADll" />
</CreateProperty>
</Target>
<!--
==================================================================================================
PackCustomAction
Creates an MSI managed custom action package that includes the custom action assembly,
local assembly dependencies, and project content files.
[IN]
@(IntermediateAssembly) - Managed custom action assembly.
@(Content) - Project items of type Content will be included in the package.
$(CustomActionContents) - Optional space-delimited list of additional files to include.
[OUT]
$(IntermediateOutputPath)$(TargetCAFileName) - Managed custom action package with unmanaged stub.
==================================================================================================
-->
<Target Name="PackCustomAction"
Inputs="@(IntermediateAssembly);@(Content);$(CustomActionContents)"
Outputs="$(IntermediateOutputPath)$(TargetCAFileName)">
<!-- Find all referenced items marked CopyLocal, but exclude non-binary files. -->
<CreateItem
Include="@(ReferenceCopyLocalPaths)"
Condition=" '%(ReferenceCopyLocalPaths.extension)' == '.dll' or '%(ReferenceCopyLocalPaths.extension)' == '.exe' ">
<Output TaskParameter="Include" ItemName="CustomActionReferenceContents"/>
</CreateItem>
<!--
Items to include in the CA package:
- Reference assemblies marked CopyLocal
- Project items of type Content
- Additional items in the CustomActionContents property
-->
<CreateProperty Value="@(CustomActionReferenceContents);@(Content->'%(FullPath)');$(CustomActionContents)">
<Output TaskParameter="Value" PropertyName="CustomActionContents" />
</CreateProperty>
<CreateItem Include="@(IntermediateAssembly->'%(FullPath)')">
<Output TaskParameter="Include" ItemName="IntermediateCAAssembly" />
</CreateItem>
<CreateItem Include="@(IntermediateAssembly->'%(RootDir)%(Directory)$(TargetCAFileName)')">
<Output TaskParameter="Include" ItemName="IntermediateCAPackage" />
</CreateItem>
<!-- Run the MakeSfxCA.exe CA packaging tool. -->
<Exec Command='"$(MakeSfxCA)" "@(IntermediateCAPackage)" "$(SfxCADll)" "@(IntermediateCAAssembly)" "$(CustomActionContents)"'
WorkingDirectory="$(ProjectDir)" />
<!-- Add modules to be copied to output dir. -->
<CreateItem Include="@(AddModules);@(IntermediateCAPackage)">
<Output TaskParameter="Include" ItemName="AddModules" />
</CreateItem>
</Target>
<!--
==================================================================================================
CleanCustomAction
Cleans the .CA.dll binary created by the PackCustomAction target.
==================================================================================================
-->
<Target Name="CleanCustomAction">
<Delete Files="$(IntermediateOutputPath)$(TargetCAFileName)"
TreatErrorsAsWarnings="true" />
</Target>
<!--
==================================================================================================
AfterCompile (redefinition)
Calls the PackCustomAction target after compiling.
Overrides the empty AfterCompile target from Microsoft.Common.targets.
==================================================================================================
-->
<Target Name="AfterCompile"
DependsOnTargets="PackCustomAction" />
<!--
==================================================================================================
BeforeClean (redefinition)
Calls the CleanCustomAction target before cleaning.
Overrides the empty AfterCompile target from Microsoft.Common.targets.
==================================================================================================
-->
<Target Name="BeforeClean"
DependsOnTargets="CleanCustomAction" />
<Import Project="$(CustomAfterWixCATargets)" Condition=" '$(CustomAfterWixCATargets)' != '' and Exists('$(CustomAfterWixCATargets)')" />
</Project>