9bdae58be0581c783f3fc5012791ba711c7aea65
[platform/core/dotnet/build-tools.git] /
1 <!--\r
2 ***********************************************************************************************\r
3 Microsoft.NET.Sdk.Publish.CopyFiles.targets\r
4 \r
5 WARNING:  DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have\r
6           created a backup copy.  Incorrect changes to this file will make it\r
7           impossible to load or build your web deploy projects from the command-line or the IDE.\r
8 \r
9 This file defines the steps in the standard package/publish process for collecting only files to run the web appliation.\r
10 \r
11 Copyright (C) Microsoft Corporation. All rights reserved.\r
12 ***********************************************************************************************\r
13 -->\r
14 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
15 \r
16   <PropertyGroup>\r
17     <_DotNetPublishCopyFiles>\r
18       _RemoveExcludeFiles;\r
19       _DeletePublishIntermediateOutputPath;\r
20       _CopyFilesToPublishIntermediateOutputPath;\r
21       _CopyAspNetCoreFilesToIntermediateOutputPath;\r
22       _CopyWebJobFilesToIntermediateOutputPath;\r
23     </_DotNetPublishCopyFiles>\r
24   </PropertyGroup>\r
25 \r
26 \r
27   <!--********************************************************************-->\r
28   <!-- Target _RemoveExcludeFiles -->\r
29   <!--********************************************************************-->\r
30   <Target Name="_RemoveExcludeFiles" >\r
31     \r
32     <ItemGroup>\r
33       <DotNetPublishFiles Remove="@(DotNetPublishFiles)"  Condition="'%(Exclude)' == 'true'" />\r
34     </ItemGroup>\r
35     \r
36   </Target>\r
37 \r
38   <!--********************************************************************-->\r
39   <!-- Target _DeletePublishIntermediateOutputPath -->\r
40   <!--********************************************************************-->\r
41 \r
42   <Target Name="_DeletePublishIntermediateOutputPath">\r
43 \r
44     <!-- Remove all the files from the temp directory first-->\r
45     <ItemGroup>\r
46       <_PublishTempFiles Include="$(PublishIntermediateOutputPath)**\*.*" />\r
47     </ItemGroup>\r
48 \r
49     <Delete Files="@(_PublishTempFiles)" ContinueOnError="true" />\r
50     <RemoveDir Directories="$(PublishIntermediateOutputPath)" ContinueOnError="true" Condition="Exists('$(PublishIntermediateOutputPath)')" />\r
51     <MakeDir Directories="$(PublishIntermediateOutputPath)" Condition="!Exists('$(PublishIntermediateOutputPath)')"/>\r
52 \r
53   </Target>\r
54          \r
55   \r
56   <!--********************************************************************-->\r
57   <!-- Target _CopyAllFilesToPublishIntermediateOutputPath -->\r
58   <!--********************************************************************-->\r
59   <Target Name="_CopyFilesToPublishIntermediateOutputPath">\r
60     \r
61     <Copy\r
62     SourceFiles="@(DotNetPublishFiles)"\r
63     DestinationFiles="@(DotNetPublishFiles ->'$(PublishIntermediateOutputPath)%(DestinationRelativePath)')"  />\r
64     \r
65   </Target>\r
66   \r
67   <!--********************************************************************-->\r
68   <!-- Target _CopyAspNetCoreFilesToIntermediateOutputPath -->\r
69   <!--********************************************************************-->\r
70   <PropertyGroup>\r
71     <_CopyAspNetCoreFilesToIntermediateOutputPathDependsOn>\r
72       $(_CopyAspNetCoreFilesToIntermediateOutputPathDependsOn);\r
73       _PrepareForAspNetCoreProjectSystemPublish;\r
74       Publish;\r
75     </_CopyAspNetCoreFilesToIntermediateOutputPathDependsOn>\r
76   </PropertyGroup>\r
77   \r
78   <Target Name="_CopyAspNetCoreFilesToIntermediateOutputPath" \r
79     Condition="'$(_PublishProjectType)' == 'AspNetCore'"\r
80     DependsOnTargets="$(_CopyAspNetCoreFilesToIntermediateOutputPathDependsOn)">\r
81   </Target>\r
82 \r
83   <!--********************************************************************-->\r
84   <!-- Target _PrepareForAspNetCoreProjectSystemPublish -->\r
85   <!--********************************************************************-->\r
86   <Target Name="_PrepareForAspNetCoreProjectSystemPublish">\r
87     <PropertyGroup>\r
88       <PublishDir>$(PublishIntermediateOutputPath)</PublishDir>\r
89       <Configuration>$(PublishConfiguration)</Configuration>\r
90     </PropertyGroup>\r
91   </Target>\r
92   \r
93    <!--********************************************************************-->\r
94   <!-- Target _CopyWebJobFilesToIntermediateOutputPath -->\r
95   <!--********************************************************************-->\r
96   <PropertyGroup>\r
97     <_CopyWebJobFilesToIntermediateOutputPathDependsOn>\r
98       $(_CopyWebJobFilesToIntermediateOutputPathDependsOn);\r
99       _PrepareForWebJobPublish;\r
100       Publish;\r
101     </_CopyWebJobFilesToIntermediateOutputPathDependsOn>\r
102   </PropertyGroup>\r
103 \r
104   <Target Name="_CopyWebJobFilesToIntermediateOutputPath"\r
105     Condition="'$(_PublishProjectType)' == 'WebJob'"\r
106     DependsOnTargets="$(_CopyWebJobFilesToIntermediateOutputPathDependsOn)">\r
107   </Target>\r
108 \r
109   <!--********************************************************************-->\r
110   <!-- Target _PrepareForWebJobPublish -->\r
111   <!--********************************************************************-->\r
112   <Target Name="_PrepareForWebJobPublish">\r
113     <PropertyGroup>\r
114       <PublishDir>$(PublishIntermediateOutputPath)\app_data\Jobs\$(WebJobType)\$(WebJobName)\</PublishDir>\r
115       <Configuration>$(PublishConfiguration)</Configuration>\r
116     </PropertyGroup>\r
117   </Target>\r
118 \r
119   <!--********************************************************************-->\r
120   <!-- This will ensure that all values have the required metadata -->\r
121   <!--********************************************************************-->\r
122   <ItemDefinitionGroup>\r
123     <DotNetPublishFiles>\r
124       <DestinationRelativePath></DestinationRelativePath>\r
125       <Exclude>False</Exclude>\r
126     </DotNetPublishFiles>\r
127   </ItemDefinitionGroup>\r
128 \r
129 </Project>\r