1+
2+ <Project DefaultTargets =" Build" xmlns =" http://schemas.microsoft.com/developer/msbuild/2003" >
3+ <PropertyGroup >
4+ <IsDesktopBuild Condition =" '$(IsDesktopBuild)'=='' And '$(TeamFoundationServerUrl)' != ''" >False</IsDesktopBuild >
5+ <WebProjectOutputDirInsideProjectDefault >True</WebProjectOutputDirInsideProjectDefault >
6+ <WebProjectOutputDirInsideProjectDefault Condition =" ('$(OutDir)' != '$(OutputPath)') Or ('$(IsDesktopBuild)' == 'False')" >False</WebProjectOutputDirInsideProjectDefault >
7+ <WebProjectOutputDirInsideProject Condition =" '$(WebProjectOutputDirInsideProject)' == ''" >$(WebProjectOutputDirInsideProjectDefault)</WebProjectOutputDirInsideProject >
8+ <DisableLinkInCopyWebApplicaton Condition =" '$(DisableLinkInCopyWebApplicaton)'==''" >False</DisableLinkInCopyWebApplicaton >
9+ <Disable_CopyWebApplication Condition =" '$(Disable_CopyWebApplication)' == ''" >False</Disable_CopyWebApplication >
10+ <UseWPP_CopyWebApplication Condition =" '$(UseWPP_CopyWebApplication)' == ''" >False</UseWPP_CopyWebApplication >
11+ <CleanWebProjectOutputDir >True</CleanWebProjectOutputDir >
12+ <CleanWebProjectOutputDir Condition =" $(WebProjectOutputDirInsideProject)" >False</CleanWebProjectOutputDir >
13+ </PropertyGroup >
14+
15+ <!-- Only setup $(WebProjectOutputDir) iff user haven't set it up-->
16+ <PropertyGroup Condition =" '$(WebProjectOutputDir)'==''" >
17+ <WebProjectOutputDir >$(MSBuildProjectDirectory)</WebProjectOutputDir >
18+ <WebProjectOutputDir Condition =" !$(WebProjectOutputDirInsideProject)" >$(OutDir)_PublishedWebsites\$(MSBuildProjectName)</WebProjectOutputDir >
19+ </PropertyGroup >
20+
21+ <PropertyGroup >
22+ <PrepareForRunDependsOn >
23+ $(PrepareForRunDependsOn);
24+ _CopyBinDeployableAssemblies;
25+ </PrepareForRunDependsOn >
26+ <PrepareForRunDependsOn Condition =" !$(Disable_CopyWebApplication)" >
27+ $(PrepareForRunDependsOn);
28+ _CopyWebApplication;
29+ _BuiltWebOutputGroupOutput
30+ </PrepareForRunDependsOn >
31+ </PropertyGroup >
32+
33+ <!-- ***************************************************************-->
34+ <!-- Global setting for Clean target -->
35+ <!-- ***************************************************************-->
36+ <PropertyGroup >
37+ <CleanDependsOn >
38+ $(CleanDependsOn);
39+ CleanWebProjectOutputDir;
40+ </CleanDependsOn >
41+ </PropertyGroup >
42+
43+ <!-- ********************************************************************-->
44+ <!-- CleanWebProjectOutputDir -->
45+ <!-- ********************************************************************-->
46+ <PropertyGroup >
47+ <CleanWebProjectOutputDirDependsOn Condition =" '$(CleanWebProjectOutputDirDependsOn)' == ''" >
48+ </CleanWebProjectOutputDirDependsOn >
49+ </PropertyGroup >
50+ <Target Name =" CleanWebProjectOutputDir"
51+ Condition =" $(CleanWebProjectOutputDir)"
52+ DependsOnTargets =" $(CleanWebProjectOutputDirDependsOn)" >
53+ <!-- Assertion check-->
54+ <!-- In the case of Clean Packaging/Publish, we simply delete the WebProjectOutputDir-->
55+ <RemoveDir Condition =" Exists($(WebProjectOutputDir))" Directories =" $(WebProjectOutputDir)" ContinueOnError =" true" />
56+ </Target >
57+
58+ <!--
59+ ============================================================
60+ _CopyWebApplication
61+
62+ This target will copy the build outputs along with the
63+ content files into a _PublishedWebsites folder.
64+
65+ This Task is only necessary when $(OutDir) has been redirected
66+ to a folder other than ~\bin such as is the case with Team Build.
67+
68+ The original _CopyWebApplication is now a Legacy, you can still use it by setting $(UseWPP_CopyWebApplication) to true.
69+ By default, it now change to use _WPPCopyWebApplication target in Microsoft.Web.Publish.targets. It allow to leverage the web.config trsnaformation.
70+ ============================================================
71+ -->
72+
73+ <PropertyGroup >
74+ <!-- This will be overwrite by ..\web\Microsoft.Web.Publishing.targets when $(UseWPP_CopyWebApplication) set to true-->
75+ <OnBefore_CopyWebApplicationDefault >
76+ _CopyWebApplicationLegacy;
77+ </OnBefore_CopyWebApplicationDefault >
78+ <OnBefore_CopyWebApplicationDefault Condition =" $(UseWPP_CopyWebApplication) AND Exists('$(MSBuildThisFileDirectory)\..\Web\Microsoft.Web.Publishing.targets')" >
79+ _WPPCopyWebApplication;
80+ </OnBefore_CopyWebApplicationDefault >
81+ <OnBefore_CopyWebApplication Condition =" '$(OnBefore_CopyWebApplication)'==''" >
82+ $(OnBefore_CopyWebApplicationDefault);
83+ </OnBefore_CopyWebApplication >
84+
85+ <OnAfter_CopyWebApplication Condition =" '$(OnAfter_CopyWebApplication)'==''" >
86+ </OnAfter_CopyWebApplication >
87+
88+ <_CopyWebApplicationDependsOn Condition =" '$(_CopyWebApplicationDependsOn)'==''" >
89+ $(OnBefore_CopyWebApplication);
90+ </_CopyWebApplicationDependsOn >
91+
92+ </PropertyGroup >
93+ <Target Name =" _CopyWebApplication"
94+ Condition =" !$(Disable_CopyWebApplication) And !$(WebProjectOutputDirInsideProject)"
95+ DependsOnTargets =" $(_CopyWebApplicationDependsOn)" >
96+
97+ <CallTarget Condition =" '$(OnAfter_CopyWebApplication)' != ''" Targets =" $(OnAfter_CopyWebApplication)" RunEachTargetSeparately =" true" />
98+
99+ </Target >
100+
101+ <!--
102+ ============================================================
103+ _CopyWebApplicationLegacy
104+
105+ This target will copy the build outputs along with the
106+ content files into a _PublishedWebsites folder.
107+
108+ This Task is only necessary when $(OutDir) has been redirected
109+ to a folder other than ~\bin such as is the case with Team Build.
110+ ============================================================
111+ -->
112+ <Target Name =" _CopyWebApplicationLegacy" Condition =" !$(Disable_CopyWebApplication) And !$(WebProjectOutputDirInsideProject)" >
113+ <!-- Log tasks -->
114+ <Message Text =" Copying Web Application Project Files for $(MSBuildProjectName)" />
115+
116+ <!-- Create the _PublishedWebsites\app\bin folder -->
117+ <MakeDir Directories =" $(WebProjectOutputDir)\bin" />
118+
119+ <!-- Copy build outputs to _PublishedWebsites\app\bin folder -->
120+ <Copy SourceFiles =" @(IntermediateAssembly)" DestinationFolder =" $(WebProjectOutputDir)\bin"
121+ SkipUnchangedFiles =" true"
122+ Retries =" $(CopyRetryCount)"
123+ RetryDelayMilliseconds =" $(CopyRetryDelayMilliseconds)" />
124+ <Copy SourceFiles =" @(AddModules)"
125+ DestinationFolder =" $(WebProjectOutputDir)\bin"
126+ SkipUnchangedFiles =" true"
127+ Retries =" $(CopyRetryCount)"
128+ RetryDelayMilliseconds =" $(CopyRetryDelayMilliseconds)" />
129+ <Copy SourceFiles =" $(IntermediateOutputPath)$(_SGenDllName)"
130+ DestinationFolder =" $(WebProjectOutputDir)\%(Content.SubFolder)%(Content.RecursiveDir)"
131+ SkipUnchangedFiles =" true"
132+ Condition =" '$(_SGenDllCreated)'=='true'"
133+ Retries =" $(CopyRetryCount)"
134+ RetryDelayMilliseconds =" $(CopyRetryDelayMilliseconds)" />
135+ <Copy SourceFiles =" $(IntermediateOutputPath)$(TargetName).pdb"
136+ DestinationFolder =" $(WebProjectOutputDir)\bin"
137+ SkipUnchangedFiles =" true"
138+ Condition =" '$(_DebugSymbolsProduced)'=='true'"
139+ Retries =" $(CopyRetryCount)"
140+ RetryDelayMilliseconds =" $(CopyRetryDelayMilliseconds)" />
141+ <Copy SourceFiles =" @(DocFileItem)"
142+ DestinationFolder =" $(WebProjectOutputDir)\bin"
143+ SkipUnchangedFiles =" true"
144+ Condition =" '$(_DocumentationFileProduced)'=='true'"
145+ Retries =" $(CopyRetryCount)"
146+ RetryDelayMilliseconds =" $(CopyRetryDelayMilliseconds)" />
147+ <Copy SourceFiles =" @(IntermediateSatelliteAssembliesWithTargetPath)"
148+ DestinationFiles =" @(IntermediateSatelliteAssembliesWithTargetPath->'$(WebProjectOutputDir)\bin\%(Culture)\$(TargetName).resources.dll')"
149+ SkipUnchangedFiles =" true"
150+ Retries =" $(CopyRetryCount)"
151+ RetryDelayMilliseconds =" $(CopyRetryDelayMilliseconds)" />
152+ <Copy SourceFiles =" @(ReferenceComWrappersToCopyLocal); @(ResolvedIsolatedComModules); @(_DeploymentLooseManifestFile); @(NativeReferenceFile)"
153+ DestinationFolder =" $(WebProjectOutputDir)\bin"
154+ SkipUnchangedFiles =" true"
155+ Retries =" $(CopyRetryCount)"
156+ RetryDelayMilliseconds =" $(CopyRetryDelayMilliseconds)" />
157+
158+ <!-- copy any referenced assemblies to _PublishedWebsites\app\bin folder -->
159+ <Copy SourceFiles =" @(ReferenceCopyLocalPaths)"
160+ DestinationFiles =" @(ReferenceCopyLocalPaths->'$(WebProjectOutputDir)\bin\%(DestinationSubDirectory)%(Filename)%(Extension)')"
161+ SkipUnchangedFiles =" true"
162+ Retries =" $(CopyRetryCount)"
163+ RetryDelayMilliseconds =" $(CopyRetryDelayMilliseconds)" />
164+
165+ <!-- Copy content files recursively to _PublishedWebsites\app\ folder -->
166+ <Copy SourceFiles =" @(Content)" Condition =" '%(Content.Link)' == ''"
167+ DestinationFiles =" @(Content -> '$(WebProjectOutputDir)\%(RelativeDir)\%(FileName)%(Extension)')"
168+ SkipUnchangedFiles =" true"
169+ Retries =" $(CopyRetryCount)"
170+ RetryDelayMilliseconds =" $(CopyRetryDelayMilliseconds)" />
171+ <Copy SourceFiles =" @(Content)" Condition =" !$(DisableLinkInCopyWebApplicaton) And '%(Content.Link)' != ''"
172+ DestinationFiles =" @(Content -> '$(WebProjectOutputDir)\%(Link)')"
173+ SkipUnchangedFiles =" true"
174+ Retries =" $(CopyRetryCount)"
175+ RetryDelayMilliseconds =" $(CopyRetryDelayMilliseconds)" />
176+
177+ <!-- Copy items that have been marked to be copied to the bin folder -->
178+ <Copy SourceFiles =" @(_SourceItemsToCopyToOutputDirectory)"
179+ DestinationFiles =" @(_SourceItemsToCopyToOutputDirectory-> '$(WebProjectOutputDir)\bin\%(TargetPath)')"
180+ SkipUnchangedFiles =" true"
181+ Retries =" $(CopyRetryCount)"
182+ RetryDelayMilliseconds =" $(CopyRetryDelayMilliseconds)" />
183+ <Copy SourceFiles =" @(_SourceItemsToCopyToOutputDirectoryAlways)"
184+ DestinationFiles =" @(_SourceItemsToCopyToOutputDirectoryAlways-> '$(WebProjectOutputDir)\bin\%(TargetPath)')"
185+ SkipUnchangedFiles =" false"
186+ Retries =" $(CopyRetryCount)"
187+ RetryDelayMilliseconds =" $(CopyRetryDelayMilliseconds)" />
188+
189+ <!-- Copy items that need to be bin deployed to the bin folder -->
190+ <Copy SourceFiles =" @(_binDeployableAssemblies)"
191+ DestinationFolder =" $(WebProjectOutputDir)\bin\%(_binDeployableAssemblies.DestinationRelPath)"
192+ SkipUnchangedFiles =" true"
193+ Retries =" $(CopyRetryCount)"
194+ RetryDelayMilliseconds =" $(CopyRetryDelayMilliseconds)" />
195+
196+ </Target >
197+
198+ <!--
199+ ============================================================
200+ _BuiltWebOutputGroupOutput
201+
202+ This target creates and populates BuiltWebOutputGroupOutput
203+ with contents of bin along with the @(Content) files
204+ ============================================================
205+ -->
206+ <Target Name =" _BuiltWebOutputGroupOutput"
207+ Condition =" !$(Disable_CopyWebApplication)"
208+ Outputs =" @(BuiltWebOutputGroupOutput)" >
209+ <CreateItem Include =" $(WebProjectOutputDir)\bin\**\*.*;@(Content->'%(FullPath)')" Condition =" '$(OutDir)' == '$(OutputPath)'" >
210+ <Output ItemName =" BuiltWebOutputGroupOutput" TaskParameter =" Include" />
211+ </CreateItem >
212+
213+ <CreateItem Include =" $(WebProjectOutputDir)\**\*.*" Condition =" '$(OutDir)' != '$(OutputPath)'" >
214+ <Output ItemName =" BuiltWebOutputGroupOutput" TaskParameter =" Include" />
215+ </CreateItem >
216+ </Target >
217+
218+ <!--
219+ ============================================================
220+ _CopyBinDeployableAssemblies
221+
222+ This target copies the contents of ProjectDir\_bin_deployableAssemblies to the bin
223+ folder, preserving the relative paths
224+ ============================================================
225+ -->
226+ <Target
227+ Name =" _CopyBinDeployableAssemblies"
228+ Condition =" Exists('$(MSBuildProjectDirectory)\_bin_deployableAssemblies')" >
229+
230+ <PropertyGroup >
231+ <BinDeployableFolder Condition =" '$(BinDeployableFolder)' == ''" >_bin_deployableAssemblies\</BinDeployableFolder >
232+ <BinDeployableFolderFullPath >$([System.IO.Path]::GetFullPath($(BinDeployableFolder)))</BinDeployableFolderFullPath >
233+ </PropertyGroup >
234+
235+ <!-- Pick up the deployable items from the $(None) collection that are under the _bin_deployableAssemblies folder -->
236+ <CreateItem Include =" @(None->'%(Identity)')" Condition =" '%(None.FullPath)' != '' And $([System.String]::new('%(None.FullPath)').StartsWith($(BinDeployableFolderFullPath), StringComparison.OrdinalIgnoreCase ))" >
237+ <Output ItemName =" __binDeployableAssemblies" TaskParameter =" Include" />
238+ </CreateItem >
239+
240+ <!-- Add metadata which holds the destination relative folder to copy them to-->
241+ <ItemGroup >
242+ <_binDeployableAssemblies Include =" @(__binDeployableAssemblies)" Condition =" '@(__binDeployableAssemblies)' != ''" >
243+ <DestinationRelPath >$([System.String]::Concat($([System.IO.Path]::GetDirectoryName($([System.String]::new('%(__binDeployableAssemblies.FullPath)')))),'\').SubString($(BinDeployableFolderFullPath.Length)))</DestinationRelPath >
244+ </_binDeployableAssemblies >
245+ </ItemGroup >
246+
247+ <!-- Do the copy-->
248+ <Copy SourceFiles =" @(_binDeployableAssemblies)" DestinationFolder =" $(OutDir)%(_binDeployableAssemblies.DestinationRelPath)"
249+ SkipUnchangedFiles =" true"
250+ Retries =" $(CopyRetryCount)"
251+ RetryDelayMilliseconds =" $(CopyRetryDelayMilliseconds)" />
252+
253+ <!-- Add the items just copied to the collection of items to delete when doing a clean-->
254+ <ItemGroup >
255+ <FileWrites Include =" @(_binDeployableAssemblies->'$(OutDir)%(DestinationRelPath)%(Filename)%(Extension)')" />
256+ </ItemGroup >
257+ </Target >
258+
259+ <!-- Import publishing target-->
260+ <PropertyGroup >
261+ <AspNetTargetsPath Condition =" '$(AspNetTargetsPath)'=='' " >$(MSBuildThisFileDirectory)..\Web\</AspNetTargetsPath >
262+ </PropertyGroup >
263+
264+ <Import Project =" $(AspNetTargetsPath)Microsoft.Web.Publishing.targets" Condition =" Exists('$(AspNetTargetsPath)Microsoft.Web.Publishing.targets')" />
265+
266+ <!-- Instruct ResolveAssemblyReferences in MS.Common.targets to generate suggested binding redirects. -->
267+ <PropertyGroup >
268+ <AutoUnifyAssemblyReferences >false</AutoUnifyAssemblyReferences >
269+ <AppConfig Condition =" '$(AppConfig)' == '' And Exists('$(ProjectConfigFileName)')" >$(ProjectConfigFileName)</AppConfig >
270+ </PropertyGroup >
271+ </Project >
0 commit comments