-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathMicrosoft.NET.Sdk.Publish.MSDeployPackage.targets
325 lines (278 loc) · 14.2 KB
/
Microsoft.NET.Sdk.Publish.MSDeployPackage.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
<!--
***********************************************************************************************
Microsoft.NET.Sdk.Publish.MSDeployPackage.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">
<!--
***********************************************************************************************
Including the tasks
***********************************************************************************************
-->
<UsingTask TaskName="MSDeploy" AssemblyFile="$(_PublishTaskAssemblyFullPath)"/>
<UsingTask TaskName="VSMSDeploy" AssemblyFile="$(_PublishTaskAssemblyFullPath)"/>
<UsingTask TaskName="NormalizeServiceUrl" AssemblyFile="$(_PublishTaskAssemblyFullPath)"/>
<UsingTask TaskName="ValidateParameter" AssemblyFile="$(_PublishTaskAssemblyFullPath)"/>
<UsingTask TaskName="CreateManifestFile" AssemblyFile="$(_PublishTaskAssemblyFullPath)" />
<UsingTask TaskName="ImportParameterFile" AssemblyFile="$(_PublishTaskAssemblyFullPath)" />
<UsingTask TaskName="CreateParameterFile" AssemblyFile="$(_PublishTaskAssemblyFullPath)" />
<UsingTask TaskName="CreateMSDeployScript" AssemblyFile="$(_PublishTaskAssemblyFullPath)" />
<PropertyGroup>
<_DotNetPublishFiles>
MSDeployPackagePublish;
</_DotNetPublishFiles>
</PropertyGroup>
<!--
***********************************************************************************************
TARGET : MSDeployPackagePublish
***********************************************************************************************
-->
<PropertyGroup>
<MSDeployPackagePublishDependsOn>
$(MSDeployPackagePublishDependsOn);
_InitMSDeployPackageProperties;
_PrepareForMsDeployPublish;
_CreateManifestFiles;
_CreateParameterFiles;
_CreateMSDeployScript;
</MSDeployPackagePublishDependsOn>
</PropertyGroup>
<Target Name="MSDeployPackagePublish" DependsOnTargets="$(MSDeployPackagePublishDependsOn)">
<PropertyGroup>
<MSDeployPublishSourceType>manifest</MSDeployPublishSourceType>
<MSDeployPublishSourceRoot>$(_MsDeploySourceManifestPath)</MSDeployPublishSourceRoot>
<!--Destination is alway a manifest-->
<MSDeployPublishDestinationType>Package</MSDeployPublishDestinationType>
<MSDeployPublishDestinationRoot>$(PackageLocation)</MSDeployPublishDestinationRoot>
<RetryAttemptsForDeployment Condition=" '$(RetryAttemptsForDeployment)' == '' ">2</RetryAttemptsForDeployment>
<PublishEnableLinks Condition="'$(PublishEnableLinks)' == ''"></PublishEnableLinks>
<PublishDisableLinks Condition="'$(PublishDisableLinks)' == ''">AppPoolExtension;ContentExtension;CertificateExtension</PublishDisableLinks>
<!-- UserAgent string sent to msdeploy -->
<_MSDeployUserAgentSource>CmdLine</_MSDeployUserAgentSource>
<_MSDeployUserAgent>VS$(_MSDeployUserAgentSource)</_MSDeployUserAgent>
<!-- MsDeploy Api is not supported for core yet -->
<UseMsDeployExe Condition="'$(UseMsDeployExe)' == '' And '$(MSBuildRuntimeType)' == 'Core'">true</UseMsDeployExe>
</PropertyGroup>
<!-- Data Passed to MSDeploy -->
<ItemGroup>
<MsDeploySourceProviderSetting Remove="@(MsDeploySourceProviderSetting)" />
<MsDeploySourceProviderSetting Include="$(MSDeployPublishSourceType)">
<Path>$(MSDeployPublishSourceRoot)</Path>
</MsDeploySourceProviderSetting>
<MsDeployDestinationProviderSetting Remove="@(MsDeployDestinationProviderSetting)" />
<MsDeployDestinationProviderSetting Include="$(MSDeployPublishDestinationType)">
<Path>$(MSDeployPublishDestinationRoot)</Path>
</MsDeployDestinationProviderSetting>
</ItemGroup>
<VSMSDeploy Condition="'$(UseMsdeployExe)' != 'true'"
MSDeployVersionsToTry="$(_MSDeployVersionsToTry)"
Source="@(MsDeploySourceProviderSetting)"
Destination="@(MsDeployDestinationProviderSetting)"
DeploymentTraceLevel="$(PackageTraceLevel)"
DisableLink="$(PublishDisableLinks)"
EnableLink="$(PublishEnableLinks)"
ImportDeclareParametersItems="$(_MSDeployParametersFilePath)"
ReplaceRuleItems="@(MsDeployReplaceRules)"
RetryAttempts="$(RetryAttemptsForDeployment)">
<Output TaskParameter="Result" PropertyName="PackageResult" />
</VSMSDeploy>
<MSdeploy
Condition="'$(UseMsdeployExe)' == 'true'"
Verb="sync"
Source="@(MsDeploySourceProviderSetting)"
Destination="@(MsDeployDestinationProviderSetting)"
DisableLink="$(PublishDisableLinks)"
EnableLink="$(PublishEnableLinks)"
ImportDeclareParametersItems="$(_MSDeployParametersFilePath)"
ReplaceRuleItems="@(MsDeployReplaceRules)"
RetryAttempts="$(RetryAttemptsForDeployment)"
ExePath="$(MSDeployPath)"
/>
</Target>
<!--
***********************************************************************************************
TARGET : _InitMSDeployPackageProperties
***********************************************************************************************
-->
<Target Name="_InitMSDeployPackageProperties">
<PropertyGroup>
<DefaultPackageFileName Condition="'$(DefaultPackageFileName)'==''">$(MSBuildProjectName).zip</DefaultPackageFileName>
<PackageLocation Condition="'$(PackageLocation)' == ''">$(DesktopBuildPackageLocation)</PackageLocation>
<PackageLocation Condition="'$(PackageLocation)' == ''">$(OutputPath)</PackageLocation>
<PackageLocation Condition="'$([System.IO.Path]::GetExtension($(PackageLocation)))' == '' And !HasTrailingSlash('$(PackageLocation)')">$(PackageLocation)\</PackageLocation>
<PackageLocation Condition="'$([System.IO.Path]::GetExtension($(PackageLocation)))' == '' ">$(PackageLocation)$(DefaultPackageFileName)</PackageLocation>
<DeployIisAppPath Condition="'$(DeployIisAppPath)' ==''">Default Web Site</DeployIisAppPath>
<EnableOptimisticParameterDefaultValue Condition="'$(EnableOptimisticParameterDefaultValue)'==''">True</EnableOptimisticParameterDefaultValue>
</PropertyGroup>
<ConvertToAbsolutePath Paths="$(PackageLocation)">
<Output TaskParameter="AbsolutePaths" PropertyName="PackageLocation"/>
</ConvertToAbsolutePath>
</Target>
<!--
***********************************************************************************************
TARGET : _PrepareForMsDeployPackagePublish
***********************************************************************************************
-->
<Target Name="_PrepareForMsDeployPublish">
<PropertyGroup>
<_destinationFolder Condition="'$(_destinationFolder)' == ''">$([System.IO.Path]::GetDirectoryName($(PackageLocation)))\</_destinationFolder>
<_MsDeploySourceManifestPath Condition="'$(_MsDeploySourceManifestPath)' == ''">$(_destinationFolder)$(MSBuildProjectName).SourceManifest.xml</_MsDeploySourceManifestPath>
<_MSDeployParametersFilePath Condition="'$(_MSDeployParametersFilePath)' == ''">$(_destinationFolder)$(MSBuildProjectName).Parameters.xml</_MSDeployParametersFilePath>
<_MSDeploySetParametersFilePath Condition="'$(_MSDeploySetParametersFilePath)' == ''">$(_destinationFolder)$(MSBuildProjectName).SetParameters.xml</_MSDeploySetParametersFilePath>
<_MSDeployScriptFilePath Condition="'$(_MSDeployScriptFilePath)' == ''">$(_destinationFolder)$(MSBuildProjectName).deploy.cmd</_MSDeployScriptFilePath>
<_MSDeployReadMeFilePath Condition="'$(_MSDeployReadMeFilePath)' == ''">$(_destinationFolder)$(MSBuildProjectName).deploy-readme.txt</_MSDeployReadMeFilePath>
</PropertyGroup>
<ItemGroup>
<_PublishConfigFiles Include="$(_MsDeploySourceManifestPath);$(_MSDeployParametersFilePath);$(_MSDeploySetParametersFilePath);$(_MSDeployScriptFilePath);$(_MSDeployReadMeFilePath)" />
</ItemGroup>
<MakeDir Directories="$(_destinationFolder)" Condition="!Exists('$(_destinationFolder)')" ContinueOnError="true"/>
<Delete Files="@(_PublishConfigFiles)" ContinueOnError="true" />
<Touch AlwaysCreate="true" Files="@(_PublishConfigFiles)" ContinueOnError="true" />
</Target>
<!--
***********************************************************************************************
TARGET : _CreateManifestFiles
***********************************************************************************************
-->
<Target Name="_CreateManifestFiles">
<ItemGroup>
<MsDeploySourceManifest Remove="@(MsDeploySourceManifest)" />
<MsDeploySourceManifest Include="IisApp" >
<Path>$(PublishIntermediateOutputPath)</Path>
</MsDeploySourceManifest>
</ItemGroup>
<ItemGroup Condition="'@(_EFSQLScripts)' != ''">
<MsDeploySourceManifest Include="dbfullsql" >
<Path>%(_EFSQLScripts.Identity)</Path>
</MsDeploySourceManifest>
</ItemGroup>
<CreateManifestFile
Manifests="@(MsDeploySourceManifest)"
ManifestFile="$(_MsDeploySourceManifestPath)" />
</Target>
<!--
***********************************************************************************************
TARGET : _CreateMSDeployScript
***********************************************************************************************
-->
<Target Name="_CreateMSDeployScript">
<CreateMsDeployScript
Condition="'$(IsCreateMSDeployScriptDisabled)' != 'true'"
ProjectName="$(MSBuildProjectName)"
ScriptFullPath="$(_MSDeployScriptFilePath)"
ReadMeFullPath="$(_MSDeployReadMeFilePath)"/>
</Target>
<!--
***********************************************************************************************
TARGET : _CreateParameterFiles
***********************************************************************************************
-->
<Target Name="_CreateParameterFiles">
<ItemGroup>
<MsDeployDeclareParameters Remove="@(MsDeployDeclareParameters)" />
<MsDeployDeclareParameters Include="IIS Web Application Name" >
<Kind>ProviderPath</Kind>
<Scope>IisApp</Scope>
<Match>$(PublishIntermediateOutputPath)</Match>
<Description></Description>
<DefaultValue>$(DeployIisAppPath)</DefaultValue>
<Value>$(DeployIisAppPath)</Value>
<Tags>IisApp</Tags>
<Priority></Priority>
<ExcludeFromSetParameter>false</ExcludeFromSetParameter>
</MsDeployDeclareParameters>
</ItemGroup>
<ItemGroup Condition="'@(_EFSQLScripts)' != ''">
<MsDeployDeclareParameters Include="%(_EFSQLScripts.DBContext)">
<Kind>ProviderPath</Kind>
<Scope>dbfullsql</Scope>
<Match>%(_EFSQLScripts.Identity)</Match>
<Description></Description>
<DefaultValue>%(_EFSQLScripts.ConnectionString)</DefaultValue>
<Value>%(_EFSQLScripts.ConnectionString)</Value>
<Tags>dbfullsql</Tags>
<Priority></Priority>
<ExcludeFromSetParameter>false</ExcludeFromSetParameter>
</MsDeployDeclareParameters>
</ItemGroup>
<ItemGroup>
<ParametersXMLFiles Include="$(MSBuildProjectDirectory)\Parameters.xml"
Condition="Exists('$(MSBuildProjectDirectory)\Parameters.xml')"/>
</ItemGroup>
<ImportParameterFile Condition="'@(ParametersXMLFiles)' != ''"
Files="@(ParametersXMLFiles)">
<Output TaskParameter="Result"
ItemName="_ImportedMSDeployDeclareParameters" />
</ImportParameterFile>
<ItemGroup>
<MsDeployDeclareParameters Include="@(_ImportedMSDeployDeclareParameters)"
Condition="'%(_ImportedMSDeployDeclareParameters.Identity)' !=''">
<Value>%(_ImportedMSDeployDeclareParameters.DefaultValue)</Value>
<Priority></Priority>
</MsDeployDeclareParameters>
</ItemGroup>
<CreateParameterFile
Parameters="@(MsDeployDeclareParameters)"
DeclareSetParameterFile="$(_MSDeployParametersFilePath)"
IncludeDefaultValue="True"
OptimisticParameterDefaultValue="$(EnableOptimisticParameterDefaultValue)"
SetParameterFile="$(_MSDeploySetParametersFilePath)"
GenerateFileEvenIfEmpty="True" />
</Target>
<!--
***********************************************************************************************
Item Definitions
***********************************************************************************************
-->
<ItemDefinitionGroup>
<MsDeploySourceProviderSetting>
<Path></Path>
<ComputerName></ComputerName>
<!--<Wmsvc></Wmsvc> Not supported yet-->
<UserName></UserName>
<Password></Password>
<EncryptPassword></EncryptPassword>
<IncludeAcls></IncludeAcls>
<authType></authType>
<prefetchPayload></prefetchPayload>
</MsDeploySourceProviderSetting>
</ItemDefinitionGroup>
<ItemDefinitionGroup>
<MsDeployDestinationProviderSetting>
<Path></Path>
<ComputerName></ComputerName>
<!--<Wmsvc></Wmsvc> Not supported yet-->
<UserName></UserName>
<Password></Password>
<EncryptPassword></EncryptPassword>
<IncludeAcls></IncludeAcls>
<authType></authType>
<prefetchPayload></prefetchPayload>
</MsDeployDestinationProviderSetting>
</ItemDefinitionGroup>
<!--
DeploymentSkipRule(string skipAction, string objectName, string absolutePath, string XPath);-->
<ItemDefinitionGroup>
<MsDeploySkipRules>
<SkipAction></SkipAction>
<ObjectName></ObjectName>
<AbsolutePath></AbsolutePath>
<XPath></XPath>
<KeyAttribute></KeyAttribute>
<!--Source, Destination, Both(the default)-->
<Apply></Apply>
</MsDeploySkipRules>
</ItemDefinitionGroup>
<!-- AdditionalProviderSettings denote the additionProviderSetting need to be set in the manifest files-->
<ItemDefinitionGroup>
<MsDeploySourceManifest>
<Path>Unknown</Path>
<AdditionalProviderSettings></AdditionalProviderSettings>
</MsDeploySourceManifest>
</ItemDefinitionGroup>
</Project>