-
Notifications
You must be signed in to change notification settings - Fork 1k
/
Microsoft.NET.Sdk.Publish.targets
171 lines (134 loc) · 9.25 KB
/
Microsoft.NET.Sdk.Publish.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
<!--
***********************************************************************************************
Microsoft.NET.Sdk.Publish.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 to deploy web application projects.
Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Properties corresponding to the tasks and targets path-->
<PropertyGroup>
<!-- We want to force this property to be true, hence not adding a condition check -->
<SupportsDeployOnBuild>true</SupportsDeployOnBuild>
<_PublishTaskFramework Condition=" '$(MSBuildRuntimeType)' == 'Core'">net5.0</_PublishTaskFramework>
<_PublishTaskFramework Condition=" '$(_PublishTaskFramework)' == ''">net472</_PublishTaskFramework>
<_PublishTasksDir Condition=" '$(_PublishTasksDir)'=='' ">$(MSBuildThisFileDirectory)..\tools\$(_PublishTaskFramework)\</_PublishTasksDir>
<_PublishTaskAssemblyFullPath Condition=" '$(_PublishTaskAssemblyFullPath)'=='' ">$(_PublishTasksDir)Microsoft.NET.Sdk.Publish.Tasks.dll</_PublishTaskAssemblyFullPath>
<_CopyTargetsDir Condition=" '$(_CopyTargetsDir)' == ''">$(MSBuildThisFileDirectory)CopyTargets\</_CopyTargetsDir>
<_TransformTargetsDir Condition=" '$(_TransformTargetsDir)' == ''">$(MSBuildThisFileDirectory)TransformTargets\</_TransformTargetsDir>
<_ComputeTargetsDir Condition=" '$(_ComputeTargetsDir)'=='' ">$(MSBuildThisFileDirectory)ComputeTargets\</_ComputeTargetsDir>
<_PublishTargetsDir Condition=" '$(_PublishTargetsDir)'=='' ">$(MSBuildThisFileDirectory)PublishTargets\</_PublishTargetsDir>
<_DotNetCLIToolTargetsDir Condition=" '$(_DotNetCLIToolTargetsDir)'=='' ">$(MSBuildThisFileDirectory)DotNetCLIToolTargets\</_DotNetCLIToolTargetsDir>
<_PublishProfilesDir Condition=" '$(_PublishProfilesDir)'=='' ">$(MSBuildThisFileDirectory)PublishProfiles\</_PublishProfilesDir>
</PropertyGroup>
<!-- Extension points for BeforePublish and AfterPublish-->
<Target Name="BeforePublish" />
<Target Name="AfterPublish" />
<!--
***********************************************************************************************
Import the Default PublishProfile if the profile is not already imported by the .NET SDK
***********************************************************************************************
-->
<PropertyGroup Condition="'$(PublishProfileImported)' != 'true'">
<PublishProfile Condition="'$(PublishProfile)' ==''">FileSystem</PublishProfile>
<PublishProfileName Condition="'$(PublishProfileName)' == ''">$([System.IO.Path]::GetFileNameWithoutExtension($(PublishProfile)))</PublishProfileName>
</PropertyGroup>
<Import Project="$(_PublishProfilesDir)$(PublishProfileName).pubxml" Condition="Exists('$(_PublishProfilesDir)$(PublishProfileName).pubxml') And '$(PublishProfileImported)' != 'true'" />
<!--
***********************************************************************************************
Set the properties based on PublishProfile properties
***********************************************************************************************
-->
<PropertyGroup>
<!-- Properties for identifying the Publish Protocol -->
<PublishProtocol Condition="'$(PublishProtocol)' == ''">$(WebPublishMethod)</PublishProtocol>
<!-- For backward compat -->
<PublishProtocol Condition="'$(PublishProtocol)' == 'Package'">MSDeployPackage</PublishProtocol>
<!-- For Docker Support -->
<PublishProtocol Condition="'$(DockerPublish)' == 'true'">Docker</PublishProtocol>
<!-- Properties setting the publish intermediate paths -->
<PublishConfiguration Condition ="'$(PublishConfiguration)' == ''">$(LastUsedBuildConfiguration)</PublishConfiguration>
<PublishConfiguration Condition="'$(PublishConfiguration)' == ''">$(Configuration)</PublishConfiguration>
<_PublishConfigurationPath Condition="'$(_PublishConfigurationPath)' == '' And '$(PublishConfiguration)' != ''">$(PublishConfiguration)\</_PublishConfigurationPath>
<_TargetFrameworkPath Condition="'$(_TargetFrameworkPath)' == '' And '$(TargetFramework)' != ''">$(TargetFramework)\</_TargetFrameworkPath>
<_RuntimeIdentifierPath Condition="'$(_RuntimeIdentifierPath)' == '' And '$(RuntimeIdentifier)' != '' ">$(RuntimeIdentifier)\</_RuntimeIdentifierPath>
<BaseIntermediateOutputPath Condition="'$([System.IO.Path]::IsPathRooted($(BaseIntermediateOutputPath)))' == 'False'">$(MSBuildProjectDirectory)\$(BaseIntermediateOutputPath)</BaseIntermediateOutputPath>
<BaseIntermediateOutputPath Condition="!HasTrailingSlash('$(BaseIntermediateOutputPath)')">$(BaseIntermediateOutputPath)\</BaseIntermediateOutputPath>
<PublishIntermediateTempPath Condition="'$(PublishIntermediateTempPath)' == ''">$([System.IO.Path]::GetFullPath($(BaseIntermediateOutputPath)$(_PublishConfigurationPath)$(_TargetFrameworkPath)$(_RuntimeIdentifierPath)PubTmp\))</PublishIntermediateTempPath>
<PublishIntermediateOutputPath Condition="'$(PublishIntermediateOutputPath)' == ''">$(PublishIntermediateTempPath)Out\</PublishIntermediateOutputPath>
<PublishIntermediateOutputPath Condition="'$(DockerPublish)' == 'true'">obj/Docker/publish/</PublishIntermediateOutputPath>
<EFSQLScriptsFolderName Condition="$(EFSQLScriptsFolderName) == ''">EFSQLScripts</EFSQLScriptsFolderName>
</PropertyGroup>
<!--
***********************************************************************************************
Import the Compute target
***********************************************************************************************
-->
<Import Project="$(_ComputeTargetsDir)Microsoft.NET.Sdk.Publish.ComputeFiles.targets" Condition="Exists('$(_ComputeTargetsDir)Microsoft.NET.Sdk.Publish.ComputeFiles.targets')" />
<!--
***********************************************************************************************
Import the Copy target
***********************************************************************************************
-->
<Import Project="$(_CopyTargetsDir)Microsoft.NET.Sdk.Publish.CopyFiles.targets" Condition="Exists('$(_CopyTargetsDir)Microsoft.NET.Sdk.Publish.CopyFiles.targets')"/>
<!--
***********************************************************************************************
Import the transform target
***********************************************************************************************
-->
<Import Project="$(_TransformTargetsDir)Microsoft.NET.Sdk.Publish.TransformFiles.targets" Condition="Exists('$(_TransformTargetsDir)Microsoft.NET.Sdk.Publish.TransformFiles.targets')"/>
<!--
***********************************************************************************************
Import the Protocol target
***********************************************************************************************
-->
<Import Project="$(_PublishTargetsDir)Microsoft.NET.Sdk.Publish.$(PublishProtocol).targets" Condition="Exists('$(_PublishTargetsDir)Microsoft.NET.Sdk.Publish.$(PublishProtocol).targets')"/>
<!--
***********************************************************************************************
Import the DotNetCLITool target
***********************************************************************************************
-->
<Import Project="$(_DotNetCLIToolTargetsDir)Microsoft.NET.Sdk.DotNetCLITool.targets" Condition="Exists('$(_DotNetCLIToolTargetsDir)Microsoft.NET.Sdk.DotNetCLITool.targets')"/>
<!--
***********************************************************************************************
TARGET : DotNetPublish
***********************************************************************************************
-->
<PropertyGroup>
<DotNetPublishDependsOn>
BeforePublish;
CorePublish;
AfterPublish;
</DotNetPublishDependsOn>
</PropertyGroup>
<Target Name="DotNetPublish"
DependsOnTargets="$(DotNetPublishDependsOn)"
AfterTargets="Build"
Condition=" '$(DeployOnBuild)' == 'true' " >
</Target>
<PropertyGroup>
<CorePublishDependsOn>
$(_DotNetPublishComputeFiles);
$(_DotNetPublishCopyFiles);
$(_DotNetPublishTransformFiles);
$(_DotNetPublishFiles);
</CorePublishDependsOn>
</PropertyGroup>
<!--
***********************************************************************************************
NOTE: We have to add WebPublishProfileFile to GlobalPropertiesToRemove to prevent it to flow to
other web apps that are referenced by current web app. If we don't do that, their output paths
will be messed up with RuntimeIdentifier we pass in pubxml file.
***********************************************************************************************
-->
<ItemDefinitionGroup>
<ProjectReference>
<GlobalPropertiesToRemove>%(GlobalPropertiesToRemove);WebPublishProfileFile</GlobalPropertiesToRemove>
</ProjectReference>
</ItemDefinitionGroup>
<Target Name="CorePublish"
DependsOnTargets="$(CorePublishDependsOn)"/>
</Project>