-
Notifications
You must be signed in to change notification settings - Fork 48
/
Microsoft.WebApplication.targets
366 lines (309 loc) · 17.7 KB
/
Microsoft.WebApplication.targets
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
<!--
***********************************************************************************************
Microsoft.WebApplication.targets
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 web deploy projects from the command-line or the IDE.
This file defines the steps in the standard build process for web application projects.
Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="Microsoft.WebApplication.Build.Tasks.GetSilverlightItemsFromProperty" AssemblyFile="Microsoft.WebApplication.Build.Tasks.dll" />
<UsingTask TaskName="Microsoft.WebApplication.Build.Tasks.CopyFilesToFolders" AssemblyFile="Microsoft.WebApplication.Build.Tasks.dll" />
<PropertyGroup>
<IsDesktopBuild Condition="'$(IsDesktopBuild)'=='' And '$(TeamFoundationServerUrl)' != ''">False</IsDesktopBuild>
<WebProjectOutputDirInsideProjectDefault>True</WebProjectOutputDirInsideProjectDefault>
<WebProjectOutputDirInsideProjectDefault Condition="('$(OutDir)' != '$(OutputPath)') Or ('$(IsDesktopBuild)' == 'False')" >False</WebProjectOutputDirInsideProjectDefault>
<WebProjectOutputDirInsideProject Condition="'$(WebProjectOutputDirInsideProject)' == ''">$(WebProjectOutputDirInsideProjectDefault)</WebProjectOutputDirInsideProject>
<WebProjectOutputDir>$(MSBuildProjectDirectory)</WebProjectOutputDir>
<WebProjectOutputDir Condition="!$(WebProjectOutputDirInsideProject)">$(OutDir)_PublishedWebsites\$(MSBuildProjectName)</WebProjectOutputDir>
<DisableLinkInCopyWebApplicaton Condition="'$(DisableLinkInCopyWebApplicaton)'==''">False</DisableLinkInCopyWebApplicaton>
<Disable_CopyWebApplication Condition="'$(Disable_CopyWebApplication)' == ''">False</Disable_CopyWebApplication>
<UseWPP_CopyWebApplication Condition="'$(UseWPP_CopyWebApplication)' == ''">False</UseWPP_CopyWebApplication>
<CleanWebProjectOutputDir>True</CleanWebProjectOutputDir>
<CleanWebProjectOutputDir Condition="$(WebProjectOutputDirInsideProject)" >False</CleanWebProjectOutputDir>
</PropertyGroup>
<PropertyGroup>
<PrepareForRunDependsOn>
$(PrepareForRunDependsOn);
CopySilverlightApplications;
_CopyBinDeployableAssemblies;
</PrepareForRunDependsOn>
<PrepareForRunDependsOn Condition="!$(Disable_CopyWebApplication)">
$(PrepareForRunDependsOn);
_CopyWebApplication;
_BuiltWebOutputGroupOutput
</PrepareForRunDependsOn>
</PropertyGroup>
<!--***************************************************************-->
<!--Global setting for Clean target -->
<!--***************************************************************-->
<PropertyGroup>
<CleanDependsOn>
$(CleanDependsOn);
CleanWebProjectOutputDir;
</CleanDependsOn>
</PropertyGroup>
<!--********************************************************************-->
<!-- CleanWebProjectOutputDir -->
<!-- ********************************************************************-->
<PropertyGroup>
<CleanWebProjectOutputDirDependsOn Condition="'$(CleanWebProjectOutputDirDependsOn)' == ''">
</CleanWebProjectOutputDirDependsOn>
</PropertyGroup>
<Target Name="CleanWebProjectOutputDir"
Condition="$(CleanWebProjectOutputDir)"
DependsOnTargets="$(CleanWebProjectOutputDirDependsOn)">
<!--Assertion check-->
<!--In the case of Clean Packaging/Publish, we simply delete the WebProjectOutputDir-->
<RemoveDir Condition="Exists($(WebProjectOutputDir))" Directories="$(WebProjectOutputDir)" ContinueOnError="true" />
</Target>
<!--
============================================================
_CopyWebApplication
This target will copy the build outputs along with the
content files into a _PublishedWebsites folder.
This Task is only necessary when $(OutDir) has been redirected
to a folder other than ~\bin such as is the case with Team Build.
The original _CopyWebApplication is now a Legacy, you can still use it by setting $(UseWPP_CopyWebApplication) to true.
By default, it now change to use _WPPCopyWebApplication target in Microsoft.Web.Publish.targets. It allow to leverage the web.config trsnaformation.
============================================================
-->
<PropertyGroup>
<!--This will be overwrite by ..\web\Microsoft.Web.Publishing.targets when $(UseWPP_CopyWebApplication) set to true-->
<OnBefore_CopyWebApplicationDefault>
_CopyWebApplicationLegacy;
</OnBefore_CopyWebApplicationDefault>
<OnBefore_CopyWebApplicationDefault Condition="$(UseWPP_CopyWebApplication) AND Exists('$(MSBuildThisFileDirectory)\..\Web\Microsoft.Web.Publishing.targets')">
_WPPCopyWebApplication;
</OnBefore_CopyWebApplicationDefault>
<OnBefore_CopyWebApplication Condition="'$(OnBefore_CopyWebApplication)'==''">
$(OnBefore_CopyWebApplicationDefault);
</OnBefore_CopyWebApplication>
<OnAfter_CopyWebApplication Condition="'$(OnAfter_CopyWebApplication)'==''">
</OnAfter_CopyWebApplication>
<_CopyWebApplicationDependsOn Condition="'$(_CopyWebApplicationDependsOn)'==''">
$(OnBefore_CopyWebApplication);
</_CopyWebApplicationDependsOn>
</PropertyGroup>
<Target Name="_CopyWebApplication"
Condition="!$(Disable_CopyWebApplication) And '$(OutDir)' != '$(OutputPath)'"
DependsOnTargets="$(_CopyWebApplicationDependsOn)">
<CallTarget Condition="'$(OnAfter_CopyWebApplication)' != ''" Targets="$(OnAfter_CopyWebApplication)" RunEachTargetSeparately="true" />
</Target>
<!--
============================================================
_CopyWebApplicationLegacy
This target will copy the build outputs along with the
content files into a _PublishedWebsites folder.
This Task is only necessary when $(OutDir) has been redirected
to a folder other than ~\bin such as is the case with Team Build.
============================================================
-->
<Target Name="_CopyWebApplicationLegacy" Condition="!$(Disable_CopyWebApplication) And '$(OutDir)' != '$(OutputPath)'" >
<!-- Log tasks -->
<Message Text="Copying Web Application Project Files for $(MSBuildProjectName)" />
<!-- Create the _PublishedWebsites\app\bin folder -->
<MakeDir Directories="$(WebProjectOutputDir)\bin" />
<!-- Copy build outputs to _PublishedWebsites\app\bin folder -->
<Copy SourceFiles="@(IntermediateAssembly)" DestinationFolder="$(WebProjectOutputDir)\bin"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="@(AddModules)"
DestinationFolder="$(WebProjectOutputDir)\bin"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="$(IntermediateOutputPath)$(_SGenDllName)"
DestinationFolder="$(WebProjectOutputDir)\%(Content.SubFolder)%(Content.RecursiveDir)"
SkipUnchangedFiles="true"
Condition="'$(_SGenDllCreated)'=='true'"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="$(IntermediateOutputPath)$(TargetName).pdb"
DestinationFolder="$(WebProjectOutputDir)\bin"
SkipUnchangedFiles="true"
Condition="'$(_DebugSymbolsProduced)'=='true'"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="@(DocFileItem)"
DestinationFolder="$(WebProjectOutputDir)\bin"
SkipUnchangedFiles="true"
Condition="'$(_DocumentationFileProduced)'=='true'"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="@(IntermediateSatelliteAssembliesWithTargetPath)"
DestinationFiles="@(IntermediateSatelliteAssembliesWithTargetPath->'$(WebProjectOutputDir)\bin\%(Culture)\$(TargetName).resources.dll')"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="@(ReferenceComWrappersToCopyLocal); @(ResolvedIsolatedComModules); @(_DeploymentLooseManifestFile); @(NativeReferenceFile)"
DestinationFolder="$(WebProjectOutputDir)\bin"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<!-- copy any referenced assemblies to _PublishedWebsites\app\bin folder -->
<Copy SourceFiles="@(ReferenceCopyLocalPaths)"
DestinationFiles="@(ReferenceCopyLocalPaths->'$(WebProjectOutputDir)\bin\%(DestinationSubDirectory)%(Filename)%(Extension)')"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<!-- Copy content files recursively to _PublishedWebsites\app\ folder -->
<Copy SourceFiles="@(Content)" Condition="'%(Content.Link)' == ''"
DestinationFolder="$(WebProjectOutputDir)\%(Content.RelativeDir)"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)" />
<Copy SourceFiles="@(Content)" Condition="!$(DisableLinkInCopyWebApplicaton) And '%(Content.Link)' != ''"
DestinationFiles="$(WebProjectOutputDir)\%(Content.Link)"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<!-- Copy items that have been marked to be copied to the bin folder -->
<Copy SourceFiles="@(_SourceItemsToCopyToOutputDirectory)"
DestinationFolder="$(WebProjectOutputDir)\bin"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="@(_SourceItemsToCopyToOutputDirectoryAlways)"
DestinationFolder="$(WebProjectOutputDir)\bin"
SkipUnchangedFiles="false"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<!-- Copy Silverlight Zip and Xzp file to _PublishedWebsites\app\ folder-->
<Copy SourceFiles="@(_WebApplicationSilverlightXapFiles)"
DestinationFolder="$(WebProjectOutputDir)\%(_WebApplicationSilverlightXapFiles.RelativeDir)"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<!-- Copy items that need to be bin deployed to the bin folder -->
<Copy SourceFiles="@(_binDeployableAssemblies)"
DestinationFolder="$(WebProjectOutputDir)\bin\%(RecursiveDir)"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
</Target>
<!--
============================================================
_BuiltWebOutputGroupOutput
This target creates and populates BuiltWebOutputGroupOutput
with contents of bin along with the @(Content) files
============================================================
-->
<Target Name ="_BuiltWebOutputGroupOutput"
Condition="!$(Disable_CopyWebApplication)"
Outputs="@(BuiltWebOutputGroupOutput)">
<CreateItem Include="$(WebProjectOutputDir)\bin\**\*.*;@(Content->'%(FullPath)')" Condition="'$(OutDir)' == '$(OutputPath)'">
<Output ItemName="BuiltWebOutputGroupOutput" TaskParameter="Include"/>
</CreateItem>
<CreateItem Include="$(WebProjectOutputDir)\**\*.*" Condition="'$(OutDir)' != '$(OutputPath)'">
<Output ItemName="BuiltWebOutputGroupOutput" TaskParameter="Include"/>
</CreateItem>
</Target>
<!--
============================================================
_GetSilverlightApplications
Converts the list of Silverlight Applications that are defined
in the property $(SilverlightApplicationList) to ITaskItems that
can be used by teh CopySilverlightApplication task
The format of $(SilverlightApplicationList) is:
{projGuid}|relPath|tgtFolder;{projGuid2}|relPathToProject2|tgtFolder2;...
============================================================
-->
<Target
Name="_GetSilverlightApplications"
Condition="'$(SilverlightApplicationList)' != ''">
<GetSilverlightItemsFromProperty
SilverlightReferences="$(SilverlightApplicationList)"
ProjectPath="$(MSBuildProjectFullPath)">
<Output TaskParameter="SilverlightApplications" ItemName="_AllSilverlightApplications"/>
</GetSilverlightItemsFromProperty>
<!-- Break the silverlight application list into two lists: those that exist on disk and those that don't. -->
<ItemGroup>
<_SilverlightApplications Include="@(_AllSilverlightApplications)" Condition="Exists('%(Identity)')"/>
<_SilverlightApplicationsNotExist Include="@(_AllSilverlightApplications)" Condition="!Exists('%(Identity)')"/>
</ItemGroup>
</Target>
<!--
============================================================
CopySilverlightApplications
This target copies the output xap files from referenced
Silverlight application projects to the target folder.
============================================================
-->
<Target
Name="CopySilverlightApplications"
DependsOnTargets="_GetSilverlightApplications"
Outputs="@(_WebApplicationSilverlightXapFiles)"
Condition="'$(BuildingInsideVisualStudio)' != 'true'">
<!--
When building this project from the IDE or when building a .SLN from the command-line,
just gather the referenced build outputs (Xap files). The code that builds the .SLN will already have
built the project, so there's no need to do it again here.
The ContinueOnError setting is here so that, during project load, as
much information as possible will be passed to the compilers.
-->
<MSBuild
Projects="@(_SilverlightApplications)"
Targets="GetXapOutputFile"
BuildInParallel= "false"
Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration);%(_MSBuildProjectReferenceExistent.SetPlatform);BuildingSolutionFile=false"
Condition="'@(_SilverlightApplications)' != ''"
ContinueOnError="!$(BuildingProject)">
<Output TaskParameter="TargetOutputs" ItemName="_SilverlightXapFiles"/>
</MSBuild>
<!--
Build referenced projects when building from the command line.
The $(ProjectReferenceBuildTargets) will normally be blank so that the project's default
target is used during a P2P reference. However if a custom build process requires that
the referenced project has a different target to build it can be specified.
-->
<MSBuild
Projects="@(_SilverlightApplications)"
Targets="$(ProjectReferenceBuildTargets)"
Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration);%(_MSBuildProjectReferenceExistent.SetPlatform);BuildingSolutionFile=false"
BuildInParallel="false"
Condition="'$(BuildingInsideVisualStudio)' != 'true' and '@(_SilverlightApplications)' != ''">
</MSBuild>
<!--Copy the outputs to the target folder-->
<CopyFilesToFolders SourceFiles="@(_SilverlightXapFiles)"
SilverlightApplications="@(_SilverlightApplications)"
ConfigName="$(Configuration)"
Condition="'@(_SilverlightXapFiles)' != ''">
<Output TaskParameter="DestinationFiles" ItemName="_WebApplicationSilverlightXapFiles" />
</CopyFilesToFolders>
<!-- Issue a warning for each non-existent project. -->
<Warning
Text="The referenced Silverlight project '%(_SilverlightApplicationsNotExist.Identity)' does not exist."
Condition="'@(_SilverlightApplicationsNotExist)'!=''"/>
</Target>
<!--
============================================================
_CopyBinDeployableAssemblies
This target copies the contents of ProjectDir\_bin_deployableAssemblies to the bin
folder, preserving the relative paths
============================================================
-->
<Target
Name="_CopyBinDeployableAssemblies"
Condition="Exists('$(MSBuildProjectDirectory)\_bin_deployableAssemblies')">
<CreateItem Include="$(MSBuildProjectDirectory)\_bin_deployableAssemblies\**\*.*" Condition="Exists('$(MSBuildProjectDirectory)\_bin_deployableAssemblies')">
<Output ItemName="_binDeployableAssemblies" TaskParameter="Include"/>
</CreateItem>
<Copy SourceFiles="@(_binDeployableAssemblies)" DestinationFolder="$(OutDir)\%(RecursiveDir)"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
</Target>
<!--Import publishing target-->
<Import Project="..\Web\Microsoft.Web.Publishing.targets" Condition="Exists('..\Web\Microsoft.Web.Publishing.targets')" />
<!--Ensure the Siliverlight zap file is created and copied to the bin folder for the Microsoft.Web.Publishing.targets-->
<PropertyGroup>
<OnBeforePipelineCollectFilesPhase>
$(OnBeforePipelineCollectFilesPhase);
CopySilverlightApplications;
</OnBeforePipelineCollectFilesPhase>
</PropertyGroup>
</Project>