-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMicrosoft.Web.Publishing.AllFilesInProjectFolder.targets
181 lines (145 loc) · 9.18 KB
/
Microsoft.Web.Publishing.AllFilesInProjectFolder.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
<!--
***********************************************************************************************
Microsoft.Web.Publishing.AllFilesInProjectFolder.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 package/publish process for collecting all files in the project folder.
Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--Import task from our dll-->
<UsingTask TaskName="CollectFilesinFolder" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="EscapeTextForRegularExpressions" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="FilterByItems" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="GetPublishingLocalizedString" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<PropertyGroup>
<PublishPipelineCollectFilesCore>
$(PublishPipelineCollectFilesCore);
CollectFilesFromProjectFolder;
</PublishPipelineCollectFilesCore>
<_CollectFiles_IncludeIgnorableFile Condition="'$(_CollectFiles_IncludeIgnorableFile)'==''">False</_CollectFiles_IncludeIgnorableFile>
<!--Overwrite the default behavior. Don't remove the web.debug.config -->
<ExcludeTransformAssistFilesFromPublish Condition="'$(ExcludeTransformAssistFilesFromPublish)'==''">False</ExcludeTransformAssistFilesFromPublish>
<CollectFilesFromProjectFolder_ExcludeSccFiles Condition="'$(CollectFilesFromProjectFolder_ExcludeSccFiles)'==''">True</CollectFilesFromProjectFolder_ExcludeSccFiles>
</PropertyGroup>
<!--********************************************************************-->
<!-- Task SetExcludeFromProjectFolder -->
<!--********************************************************************-->
<PropertyGroup>
<SetExcludeFromProjectFolderDependsOn Condition="'$(SetExcludeFromProjectFolderDependsOn)'==''">
</SetExcludeFromProjectFolderDependsOn>
</PropertyGroup>
<Target Name="SetExcludeFromProjectFolder"
DependsOnTargets="$(SetExcludeFromProjectFolderDependsOn)">
<!--Get Localized string before display message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_DefaultExcludeIntermediateOutputFolderMessage"
LogType="Message" />
<GetPublishingLocalizedString
ID="PublishLocalizedString_DefaultExcludeFileExtentionOutMessage"
LogType="Message" />
<GetPublishingLocalizedString
ID="PublishLocalizedString_DefaultExcludeSourceControlItems"
LogType="Message" />
<!--Maybe we need to introduce @(_ExcludeFromProjectFolder)-->
<ItemGroup>
<!--Split item to _KnowProjectItems is to keep the metadata for item collection.
Please see http://msdn.microsoft.com/en-us/library/bb629388.aspx for known Project item collection.-->
<_KnownProjectItems Include="@(EmbeddedResource)" />
<_KnownProjectItems Include="@(None)" />
<_KnownProjectItems Include="@(Content)" />
<_KnownProjectItems Include="@(Compile)" />
<!--Explicit exclude all files under the obj folder -->
<_ProjectBaseIntermediateOutputPath Include="$(BaseIntermediateOutputPath)"/>
</ItemGroup>
<!--Create the rgulare expression to exclude all root folder *.out, all folder *.scc and all folder*.vspscc file-->
<!--Note split by semicolon (;)-->
<PropertyGroup>
<_ExcludeRelativePathFromProjectFolder>^[^\\]*\.out$</_ExcludeRelativePathFromProjectFolder>
</PropertyGroup>
<!--Create the rgulare expression to exclude all Intermedidate output path.-->
<EscapeTextForRegularExpressions Text="@(_ProjectBaseIntermediateOutputPath->'%(FullPath)')">
<Output TaskParameter="Result" PropertyName="_ExcludeFullPathFromProjectFolder" />
</EscapeTextForRegularExpressions>
</Target>
<!--********************************************************************-->
<!-- Task CollectFilesFromProjectFolder_ExcludeSccFiles -->
<!--********************************************************************-->
<PropertyGroup>
<!--Targets get execute before this Target-->
<OnBeforeCollectFilesFromProjectFolder_ExcludeSccFiles Condition="'$(OnBeforeCollectFilesFromProjectFolder_ExcludeSccFiles)'==''">
SetExcludeFromProjectFolder;
</OnBeforeCollectFilesFromProjectFolder_ExcludeSccFiles>
<!--Targets get execute after this Target-->
<OnAfterCollectFilesFromProjectFolder_ExcludeSccFiles Condition="'$(OnAfterCollectFilesFromProjectFolder_ExcludeSccFiles)'==''">
</OnAfterCollectFilesFromProjectFolder_ExcludeSccFiles>
<CollectFilesFromProjectFolder_ExcludeSccFilesDependsOn Condition="'$(CollectFilesFromProjectFolder_ExcludeSccFilesDependsOn)'==''">
$(OnBeforeCollectFilesFromProjectFolder_ExcludeSccFiles);
</CollectFilesFromProjectFolder_ExcludeSccFilesDependsOn>
</PropertyGroup>
<Target Name="CollectFilesFromProjectFolder_ExcludeSccFiles"
DependsOnTargets="$(CollectFilesFromProjectFolder_ExcludeSccFilesDependsOn)"
Condition="$(CollectFilesFromProjectFolder_ExcludeSccFiles)">
<!--Note split by semicolon (;)-->
<PropertyGroup>
<_ExcludeRelativePathFromProjectFolder>$(_ExcludeRelativePathFromProjectFolder);[^\\]*\.scc$;[^\\]*\.vssscc$;[^\\]*\.vspscc$</_ExcludeRelativePathFromProjectFolder>
</PropertyGroup>
<CallTarget Targets="$(OnAfterCollectFilesFromProjectFolder_ExcludeSccFiles)" RunEachTargetSeparately="false" />
</Target>
<!--********************************************************************-->
<!-- Task CollectFilesFromProjectFolder -->
<!--********************************************************************-->
<PropertyGroup>
<!--Targets get execute before this Target-->
<OnBeforeCollectFilesFromProjectFolder Condition="'$(OnBeforeCollectFilesFromProjectFolder)'==''">
SetExcludeFromProjectFolder;
CollectFilesFromProjectFolder_ExcludeSccFiles;
</OnBeforeCollectFilesFromProjectFolder>
<!--Targets get execute after this Target-->
<OnAfterCollectFilesFromProjectFolder Condition="'$(OnAfterCollectFilesFromProjectFolder)'==''">
</OnAfterCollectFilesFromProjectFolder>
<CollectFilesFromProjectFolderDependsOn Condition="'$(CollectFilesFromProjectFolderDependsOn)'==''">
$(OnBeforeCollectFilesFromProjectFolder);
</CollectFilesFromProjectFolderDependsOn>
</PropertyGroup>
<Target Name="CollectFilesFromProjectFolder"
DependsOnTargets="$(CollectFilesFromProjectFolderDependsOn)" >
<!--Get Localized string before display message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_GatherAllFilesInProjectFolderExceptExclusion"
LogType="Message" />
<CollectFilesinFolder RootPath="$(WebPublishPipelineProjectDirectory)"
ExcludeFullPathMatchs="$(_ExcludeFullPathFromProjectFolder)"
ExcludeRelativePathMatchs="$(_ExcludeRelativePathFromProjectFolder)" >
<Output TaskParameter="Result" ItemName="_AllFilesUnderProjectFolderNoMetadata" />
</CollectFilesinFolder>
<!--The first two lines keeps the _KnowProjectItem's item metadata-->
<FilterByItems PipelineItems="@(_AllFilesUnderProjectFolderNoMetadata)"
Filter="@(_KnownProjectItems)">
<Output TaskParameter="OutFilter" ItemName="_AllFilesUnderProjectFolderExceptKnownProjectItems"/>
</FilterByItems>
<ItemGroup>
<!--Readd _KnowProjectItem's to keep item metadata. First for non-Link file -->
<FilesForPackagingFromProject Include="@(_KnownProjectItems)" Condition="'%(_KnownProjectItems.Link)'==''">
<DestinationRelativePath>%(_KnownProjectItems.Identity)</DestinationRelativePath>
<FromTarget>CollectFilesFromProjectFolder.KonwnProjectItems</FromTarget>
<Category>AllFilesInProjectFolder</Category>
</FilesForPackagingFromProject>
<FilesForPackagingFromProject Include="@(_KnownProjectItems)" Condition="'%(_KnownProjectItems.Link)'!='' And $(EnableCollectLinkFilesInProject)">
<DestinationRelativePath>%(_KnownProjectItems.Link)</DestinationRelativePath>
<FromTarget>CollectFilesFromProjectFolder.KonwnProjectItems</FromTarget>
<Category>AllFilesInProjectFolder</Category>
<Exclude>$(ExcludeLinkFilesInProject)</Exclude>
<ProjectFileType>Link</ProjectFileType>
</FilesForPackagingFromProject>
<FilesForPackagingFromProject Include="@(_AllFilesUnderProjectFolderExceptKnownProjectItems)" >
<DestinationRelativePath>%(_AllFilesUnderProjectFolderExceptKnownProjectItems.Identity)</DestinationRelativePath>
<FromTarget>CollectFilesFromProjectFolder.ExceptKonwnProjectItems</FromTarget>
<Category>AllFilesInProjectFolder</Category>
</FilesForPackagingFromProject>
</ItemGroup>
<CallTarget Targets="$(OnAfterCollectFilesFromProjectFolder)" RunEachTargetSeparately="false" />
</Target>
</Project>