blob: 4578c2d8252b1fdfcedac17ecde99cb661205948 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<Import Project="$(CustomBeforeWixCATargets)" Condition=" '$(CustomBeforeWixCATargets)' != '' and Exists('$(CustomBeforeWixCATargets)')" />
<PropertyGroup>
<WixCATargetsImported>true</WixCATargetsImported>
<TargetCAFileName Condition=" '$(TargetCAFileName)' == '' ">$(TargetName).CA$(TargetExt)</TargetCAFileName>
<WixSdkPath Condition=" '$(WixSdkPath)' == '' ">$(MSBuildThisFileDirectory)</WixSdkPath>
<WixSdkX86Path Condition=" '$(WixSdkX86Path)' == '' ">$(WixSdkPath)x86\</WixSdkX86Path>
<WixSdkX64Path Condition=" '$(WixSdkX64Path)' == '' ">$(WixSdkPath)x64\</WixSdkX64Path>
<MakeSfxCA Condition=" '$(MakeSfxCA)' == '' ">$(WixSdkPath)MakeSfxCA.exe</MakeSfxCA>
<SfxCADll Condition=" '$(SfxCADll)' == '' and '$(Platform)' == 'x64' ">$(WixSdkX64Path)SfxCA.dll</SfxCADll>
<SfxCADll Condition=" '$(SfxCADll)' == '' ">$(WixSdkX86Path)SfxCA.dll</SfxCADll>
</PropertyGroup>
<!--
==================================================================================================
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. -->
<ItemGroup>
<CustomActionReferenceContents Include="@(ReferenceCopyLocalPaths)"
Condition=" '%(Extension)' == '.dll' or '%(Extension)' == '.exe' " />
<CustomActionReferenceContents Include="@(ReferenceComWrappersToCopyLocal)"
Condition=" '%(Extension)' == '.dll' or '%(Extension)' == '.exe' " />
<!-- include PDBs for Debug only -->
<CustomActionReferenceContents Include="@(IntermediateAssembly->'%(RootDir)%(Directory)%(Filename).pdb')"
Condition=" Exists('%(RootDir)%(Directory)%(Filename).pdb') and '$(Configuration)' == 'Debug' " />
<CustomActionReferenceContents Include="@(ReferenceCopyLocalPaths)"
Condition=" '%(Extension)' == '.pdb' and '$(Configuration)' == 'Debug' " />
<CustomActionReferenceContents Include="@(ReferenceComWrappersToCopyLocal)"
Condition=" '%(Extension)' == '.pdb' and '$(Configuration)' == 'Debug' " />
</ItemGroup>
<!--
Items to include in the CA package:
- Reference assemblies marked CopyLocal
- Project items of type Content
- Additional items in the CustomActionContents property
-->
<PropertyGroup>
<CustomActionContents>@(CustomActionReferenceContents);@(Content->'%(FullPath)');$(CustomActionContents)</CustomActionContents>
</PropertyGroup>
<ItemGroup>
<IntermediateCAAssembly Include="@(IntermediateAssembly->'%(FullPath)')" />
<IntermediateCAPackage Include="@(IntermediateAssembly->'%(RootDir)%(Directory)$(TargetCAFileName)')" />
</ItemGroup>
<!-- Run the MakeSfxCA.exe CA packaging tool. -->
<Exec Command='"$(MakeSfxCA)" "@(IntermediateCAPackage)" "$(SfxCADll)" "@(IntermediateCAAssembly)" "$(CustomActionContents)"'
WorkingDirectory="$(ProjectDir)" />
<!-- Add modules to be copied to output dir. -->
<ItemGroup>
<AddModules Include="@(IntermediateCAPackage)" />
</ItemGroup>
</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>
|