-
Notifications
You must be signed in to change notification settings - Fork 355
Expand file tree
/
Copy pathCommon.Build.targets
More file actions
152 lines (128 loc) · 7.07 KB
/
Common.Build.targets
File metadata and controls
152 lines (128 loc) · 7.07 KB
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Common.Build.CSharp.targets" Condition="'$(Language)' == 'C#'" />
<Import Project="Common.Build.VSSDK.targets" Condition="$(UseVSSDK) or $(UseVSSDKTemplateOnly)" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" Condition="'$(Language)' == 'C++'" />
<Import Project="Common.Build.Wix.targets" Condition="'$(Language)' == 'WiX'" />
<!--
Transforms ProjectReference2 items into references that will be built
but are not used as build references.
-->
<Target Name="_HandleProjectReferences"
BeforeTargets="AssignProjectConfiguration">
<ItemGroup>
<ProjectReference Include="@(ProjectReference2)">
<Name Condition="'%(ProjectReference2.Name)' != ''">%(ProjectReference2.Name)</Name>
<Name Condition="'%(ProjectReference2.Name)' == ''">%(ProjectReference2.Filename)</Name>
</ProjectReference>
</ItemGroup>
</Target>
<Target Name="_GetEmptyGroup" Returns="_EmptyGroup" />
<!--
Gets all the content files to include in a VSIX from this project and any
other referenced projects.
This allows projects to be referenced for their deployable content without
forcing a C# assembly reference (or errors/warnings when no reference exists).
-->
<Target Name="_GetVSIXSourceProjects">
<ItemGroup>
<_VSIXSourceProjects Include="@(ProjectReference2)" />
<_VSIXSourceProjects Include="@(ProjectReference)" Condition="'%(ProjectReference.IncludeInVSIX)' == 'true'" />
</ItemGroup>
</Target>
<Target Name="GetVSIXSourceItems"
DependsOnTargets="PrepareForBuild;AssignProjectConfiguration;_GetVSIXSourceProjects"
Returns="@(VSIXSourceItem)">
<MSBuild Projects="@(_VSIXSourceProjects)"
Targets="GetVSIXSourceItems"
Properties="Configuration=$(Configuration)">
<Output TaskParameter="TargetOutputs" ItemName="_VSIXSourceItem"/>
</MSBuild>
<CallTarget Targets="$(IncludeVSIXItemsFromTargets)" UseResultsCache="true">
<Output TaskParameter="TargetOutputs" ItemName="_VSIXSourceItem"/>
</CallTarget>
<PropertyGroup Condition="'@(AppConfigWithTargetPath)' != ''">
<_AppConfigFullPath>@(AppConfigWithTargetPath->'%(TargetPath)')</_AppConfigFullPath>
<_AppConfigFullPath Condition="!$([System.IO.Path]::IsPathRooted($(_AppConfigFullPath)))">$(OutDir)$(_AppConfigFullPath)</_AppConfigFullPath>
</PropertyGroup>
<ItemGroup>
<!-- Ensure we include the correct app.config file. -->
<_VSIXSourceItem Remove="$(MSBuildProjectDirectory)\app.config" />
<_VSIXSourceItem Include="$(_AppConfigFullPath)" />
<!-- Include the vsixmanifest -->
<_VSIXSourceItem Include="$(IntermediateVsixManifest)" Condition="'$(CopyVsixManifestToOutput)' == 'true'" />
<!-- Include the pkgdef if required -->
<_VSIXSourceItem Include="$(IntermediateOutputPath)$(TargetName).pkgdef" Condition="'$(IncludePkgdefInVSIXContainer)'=='true' AND '$(GeneratePkgDefFile)'=='true'">
<VSIXSubPath>$(PkgdefVSIXSubPath)</VSIXSubPath>
</_VSIXSourceItem>
<!-- Include any content that was marked for inclusion in the VSIX -->
<_VSIXSourceItem Include="@(Content->'%(FullPath)')" Condition="$([msbuild]::ValueOrDefault(%(Content.IncludeInVSIX), `false`))">
<VSIXSubPath Condition="'%(Content.VSIXSubPath)' == ''">%(Content.RelativeDir)</VSIXSubPath>
</_VSIXSourceItem>
<!-- Ensure VSIXSubPath is empty or ends in a backslash -->
<_VSIXSourceItem>
<VSIXSubPath Condition="'%(_VSIXSourceItem.VSIXSubPath)' == '.'"></VSIXSubPath>
<VSIXSubPath Condition="'%(_VSIXSourceItem.VSIXSubPath)' != '' and '%(_VSIXSourceItem.VSIXSubPath)' != '.' and !HasTrailingSlash(%(_VSIXSourceItem.VSIXSubPath))">%(_VSIXSourceItem.VSIXSubPath)\</VSIXSubPath>
</_VSIXSourceItem>
<!-- Take TemplateSubPath properties into account -->
<_VSIXSourceItem>
<VSIXSubPath Condition="'%(_VSIXSourceItem.TemplateSubPath)' != ''">%(_VSIXSourceItem.VSIXSubPath)%(_VSIXSourceItem.TemplateSubPath)</VSIXSubPath>
<VSIXSubPath Condition="'%(_VSIXSourceItem.TemplateSubPath)' != '' and !HasTrailingSlash(%(_VSIXSourceItem.TemplateSubPath))">%(_VSIXSourceItem.VSIXSubPath)%(_VSIXSourceItem.TemplateSubPath)\</VSIXSubPath>
<TemplateSubPath></TemplateSubPath>
</_VSIXSourceItem>
</ItemGroup>
<RemoveDuplicates Inputs="@(_VSIXSourceItem)">
<Output TaskParameter="Filtered" ItemName="VSIXSourceItem"/>
</RemoveDuplicates>
<Message Text="Dependencies from $(MSBuildProjectName):
@(VSIXSourceItem->'%(VSIXSubPath)%(Filename)%(Extension)', '
')" Importance="normal" />
</Target>
<!--
To actually copy references to the output directory, set
CopyLocalReferenceVsixItems to true.
This should be used for tools and tests only. Release packages should not ever
need this.
-->
<Target Name="_CopyReferenceVSIXDependencies"
DependsOnTargets="GetVSIXSourceItems"
Condition="$(CopyLocalReferenceVsixItems)"
Inputs="@(VSIXSourceItem)"
Outputs="@(VSIXSourceItem->'$(OutDir)%(VSIXSubPath)\%(Filename)%(Extension)')"
AfterTargets="AfterBuild">
<Copy SourceFiles="@(VSIXSourceItem)"
DestinationFiles="@(VSIXSourceItem->'$(OutDir)%(VSIXSubPath)\%(Filename)%(Extension)')"
SkipUnchangedFiles="true" />
</Target>
<!-- Gets the output location of debug symbols.
VS 2010 moves PDB files rather than copying, and so the usual target will fail.
-->
<Target Name="DebugSymbolsFinalOutputProjectOutputGroup"
DependsOnTargets="DebugSymbolsProjectOutputGroup"
Returns="@(_DebugSymbolsFinalOutputProjectOutputGroupOutput)">
<ItemGroup>
<_DebugSymbolsFinalOutputProjectOutputGroupOutput Include="@(DebugSymbolsProjectOutputGroupOutput->'%(FinalOutputPath)'" />
</ItemGroup>
</Target>
<!--
Copies certain outputs from the project to the specified path.
This is used when building releases.
-->
<Target Name="_CopyOutputsToPath"
AfterTargets="AfterBuild"
DependsOnTargets="BuiltProjectOutputGroup;DebugSymbolsFinalOutputProjectOutputGroup"
Condition="'$(CopyOutputsToPath)' != '' and $(MSBuildProjectExtension) != '.wixproj' and Exists($(TargetPath))">
<PropertyGroup>
<CopyOutputsToPath Condition="!HasTrailingSlash($(CopyOutputsToPath))">$(CopyOutputsToPath)\</CopyOutputsToPath>
</PropertyGroup>
<MakeDir Directories="$(CopyOutputsToPath)UnsignedBinaries;$(CopyOutputsToPath)Symbols"
ContinueOnError="true" />
<Copy SourceFiles="$(TargetPath)"
DestinationFiles="$(CopyOutputsToPath)UnsignedBinaries\$(TargetName)$(TargetExt)"
SkipUnchangedFiles="true" />
<Copy SourceFiles="@(DebugSymbolsProjectOutputGroupOutput->'%(FinalOutputPath)')"
DestinationFolder="$(CopyOutputsToPath)Symbols" />
<Copy SourceFiles="@(OutputBinariesToSign -> '$(OutputPath)%(filename)%(extension)')"
DestinationFolder="$(CopyOutputsToPath)UnsignedBinaries"
Condition="'@(OutputBinariesToSign)' != ''"/>
</Target>
</Project>