Microsoft.Web.Publishing.MsDeploy.Common.targets 65 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192
  1. <!--
  2. ***********************************************************************************************
  3. Microsoft.Web.Publishing.MSDeploy.Common.targets
  4. WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
  5. created a backup copy. Incorrect changes to this file will make it
  6. impossible to load or build your web deploy projects from the command-line or the IDE.
  7. This file defines the steps in the standard package/publish process for Deploy
  8. Currently
  9. Copyright (C) Microsoft Corporation. All rights reserved.
  10. ***********************************************************************************************
  11. -->
  12. <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  13. <!--Import task from our dll-->
  14. <UsingTask TaskName="GetPublishingLocalizedString" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
  15. <UsingTask TaskName="MSDeploy" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
  16. <UsingTask TaskName="VSMSDeploy" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
  17. <UsingTask TaskName="ImportParametersFile" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
  18. <UsingTask TaskName="ExportParametersFile" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
  19. <UsingTask TaskName="SortParametrsByPriority" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
  20. <UsingTask TaskName="CreateProviderList" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
  21. <!--ImportBefore Extension-->
  22. <PropertyGroup>
  23. <ImportByWildcardBeforeMicrosoftWebPublishingMSDeployCommonTargets Condition="'$(ImportByWildcardBeforeMicrosoftWebPublishingMSDeployCommonTargets)'==''">true</ImportByWildcardBeforeMicrosoftWebPublishingMSDeployCommonTargets>
  24. </PropertyGroup>
  25. <Import Project="$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportBefore\*" Condition="'$(ImportByWildcardBeforeMicrosoftWebPublishingMSDeployCommonTargets)' == 'true' and exists('$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportBefore')"/>
  26. <!--Indicate that we already imported to avoid duplicate import-->
  27. <PropertyGroup>
  28. <Microsoft_Web_Publishing_MSDeploy_Common_targets_Imported>True</Microsoft_Web_Publishing_MSDeploy_Common_targets_Imported>
  29. </PropertyGroup>
  30. <PropertyGroup>
  31. <InsertEFCodeFirstDeployWebCofig Condition="'$(InsertEFCodeFirstDeployWebCofig)' == ''">True</InsertEFCodeFirstDeployWebCofig>
  32. <InsertEFCodeFirstDeployWebCofigIntermediateOutput Condition="'$(InsertEFCodeFirstDeployWebCofigIntermediateOutput)'==''">InsertEFCodeFirstDeploy</InsertEFCodeFirstDeployWebCofigIntermediateOutput>
  33. <InsertEFCodeFirstDeployWebCofigLocation Condition="'$(InsertEFCodeFirstDeployWebCofigLocation)'==''">$(_WPPDefaultIntermediateOutputPath)$(InsertEFCodeFirstDeployWebCofigIntermediateOutput)</InsertEFCodeFirstDeployWebCofigLocation>
  34. </PropertyGroup>
  35. <!--********************************************************************-->
  36. <!-- ProcessPublishDatabaseSettings -->
  37. <!--********************************************************************-->
  38. <PropertyGroup>
  39. <PublishDatabases Condition="'$(PublishDatabases)'==''">True</PublishDatabases>
  40. <ProcessPublishDatabaseSettingsDependsOn>
  41. GetMSDeployInstalledVersionPath;
  42. </ProcessPublishDatabaseSettingsDependsOn>
  43. </PropertyGroup>
  44. <Target Name="ProcessPublishDatabaseSettings" DependsOnTargets="$(ProcessPublishDatabaseSettingsDependsOn)" Condition="$(PublishDatabases) And '$(FilePreview)'!='true' And ('$(PublishDatabaseSettings)' != '' Or '$(PublishDatabaseSettingsFile)' != '')">
  45. <MakeDir Directories="$(DatabaseDeployIntermediateOutputPath)" Condition="!Exists($(DatabaseDeployIntermediateOutputPath))" />
  46. <CreateProviderList ProjectFileFullPath="$(WebPublishPipeLineProjectFullPath)"
  47. ProvidersXml="$(PublishDatabaseSettings)"
  48. IntermediateOutputPath="$(DatabaseDeployIntermediateOutputPath)"
  49. MSDeployVersionsToTry="$(_MSDeployVersionsToTry)"
  50. UseMSDeployExe="$(UseMsdeployExe)"
  51. MSDeployExePath="$(MSDeployPath)"
  52. ImportInSyncCheck="$(VerifyDatabaseSettingWithImport)"
  53. LocalDBVersionToUseForSqlExpress="$(_LocalDBVersionToUseForSqlExpress)"
  54. Condition="'$(PublishDatabaseSettings)' != ''">
  55. <Output TaskParameter="List" ItemName="_DatabasesToPackage" />
  56. <Output TaskParameter="SourceManifest" ItemName="_DatabasesToSourceManifest" />
  57. </CreateProviderList>
  58. <CreateProviderList ProjectFileFullPath="$(WebPublishPipeLineProjectFullPath)"
  59. ProvidersFile="$(PublishDatabaseSettingsFile)"
  60. IntermediateOutputPath="$(DatabaseDeployIntermediateOutputPath)"
  61. MSDeployVersionsToTry="$(_MSDeployVersionsToTry)"
  62. UseMSDeployExe="$(UseMsdeployExe)"
  63. MSDeployExePath="$(MSDeployPath)"
  64. ImportInSyncCheck="$(VerifyDatabaseSettingWithImport)"
  65. LocalDBVersionToUseForSqlExpress="$(_LocalDBVersionToUseForSqlExpress)"
  66. Condition="'$(PublishDatabaseSettingsFile)' != ''">
  67. <Output TaskParameter="List" ItemName="_DatabasesToPackage" />
  68. <Output TaskParameter="SourceManifest" ItemName="_DatabasesToSourceManifest" />
  69. </CreateProviderList>
  70. <WriteLinesToFile Condition="$(EnablePackageProcessLoggingAndAssert)"
  71. Encoding="utf-8"
  72. File="$(PackageLogDir)\DatabasesToPackage.txt"
  73. Lines="@(_DatabasesToPackage->'
  74. Name:%(Identity)
  75. SourceProvider:%(SourceProvider)
  76. SourcePath=%(SourcePath)
  77. SourcePath_RegExExcaped=%(SourcePath_RegExExcaped)
  78. DestinationGroup=%(DestinationGroup)')" Overwrite="True" />
  79. </Target>
  80. <!--********************************************************************-->
  81. <!-- ParseSQLScriptForMSDeployParameters -->
  82. <!--********************************************************************-->
  83. <PropertyGroup>
  84. <PublishDatabases Condition="'$(PublishDatabases)'==''">True</PublishDatabases>
  85. <ParseSQLScriptForMSDeployParametersDependsOn>
  86. $(ParseSQLScriptForMSDeployParametersDependsOn);
  87. GetMSDeployInstalledVersionPath;
  88. ProcessPublishDatabaseSettings;
  89. </ParseSQLScriptForMSDeployParametersDependsOn>
  90. </PropertyGroup>
  91. <Target Name="ParseSQLScriptForMSDeployParameters" DependsOnTargets="$(ParseSQLScriptForMSDeployParametersDependsOn)" Condition="$(PublishDatabases) And ('$(PublishDatabaseSettings)' != '' Or '$(PublishDatabaseSettingsFile)' != '')">
  92. <ItemGroup>
  93. <_DatabasesToPackageForSQL Include="@(_DatabasesToPackage)"
  94. Condition="$(EnableSqlScriptVariableParameterize)
  95. And '%(_DatabasesToPackage.SourceProvider)' == 'DbFullSql'
  96. And '%(_DatabasesToPackage.SourcePath)' != ''
  97. And Exists('%(_DatabasesToPackage.SourcePath)')
  98. And '$([System.IO.Path]::GetExtension($([System.String]::new(%(_DatabasesToPackage.SourcePath)))))' == '.sql'">
  99. </_DatabasesToPackageForSQL>
  100. </ItemGroup>
  101. <!-- this is very costly operation depend on sql file size. For example, 256 Meg sql file, it takes about 11 second to process (merely open it and scan it.)
  102. We should avoid process if we have any knowledge on the sql file-->
  103. <SqlScriptPreprocessSqlVariables
  104. UnsupportedKeywords="$(MsdeploySqlUnsupportedCommand)"
  105. CheckForUnsupportCommands="$(CheckSqlScriptForUnsupportedCommands)"
  106. TreadSqlScriptUnsupportedCommandsAsWarning="$(TreadSqlScriptUnsupportedCommandsAsWarning)"
  107. SqlScriptFile="%(_DatabasesToPackageForSQL.SourcePath)"
  108. DestinationGroup="%(_DatabasesToPackageForSQL.DestinationGroup)"
  109. ResolveIncludes="$(SqlScriptPreProcessResolveIncludes)"
  110. BatchDelimiter="$(SqlScriptPreProcessBatchDelimiter)"
  111. Condition="$(EnableSqlScriptVariableParameterize) And '%(_DatabasesToPackageForSQL.SourcePath)' != '' And Exists('%(_DatabasesToPackageForSQL.SourcePath)') ">
  112. <Output TaskParameter="List" ItemName="_DatabasesToPackage_SqlVariables" />
  113. </SqlScriptPreprocessSqlVariables>
  114. <!--Log the information Set $(EnablePackageProcessLoggingAndAssert) to True if you want to see this information-->
  115. <MakeDir Condition="$(EnableSqlScriptVariableParameterize) And $(EnablePackageProcessLoggingAndAssert) And !Exists('$(PackageLogDir)')"
  116. Directories="$(PackageLogDir)" />
  117. <!-- (Debug Only, Turn on EnablePackageProcessLoggingAndAssert if needed )
  118. Dump the list to the log file in the log dir-->
  119. <WriteLinesToFile Condition="$(EnablePackageProcessLoggingAndAssert) and $(EnableSqlScriptVariableParameterize)"
  120. Encoding="utf-8"
  121. File="$(PackageLogDir)\SqlVariables.txt"
  122. Lines="@(_DatabasesToPackage_SqlVariables->'
  123. Name:%(Identity)
  124. Vaule:%(Value)
  125. IsDeclared:%(IsDeclared)
  126. SourcePath=%(SourcePath)
  127. SourcePath_RegExExcaped=%(SourcePath_RegExExcaped)
  128. DestinationGroup=%(DestinationGroup)')" Overwrite="True" />
  129. </Target>
  130. <!--********************************************************************-->
  131. <!-- HandleEFCodeFirstDataMigration -->
  132. <!--********************************************************************-->
  133. <PropertyGroup>
  134. <PublishDatabases Condition="'$(PublishDatabases)'==''">True</PublishDatabases>
  135. <HandleEFCodeFirstDataMigrationDependsOn>
  136. $(HandleEFCodeFirstDataMigrationDependsOn);
  137. GetMSDeployInstalledVersionPath;
  138. ProcessPublishDatabaseSettings;
  139. </HandleEFCodeFirstDataMigrationDependsOn>
  140. </PropertyGroup>
  141. <Target Name="HandleEFCodeFirstDataMigration" DependsOnTargets="$(HandleEFCodeFirstDataMigrationDependsOn)" Condition="$(PublishDatabases) And ('$(PublishDatabaseSettings)' != '' Or '$(PublishDatabaseSettingsFile)' != '')">
  142. <ItemGroup>
  143. <_DatabasesToPackageForEFCodeFirst Include="@(_DatabasesToPackage)"
  144. Condition="'%(_DatabasesToPackage.SourceProvider)' == 'DbCodeFirst'
  145. And '%(_DatabasesToPackage.SourcePath)' == 'DBMigration'">
  146. </_DatabasesToPackageForEFCodeFirst>
  147. </ItemGroup>
  148. <WriteLinesToFile Condition="$(EnablePackageProcessLoggingAndAssert)"
  149. Encoding="utf-8"
  150. File="$(PackageLogDir)\DatabasesToPackageForEFCodeFirst.txt"
  151. Lines="@(_DatabasesToPackageForEFCodeFirst->'
  152. Name:%(Identity)
  153. SourceProvider:%(SourceProvider)
  154. SourcePath=%(SourcePath)
  155. SourcePath_RegExExcaped=%(SourcePath_RegExExcaped)
  156. SourceMigrationConfiguration=%(SourceMigrationConfiguration)
  157. SourceDbContext=%(SourceDbContext)
  158. DestinationGroup=%(DestinationGroup)')" Overwrite="True" />
  159. </Target>
  160. <!--********************************************************************
  161. Target PreInsertEFCodeFirstDeployWebCofig
  162. ********************************************************************-->
  163. <PropertyGroup>
  164. <PreInsertEFCodeFirstDeployWebCofigDependsOn>
  165. HandleEFCodeFirstDataMigration;
  166. ProfileTransformWebConfig;
  167. </PreInsertEFCodeFirstDeployWebCofigDependsOn>
  168. <PreInsertEFCodeFirstDeployWebCofigBeforeTarget>
  169. $(PreInsertEFCodeFirstDeployWebCofigBeforeTarget);
  170. AutoParameterizationWebConfigConnectionStrings;
  171. PreAutoParameterizationWebConfigConnectionStrings;
  172. </PreInsertEFCodeFirstDeployWebCofigBeforeTarget>
  173. </PropertyGroup>
  174. <Target Name="PreInsertEFCodeFirstDeployWebCofig"
  175. DependsOnTargets="$(PreInsertEFCodeFirstDeployWebCofigDependsOn)"
  176. Condition="'@(_DatabasesToPackageForEFCodeFirst)' !=''"
  177. BeforeTargets="$(PreInsertEFCodeFirstDeployWebCofigBeforeTarget)">
  178. <ItemGroup>
  179. <_WebConfigsToInsertEFCodeFirstDeployContext Include="@(FilesForPackagingFromProject)"
  180. Condition="'%(FilesForPackagingFromProject.Filename)%(FilesForPackagingFromProject.Extension)'=='$(ProjectConfigFileName)'
  181. And !%(FilesForPackagingFromProject.Exclude)
  182. And '%(DestinationRelativePath)' == '$(ProjectConfigFileName)'">
  183. <TransformOriginalFolder>$(InsertEFCodeFirstDeployWebCofigLocation)\original</TransformOriginalFolder>
  184. <TransformOutputFile>$(InsertEFCodeFirstDeployWebCofigLocation)\transformed\%(DestinationRelativePath)</TransformOutputFile>
  185. <TransformScope>$([System.IO.Path]::GetFullPath($(WPPAllFilesInSingleFolder)\%(DestinationRelativePath)))</TransformScope>
  186. </_WebConfigsToInsertEFCodeFirstDeployContext>
  187. <_WebConfigsToInsertEFCodeFirstDeployContextOuputFiles Include="@(_WebConfigsToInsertEFCodeFirstDeployContext->'%(TransformOutputFile)')">
  188. </_WebConfigsToInsertEFCodeFirstDeployContextOuputFiles>
  189. </ItemGroup>
  190. <PropertyGroup>
  191. <_WebConfigsToInsertEFCodeFirstDeployContextOuputDirectories>@(_WebConfigsToInsertEFCodeFirstDeployContextOuputFiles->'%(RootDir)%(Directory)')</_WebConfigsToInsertEFCodeFirstDeployContextOuputDirectories>
  192. <_WebConfigsToInsertEFCodeFirstDeployContextOuput>@(_WebConfigsToInsertEFCodeFirstDeployContext->'%(TransformOutputFile)');</_WebConfigsToInsertEFCodeFirstDeployContextOuput>
  193. </PropertyGroup>
  194. <ItemGroup>
  195. <_WebConfigsToInsertEFCodeFirstDeployContextOuputDirectories Include="$(_WebConfigsToInsertEFCodeFirstDeployContextOuputDirectories)" />
  196. </ItemGroup>
  197. <!--Make sure required directories exist-->
  198. <MakeDir Directories="@(_WebConfigsToInsertEFCodeFirstDeployContextOuputDirectories)" Condition="!Exists(%(Identity))"/>
  199. <WriteLinesToFile Condition="$(EnablePackageProcessLoggingAndAssert) And ('@(_WebConfigsToInsertEFCodeFirstDeployContext)'!='') And !%(Exclude)"
  200. Encoding="utf-8"
  201. Overwrite="True"
  202. File="$(PackageLogDir)\PreInsertEFCodeFirstDeployWebCofig.Log"
  203. Lines="@(_WebConfigsToInsertEFCodeFirstDeployContext->'
  204. InsertEFCodeFirstDeployContextTransform input: %(Identity)
  205. output: %(TransformOutputFile)
  206. From:%(Identity)
  207. DestinationRelativePath:%(DestinationRelativePath)
  208. Exclude:%(Exclude)
  209. FromTarget:%(FromTarget)
  210. Category:%(Category)
  211. ProjectFileType:%(ProjectFileType)
  212. ')" />
  213. <!--Copy the original web.config-->
  214. <CopyPipelineFiles PipelineItems="@(_WebConfigsToInsertEFCodeFirstDeployContext)"
  215. SourceDirectory="$(WebPublishPipelineProjectDirectory)"
  216. TargetDirectory="%(TransformOriginalFolder)"
  217. SkipMetadataExcludeTrueItems="True"
  218. UpdateItemSpec="False"
  219. DeleteItemsMarkAsExcludeTrue ="True"
  220. Condition="'@(_WebConfigsToInsertEFCodeFirstDeployContext)' != ''">
  221. <Output TaskParameter="UpdatedPipelineItems" ItemName="_UpdatedWebConfigsToInsertEFCodeFirstDeployContext"/>
  222. </CopyPipelineFiles>
  223. <!--Delete those web.config have been updated if existed-->
  224. <Delete Files="@(_UpdatedWebConfigsToInsertEFCodeFirstDeployContext->'%(TransformOutputFile)')" />
  225. <GetPublishingLocalizedString
  226. ID="PublishLocalizedString_EFCodeFirstConnectionStringParameterDescription">
  227. <Output TaskParameter="Result" PropertyName="_PublishLocalizedString_EFCodeFirstConnectionStringParameterDescription" />
  228. </GetPublishingLocalizedString>
  229. <PropertyGroup>
  230. <DeployParameterEFCodeFirstConnectionStringDescription Condition="'$(DeployParameterEFCodeFirstConnectionStringDescription)'==''">$(_PublishLocalizedString_EFCodeFirstConnectionStringParameterDescription)</DeployParameterEFCodeFirstConnectionStringDescription>
  231. </PropertyGroup>
  232. <!--Description might have the xml special character, we need to escape it. -->
  233. <EscapeXMLString
  234. Source="$(DeployParameterEFCodeFirstConnectionStringDescription)" >
  235. <Output TaskParameter="Result" PropertyName="_EscapedDeployParameterEFCodeFirstConnectionStringDescription" />
  236. </EscapeXMLString>
  237. <ItemGroup>
  238. <MSDeployParameterValue Include="@(_DatabasesToPackageForEFCodeFirst->'$(DeployParameterPrefix)%(DestinationGroup)_DatabasePublish-Web.config Connection String')">
  239. <ParameterValue>%(_DatabasesToPackageForEFCodeFirst.DestinationPath)</ParameterValue>
  240. <Description>%(_DatabasesToPackageForEFCodeFirst.DestinationGroup) $(_EscapedDeployParameterEFCodeFirstConnectionStringDescription)</Description>
  241. <UpdateDestWebConfig>True</UpdateDestWebConfig>
  242. <AllowUIUpdate>False</AllowUIUpdate>
  243. </MSDeployParameterValue>
  244. </ItemGroup>
  245. <ItemGroup>
  246. <_InsertEFCodeFirstDeployContextNames Include="@(_DatabasesToPackageForEFCodeFirst)">
  247. <TransformXMLFragement_CSInsert>
  248. &lt;add
  249. name=&quot;%(_DatabasesToPackageForEFCodeFirst.DestinationGroup)_DatabasePublish&quot;&#13;&#10;
  250. connectionString=&quot;%(_DatabasesToPackageForEFCodeFirst.DestinationGroup)_DatabasePublish.ConnetionString&quot;&#13;&#10;
  251. providerName=&quot;$(InsertAdditionalWebConfigConnectionStringProviderName)&quot;&#13;&#10;
  252. xdt:Transform=&quot;InsertIfMissing&quot; &#13;&#10;
  253. xdt:Locator=&quot;Match(name)&quot;&#13;&#10;
  254. xdt:SupressWarnings=&quot;True&quot;&#13;&#10;
  255. /&gt;
  256. </TransformXMLFragement_CSInsert>
  257. <TransformXMLFragement_Deploy>
  258. &lt;context type="%(_DatabasesToPackageForEFCodeFirst.SourceDbContext)" &#13;&#10;
  259. xdt:Transform="InsertIfMissing" &#13;&#10;
  260. xdt:Locator=&quot;Match(type)&quot;&#13;&#10;
  261. xdt:SupressWarnings=&quot;true&quot;&#13;&#10;
  262. &gt;&#13;&#10;
  263. &lt;databaseInitializer type="System.Data.Entity.MigrateDatabaseToLatestVersion`2[[%(_DatabasesToPackageForEFCodeFirst.SourceDbContext)], [%(_DatabasesToPackageForEFCodeFirst.SourceMigrationConfiguration)]], EntityFramework, PublicKeyToken=b77a5c561934e089"&gt;&#13;&#10;
  264. &lt;parameters&gt;&#13;&#10;
  265. &lt;parameter value="%(_DatabasesToPackageForEFCodeFirst.DestinationGroup)_DatabasePublish" /&gt;&#13;&#10;
  266. &lt;/parameters&gt;&#13;&#10;
  267. &lt;/databaseInitializer&gt;&#13;&#10;
  268. &lt;/context&gt;
  269. </TransformXMLFragement_Deploy>
  270. </_InsertEFCodeFirstDeployContextNames>
  271. </ItemGroup>
  272. <WriteLinesToFile Condition="$(EnablePackageProcessLoggingAndAssert) And ('@(_InsertEFCodeFirstDeployContextNames)'!='') "
  273. Encoding="utf-8"
  274. Overwrite="True"
  275. File="$(PackageLogDir)\InsertEFCodeFirstDeployContextName.Log"
  276. Lines="@(_InsertEFCodeFirstDeployContextNames->'
  277. _InsertEFCodeFirstDeployContextNames
  278. TransformXMLFragement_CSInsert: %(TransformXMLFragement_CSInsert)
  279. TransformXMLFragement_Deploy: %(TransformXMLFragement_Deploy)
  280. ')" />
  281. <PropertyGroup>
  282. <_WebConfigsToInsertEFCodeFirstDeployContext_Transform>&lt;?xml version=&quot;1.0&quot;?&gt;
  283. &lt;configuration xmlns:xdt=&quot;http://schemas.microsoft.com/XML-Document-Transform&quot;&gt;
  284. &lt;connectionStrings xdt:Transform=&quot;InsertIfMissing&quot; xdt:SupressWarnings=&quot;True&quot;&gt;
  285. @(_InsertEFCodeFirstDeployContextNames->'%(TransformXMLFragement_CSInsert)', '')
  286. &lt;/connectionStrings&gt;
  287. &lt;entityFramework xdt:Transform=&quot;InsertIfMissing&quot; xdt:SupressWarnings=&quot;true&quot;&gt;
  288. &lt;contexts xdt:Transform=&quot;InsertIfMissing&quot; xdt:SupressWarnings=&quot;true&quot;&gt;
  289. @(_InsertEFCodeFirstDeployContextNames->'%(TransformXMLFragement_Deploy)', '')
  290. &lt;/contexts&gt;
  291. &lt;/entityFramework&gt;
  292. &lt;/configuration&gt;
  293. </_WebConfigsToInsertEFCodeFirstDeployContext_Transform>
  294. </PropertyGroup>
  295. <WriteLinesToFile Condition="$(EnablePackageProcessLoggingAndAssert) And ('@(_InsertEFCodeFirstDeployContextNames)'!='') "
  296. Encoding="utf-8"
  297. Overwrite="False"
  298. File="$(PackageLogDir)\InsertEFCodeFirstDeployContextName.Log"
  299. Lines="Final Transform-------------------------------
  300. $(_WebConfigsToInsertEFCodeFirstDeployContext_Transform)" />
  301. </Target>
  302. <!--********************************************************************-->
  303. <!--Target InsertEFCodeFirstDeployWebCofigCore -->
  304. <!--********************************************************************-->
  305. <PropertyGroup>
  306. <InsertEFCodeFirstDeployWebCofigCoreDependsOn>
  307. HandleEFCodeFirstDataMigration;
  308. ProfileTransformWebConfig;
  309. PreInsertEFCodeFirstDeployWebCofig;
  310. </InsertEFCodeFirstDeployWebCofigCoreDependsOn>
  311. </PropertyGroup>
  312. <Target Name="InsertEFCodeFirstDeployWebCofigCore"
  313. Inputs="@(_WebConfigsToInsertEFCodeFirstDeployContext)"
  314. Outputs="%(TransformOutputFile)"
  315. DependsOnTargets="$(InsertEFCodeFirstDeployWebCofigCoreDependsOn)"
  316. Condition="'@(_DatabasesToPackageForEFCodeFirst)' !=''">
  317. <!-- First Delete the output parameter file-->
  318. <!-- Remove the output file if there is change on $(UseParameterizeToTransformWebConfig)-->
  319. <Delete Files="@(_WebConfigsToInsertEFCodeFirstDeployContext->'%(TransformOutputFile)')"/>
  320. <PropertyGroup>
  321. <_WebConfigToInsertEFCodeFirstDeployContext_Identity>%(_WebConfigsToInsertEFCodeFirstDeployContext.Identity)</_WebConfigToInsertEFCodeFirstDeployContext_Identity>
  322. <_WebConfigToInsertEFCodeFirstDeployContext_TransformOutputFile>%(_WebConfigsToInsertEFCodeFirstDeployContext.TransformOutputFile)</_WebConfigToInsertEFCodeFirstDeployContext_TransformOutputFile>
  323. <_WebConfigsToInsertEFCodeFirstDeployContext_TransformScope>%(_WebConfigsToInsertEFCodeFirstDeployContext.TransformScope)</_WebConfigsToInsertEFCodeFirstDeployContext_TransformScope>
  324. </PropertyGroup>
  325. <WriteLinesToFile Condition="$(EnablePackageProcessLoggingAndAssert)"
  326. Encoding="utf-8"
  327. Overwrite="False"
  328. File="$(PackageLogDir)\InsertEFCodeFirstDeployContextName.Log"
  329. Lines="_WebConfigToInsertEFCodeFirstDeployContext_Identity: $(_WebConfigToInsertEFCodeFirstDeployContext_Identity)
  330. _WebConfigToInsertEFCodeFirstDeployContext_TransformOutputFile: $(_WebConfigToInsertEFCodeFirstDeployContext_TransformOutputFile)
  331. _WebConfigsToInsertEFCodeFirstDeployContext_TransformScope: $(_WebConfigsToInsertEFCodeFirstDeployContext_TransformScope)
  332. _WebConfigsToInsertEFCodeFirstDeployContext_Transform: $(_WebConfigsToInsertEFCodeFirstDeployContext_Transform)
  333. " />
  334. <!-- Now we use the tokenize transform to auto parameterize the web.config-->
  335. <ParameterizeTransformXml
  336. Source="$(_WebConfigToInsertEFCodeFirstDeployContext_Identity)"
  337. IsSourceAFile="True"
  338. Transform="$(_WebConfigsToInsertEFCodeFirstDeployContext_Transform)"
  339. IsTransformAFile="False"
  340. Destination="$(_WebConfigToInsertEFCodeFirstDeployContext_TransformOutputFile)"
  341. IsDestinationAFile="True"
  342. Scope="$(_WebConfigsToInsertEFCodeFirstDeployContext_TransformScope)"
  343. StackTrace="$(TransformWebConfigStackTraceEnabled)"
  344. SourceRootPath="$(WebPublishPipelineSourceRootDirectory)">
  345. </ParameterizeTransformXml>
  346. </Target>
  347. <!--********************************************************************-->
  348. <!--Target PostInsertEFCodeFirstDeployWebCofig -->
  349. <!--********************************************************************-->
  350. <PropertyGroup>
  351. <PostInsertEFCodeFirstDeployWebCofigDependsOn>
  352. HandleEFCodeFirstDataMigration;
  353. ProfileTransformWebConfig;
  354. PreInsertEFCodeFirstDeployWebCofig;
  355. InsertEFCodeFirstDeployWebCofigCore;
  356. </PostInsertEFCodeFirstDeployWebCofigDependsOn>
  357. </PropertyGroup>
  358. <Target Name="PostInsertEFCodeFirstDeployWebCofig"
  359. DependsOnTargets="$(PostInsertEFCodeFirstDeployWebCofigDependsOn)"
  360. Condition="'@(_DatabasesToPackageForEFCodeFirst)' !=''">
  361. <ItemGroup>
  362. <!--Remove untransformed Web.configs from the pipeline-->
  363. <FilesForPackagingFromProject Remove="@(_WebConfigsToInsertEFCodeFirstDeployContext)" Condition="'@(_WebConfigsToInsertEFCodeFirstDeployContext)'!='' And !%(_WebConfigsToInsertEFCodeFirstDeployContext.Exclude) And Exists(%(_WebConfigsToInsertEFCodeFirstDeployContext.TransformOutputFile))"/>
  364. <!--Add the transformed Web.configs at the new loction to the pipeline-->
  365. <FilesForPackagingFromProject Include="@(_WebConfigsToInsertEFCodeFirstDeployContext->'%(TransformOutputFile)')" Condition="'@(_WebConfigsToInsertEFCodeFirstDeployContext)'!='' And !%(_WebConfigsToInsertEFCodeFirstDeployContext.Exclude) And Exists(%(_WebConfigsToInsertEFCodeFirstDeployContext.TransformOutputFile))"/>
  366. </ItemGroup>
  367. <!--Get Localized string before displaying message-->
  368. <GetPublishingLocalizedString
  369. Importance="High"
  370. Condition="'@(_WebConfigsToInsertEFCodeFirstDeployContext)'!='' And !%(_WebConfigsToInsertEFCodeFirstDeployContext.Exclude) And Exists(%(_WebConfigsToInsertEFCodeFirstDeployContext.TransformOutputFile))"
  371. ID="PublishLocalizedString_InsertEFCodeFirstDeployContextTransformConfigToTransformOutputFile"
  372. ArgumentCount="2"
  373. Arguments="@(_WebConfigsToInsertEFCodeFirstDeployContext->'%(Identity)');%(TransformOutputFile)"
  374. LogType="Message" />
  375. <!--<Message Importance="high"
  376. Condition="'@(_WebConfigsToInsertEFCodeFirstDeployContext)'!='' And !%(_WebConfigsToInsertEFCodeFirstDeployContext.Exclude) And Exists(%(_WebConfigsToInsertEFCodeFirstDeployContext.TransformOutputFile))"
  377. Text="Auto ConnectionString Transformed @(_WebConfigsToInsertEFCodeFirstDeployContext) into %(TransformOutputFile)" />-->
  378. <WriteLinesToFile Condition="$(EnablePackageProcessLoggingAndAssert)"
  379. Encoding="utf-8"
  380. File="$(PackageLogDir)\PostInsertEFCodeFirstDeployWebCofig.txt"
  381. Lines="@(FilesForPackagingFromProject->'
  382. From:%(Identity)
  383. DestinationRelativePath:%(DestinationRelativePath)
  384. Exclude:%(Exclude)
  385. FromTarget:%(FromTarget)
  386. Category:%(Category)
  387. ProjectFileType:%(ProjectFileType)')" Overwrite="True" />
  388. </Target>
  389. <!--********************************************************************-->
  390. <!--Target InsertEFCodeFirstDeployWebCofig-->
  391. <!--**********************************************************************-->
  392. <PropertyGroup>
  393. <InsertEFCodeFirstDeployWebCofigDependsOn>
  394. $(OnBeforeInsertEFCodeFirstDeployWebCofig);
  395. $(InsertEFCodeFirstDeployWebCofigDependsOn);
  396. TransformWebConfig;
  397. HandleEFCodeFirstDataMigration;
  398. ProfileTransformWebConfig;
  399. PreInsertEFCodeFirstDeployWebCofig;
  400. InsertEFCodeFirstDeployWebCofigCore;
  401. PostInsertEFCodeFirstDeployWebCofig;
  402. </InsertEFCodeFirstDeployWebCofigDependsOn>
  403. <InsertEFCodeFirstDeployWebCofigBeforeTargets>
  404. $(InsertEFCodeFirstDeployWebCofigBeforeTargets);
  405. PreAutoParameterizationWebConfigConnectionStrings;
  406. AutoParameterizationWebConfigConnectionStrings;
  407. PipelineMsdeploySpecificTransformPhase;
  408. </InsertEFCodeFirstDeployWebCofigBeforeTargets>
  409. </PropertyGroup>
  410. <Target Name="InsertEFCodeFirstDeployWebCofig"
  411. DependsOnTargets="$(InsertEFCodeFirstDeployWebCofigDependsOn)"
  412. BeforeTargets="$(InsertEFCodeFirstDeployWebCofigBeforeTargets)"
  413. Condition="'$(InsertEFCodeFirstDeployWebCofig)' != 'False'">
  414. </Target>
  415. <Target Name="_GatherDbDacFxDestinationPathes">
  416. <ItemGroup>
  417. <_DbDacFxDestinationPathesToPublish Include="@(_DatabasesToPackage->'%(DestinationPath)')" Condition="'%(_DatabasesToPackage.SourceProvider)' == 'dbDacFx'" />
  418. </ItemGroup>
  419. </Target>
  420. <!--********************************************************************-->
  421. <!-- _CheckDBProvidersAreAvailableAtServer -->
  422. <!--********************************************************************-->
  423. <Target Name="_CheckDBProvidersAreAvailableAtServer"
  424. DependsOnTargets="_GatherDbDacFxDestinationPathes"
  425. Condition="'$(WebPublishMethod)' != 'Package' And '$(MsDeployServiceUrl)' != ''">
  426. <CallTarget Targets="_DetectDbDacFxProvider" RunEachTargetSeparately="false" Condition="'@(_DbDacFxDestinationPathesToPublish)' != ''" />
  427. </Target>
  428. <!--********************************************************************-->
  429. <!-- CollectDatabasesToPublish -->
  430. <!--********************************************************************-->
  431. <PropertyGroup>
  432. <PublishDatabases Condition="'$(PublishDatabases)'==''">True</PublishDatabases>
  433. <CollectDatabasesToPublishDependsOn>
  434. $(CollectDatabasesToPublishDependsOn);
  435. GetMSDeployInstalledVersionPath;
  436. ProcessPublishDatabaseSettings;
  437. _CheckDBProvidersAreAvailableAtServer;
  438. ParseSQLScriptForMSDeployParameters;
  439. HandleEFCodeFirstDataMigration;
  440. InsertEFCodeFirstDeployWebCofig;
  441. </CollectDatabasesToPublishDependsOn>
  442. </PropertyGroup>
  443. <Target Name="CollectDatabasesToPublish" DependsOnTargets="$(CollectDatabasesToPublishDependsOn)" Condition="$(PublishDatabases) And ('$(PublishDatabaseSettings)' != '' Or '$(PublishDatabaseSettingsFile)' != '')">
  444. </Target>
  445. <!--********************************************************************-->
  446. <!-- AddDeclareParametersItemsForDatabaseScript -->
  447. <!--********************************************************************-->
  448. <PropertyGroup>
  449. <BeforeAddDeclareParametersItemsForDatabaseScript Condition="'$(BeforeAddDeclareParametersItemsForDatabaseScript)'==''">
  450. </BeforeAddDeclareParametersItemsForDatabaseScript>
  451. <AfterAddDeclareParametersItemsForDatabaseScript Condition="'$(AfterAddDeclareParametersItemsForDatabaseScript)'==''">
  452. </AfterAddDeclareParametersItemsForDatabaseScript>
  453. <AddDeclareParametersItemsForDatabaseScriptDependsOn>
  454. $(BeforeAddDeclareParametersItemsForDatabaseScript);
  455. CollectDatabasesToPublish;
  456. </AddDeclareParametersItemsForDatabaseScriptDependsOn>
  457. </PropertyGroup>
  458. <Target Name="AddDeclareParametersItemsForDatabaseScript"
  459. DependsOnTargets="$(AddDeclareParametersItemsForDatabaseScriptDependsOn)">
  460. <!--Get localized $(DeployParameterSqlScriptVariablesDescription) from the Task.dll if it wasn't bee set by user.-->
  461. <GetPublishingLocalizedString
  462. Condition="'$(DeployParameterSqlScriptVariablesDescription)'==''"
  463. ID="PublishLocalizedString_SqlCommandVariableParameterDescription">
  464. <Output TaskParameter="Result" PropertyName="DeployParameterSqlScriptVariablesDescription" />
  465. </GetPublishingLocalizedString>
  466. <!--Get localized $(DeployParameterIISAppConnectionStringDescription) from the Task.dll if it wasn't bee set by user.-->
  467. <GetPublishingLocalizedString
  468. Condition="'$(DeployParameterIISAppConnectionStringDescription)'=='' And !$(DeployParameterAutoDescriptionbyTags)"
  469. ID="PublishLocalizedString_DatabaseConnectionStringParameterDescription">
  470. <Output TaskParameter="Result" PropertyName="DeployParameterIISAppConnectionStringDescription" />
  471. </GetPublishingLocalizedString>
  472. <!--if $(DeployParameterAutoDescriptionbyTags), we turn off the description.-->
  473. <DeployParameterIISAppConnectionStringDescription Condition="'$(DeployParameterIISAppConnectionStringDescription)'!='' And $(DeployParameterAutoDescriptionbyTags)"></DeployParameterIISAppConnectionStringDescription>
  474. <ItemGroup Condition="!$(DisableAllVSGeneratedMSDeployParameter)">
  475. <_VsPublish_DatabaseToPackage_DeclareParameters Include="@(_DatabasesToPackage->'$(DeployParameterPrefix)%(DestinationGroup)-Deployment Connection String')"
  476. Condition="'%(_DatabasesToPackage.Identity)' !='' And '%(_DatabasesToPackage.SourceProvider)' != 'DbCodeFirst' ">
  477. <Kind>ProviderPath</Kind>
  478. <Scope>%(_DatabasesToPackage.SourceProvider)</Scope>
  479. <Match>^%(_DatabasesToPackage.SourcePath_RegExExcaped)$</Match>
  480. <Description>$(DeployParameterIISAppConnectionStringDescription)</Description>
  481. <DefaultValue>%(_DatabasesToPackage.DestinationPath)</DefaultValue>
  482. <Value>%(_DatabasesToPackage.DestinationPath)</Value>
  483. <Tags>$(MsDeployDatabaseTag)</Tags>
  484. </_VsPublish_DatabaseToPackage_DeclareParameters>
  485. <_VsPublish_DatabaseToPackage_DeclareParameters Include="@(_DatabasesToPackage_SqlVariables->'$(DeployParameterPrefix)Sql script variable %24(%(Identity)) in %(DestinationGroup) scripts')"
  486. Condition="$(EnableSqlScriptVariableParameterize) And '%(_DatabasesToPackage_SqlVariables.Identity)' !=''">
  487. <Kind>$(MsDeploySqlCommandVariableKind)</Kind>
  488. <Scope>^%(_DatabasesToPackage_SqlVariables.SourcePath_RegExExcaped)$</Scope>
  489. <Match>%(_DatabasesToPackage_SqlVariables.Identity)</Match>
  490. <Description>$(DeployParameterSqlScriptVariablesDescription)</Description>
  491. <DefaultValue>%(_DatabasesToPackage_SqlVariables.Value)</DefaultValue>
  492. <Value>%(_DatabasesToPackage_SqlVariables.Value)</Value>
  493. <Tags>sql</Tags>
  494. </_VsPublish_DatabaseToPackage_DeclareParameters>
  495. <!--Work around the TSData script when there are Sqlcommand variable that declare as Empty string-->
  496. <_VsPublish_DatabaseToPackage_DeclareParameters Include="@(_DatabasesToPackage_SqlVariables->'$(DeployParameterPrefix)Sql script variable %24(%(Identity)) in %(DestinationGroup) scripts')"
  497. Condition="$(EnableSqlScriptVariableParameterize) and '%(_DatabasesToPackage_SqlVariables.Identity)' !='' and ('%(_DatabasesToPackage_SqlVariables.Value)' == '') and ('%(_DatabasesToPackage_SqlVariables.IsDeclared)' == 'true') ">
  498. <Element>parameterValidation</Element>
  499. <Kind>AllowEmpty</Kind>
  500. </_VsPublish_DatabaseToPackage_DeclareParameters>
  501. <MsDeployDeclareParameters Include="@(_VsPublish_DatabaseToPackage_DeclareParameters)">
  502. <Priority>$(VsSQLDatabaseScriptParametersPriority)</Priority>
  503. </MsDeployDeclareParameters>
  504. </ItemGroup>
  505. <CallTarget Targets="$(AfterAddDeclareParametersItemsForDatabaseScript)" RunEachTargetSeparately="false" Condition="'$(AfterAddDeclareParametersItemsForDatabaseScript)' != ''" />
  506. </Target>
  507. <!--********************************************************************-->
  508. <!-- AddDatabasesToSourceManifest -->
  509. <!--********************************************************************-->
  510. <PropertyGroup>
  511. <WriteItemsToSourceManifestDependsOn>
  512. $(WriteItemsToSourceManifestDependsOn);
  513. AddDatabasesToSourceManifest;
  514. </WriteItemsToSourceManifestDependsOn>
  515. </PropertyGroup>
  516. <PropertyGroup>
  517. <BeforeAddDatabasesToSourceManifest Condition="'$(BeforeAddDatabasesToSourceManifest)'==''">
  518. </BeforeAddDatabasesToSourceManifest>
  519. <AfterAddDatabasesToSourceManifest Condition="'$(AfterAddDatabasesToSourceManifest)'==''">
  520. </AfterAddDatabasesToSourceManifest>
  521. <AddDatabasesToSourceManifestDependsOn>
  522. $(BeforeAddDatabasesToSourceManifest);
  523. CollectDatabasesToPublish;
  524. </AddDatabasesToSourceManifestDependsOn>
  525. <AddDatabasesToSourceManifestAfterTargets>
  526. $(AddDatabasesToSourceManifestAfterTargets);
  527. AddIisSettingAndFileContentsToSourceManifest;
  528. </AddDatabasesToSourceManifestAfterTargets>
  529. </PropertyGroup>
  530. <Target Name="AddDatabasesToSourceManifest"
  531. DependsOnTargets="$(AddDatabasesToSourceManifestDependsOn)">
  532. <ItemGroup>
  533. <MsDeploySourceManifest Include="@(_DatabasesToSourceManifest)" Condition="'%(_DatabasesToSourceManifest.Identity)' != 'DbCodeFirst'"/>
  534. </ItemGroup>
  535. <CallTarget Targets="$(AfterAddDatabasesToSourceManifest)" RunEachTargetSeparately="false" Condition="'$(AfterAddDatabasesToSourceManifest)' != ''" />
  536. </Target>
  537. <!--***********************************************************************-->
  538. <!--GenerateSampleDeployScript task-->
  539. <!--***********************************************************************-->
  540. <PropertyGroup>
  541. <GenerateSampleDeployScriptDependsOn Condition="'$(GenerateSampleDeployScriptDependsOn)'==''">
  542. GetMSDeployInstalledVersionPath;
  543. GenerateMsDeployManifestSettings;
  544. GenerateMsdeployManifestFiles;
  545. </GenerateSampleDeployScriptDependsOn>
  546. <GenerateSampleDeployScriptAfterTargets>
  547. $(GenerateSampleDeployScriptAfterTargets);
  548. PackageUsingManifest;
  549. </GenerateSampleDeployScriptAfterTargets>
  550. </PropertyGroup>
  551. <Target Condition="$(GenerateSampleDeployScript)"
  552. Name="GenerateSampleDeployScript"
  553. DependsOnTargets="$(GenerateSampleDeployScriptDependsOn)"
  554. AfterTargets="$(GenerateSampleDeployScriptAfterTargets)">
  555. <!--Get Localized string before displaying message-->
  556. <GetPublishingLocalizedString
  557. Importance="Low"
  558. ID="PublishLocalizedString_GenerateSampleMsdeployBatchScript"
  559. LogType="Message" />
  560. <!--<Message Text="GenerateSampleDeployScript the package..." Importance="low"/>-->
  561. <PropertyGroup>
  562. <!--
  563. MSDeployPublishSourceType can be
  564. SingleFilePackage(a single ziped file package)
  565. Manifest(a file with Iis VDir info plus file pathes)
  566. RawIisVDir(Let MSDeploy published all files underneath the phisical path)
  567. ArchiveDir(a folder genearated by package with all files to be transferred)
  568. -->
  569. <!--So far, if we see the single file package, we pick it up; otherwise, we GenerateSampleDeployScript from Iis vdir -->
  570. <GenerateSampleDeployScriptSourceType>manifest</GenerateSampleDeployScriptSourceType>
  571. <GenerateSampleDeployScriptSourceFileName>@(_MSDeploySourceManifest->'%(FileName)%(Extension)')</GenerateSampleDeployScriptSourceFileName>
  572. <GenerateSampleDeployScriptSourceType Condition="$(_CreatePackage) And $(PackageAsSingleFile)">package</GenerateSampleDeployScriptSourceType>
  573. <GenerateSampleDeployScriptSourceFileName Condition="$(_CreatePackage) And $(PackageAsSingleFile)">@(_MSDeployPackageFile->'%(FileName)%(Extension)')</GenerateSampleDeployScriptSourceFileName>
  574. <GenerateSampleDeployScriptSourceType Condition="$(_CreatePackage) And !$(PackageAsSingleFile)">archiveDir</GenerateSampleDeployScriptSourceType>
  575. <GenerateSampleDeployScriptSourceFileName Condition="$(_CreatePackage) And !$(PackageAsSingleFile)">@(_MSDeployArchiveDir->'%(FileName)%(Extension)')</GenerateSampleDeployScriptSourceFileName>
  576. <GenerateSampleDeployScriptSourceRoot>%25RootPath%25$(GenerateSampleDeployScriptSourceFileName)</GenerateSampleDeployScriptSourceRoot>
  577. <GenerateSampleDeployScriptDestinationType>%25_Destination%25</GenerateSampleDeployScriptDestinationType>
  578. <GenerateSampleDeployScriptDestinationRoot></GenerateSampleDeployScriptDestinationRoot>
  579. <GenerateSampleDeployScriptParameters>@(_MSDeploySampleParametersValue->'%25RootPath%25%(FileName)%(Extension)')</GenerateSampleDeployScriptParameters>
  580. <_ScriptGenerateSampleDeployScriptReadMeLocation>%25RootPath%25$(GenerateSampleDeployScriptReadMeFileName)</_ScriptGenerateSampleDeployScriptReadMeLocation>
  581. <_MSdeployFwdLink>http://go.microsoft.com/?linkid=9278654</_MSdeployFwdLink>
  582. <_SampleDeployCmdFwdLink>http://go.microsoft.com/fwlink/?LinkID=183544</_SampleDeployCmdFwdLink>
  583. </PropertyGroup>
  584. <ItemGroup>
  585. <_MsDeployDeclareParametersNotExclude Include="@(MsDeployDeclareParameters)" Condition="'%(ExcludeFromSetParameter)' != true and '%(MsDeployDeclareParameters.Identity)' !=''" />
  586. </ItemGroup>
  587. <SortParametrsByPriority Parameters="@(_MsDeployDeclareParametersNotExclude)"
  588. OptimisticParameterDefaultValue="$(EnableOptimisticParameterDefaultValue)"
  589. OptimisticParameterMetadataName="Value"
  590. >
  591. <Output TaskParameter="Result" ItemName="_SortedMsDeployDeclareParameters"/>
  592. </SortParametrsByPriority>
  593. <RemoveDuplicates Inputs="@(_SortedMsDeployDeclareParameters)">
  594. <Output TaskParameter="Filtered" ItemName="_SampleSetParametersFiltered"/>
  595. </RemoveDuplicates>
  596. <ItemGroup>
  597. <MsDeploySourceProviderSetting Remove="@(MsDeploySourceProviderSetting)" />
  598. <MsDeploySourceProviderSetting Include="$(GenerateSampleDeployScriptSourceType)">
  599. <Path>$(GenerateSampleDeployScriptSourceRoot)</Path>
  600. <EncryptPassword>$(DeployEncryptKey)</EncryptPassword>
  601. </MsDeploySourceProviderSetting>
  602. <MsDeployDestinationProviderSetting Remove="@(MsDeployDestinationProviderSetting)" />
  603. <MsDeployDestinationProviderSetting Include="$(GenerateSampleDeployScriptDestinationType)">
  604. <Path>$(GenerateSampleDeployScriptDestinationRoot)</Path>
  605. <EncryptPassword>$(DeployEncryptKey)</EncryptPassword>
  606. </MsDeployDestinationProviderSetting>
  607. </ItemGroup>
  608. <!--Debug/Diagnostic message is not localized-->
  609. <Message Text="GenerateSampleDeployScript MsDeploySourceProviderSetting is @(MsDeploySourceProviderSetting)" Condition="$(EnablePackageProcessLoggingAndAssert)" />
  610. <Message Text="GenerateSampleDeployScript MsDeployDestinationProviderSetting is @(MsDeployDestinationProviderSetting)" Condition="$(EnablePackageProcessLoggingAndAssert)"/>
  611. <!--Generate the command line script for straight deploy-->
  612. <MSdeploy
  613. PreviewCommandLineOnly="True"
  614. Verb="sync"
  615. Source="@(MsDeploySourceProviderSetting)"
  616. Destination="@(MsDeployDestinationProviderSetting)"
  617. DisableLink="$(PublishDisableLinks)"
  618. EnableLink="$(PublishEnableLinks)"
  619. SkipRuleItems="@(MsDeploySkipRules)"
  620. ExePath="%25MSDeployPath%25">
  621. <Output TaskParameter="CommandLine" PropertyName="_SampleDeployScript" />
  622. </MSdeploy>
  623. <MSdeploy
  624. PreviewCommandLineOnly="True"
  625. Verb="sync"
  626. Source="@(MsDeploySourceProviderSetting)"
  627. Destination="@(MsDeployDestinationProviderSetting)"
  628. DisableLink="$(PublishDisableLinks)"
  629. EnableLink="$(PublishEnableLinks)"
  630. SkipRuleItems="@(MsDeploySkipRules)"
  631. ImportSetParametersItems="%25_DeploySetParametersFile%25"
  632. ExePath="%25MSDeployPath%25">
  633. <Output TaskParameter="CommandLine" PropertyName="_SampleDeployScriptOnSetParametersFile" />
  634. </MSdeploy>
  635. <!--Generate the command line script for the what-if msdeploy-->
  636. <MSdeploy
  637. PreviewCommandLineOnly="True"
  638. WhatIf="True"
  639. Verb="sync"
  640. Source="@(MsDeploySourceProviderSetting)"
  641. Destination="@(MsDeployDestinationProviderSetting)"
  642. DisableLink="$(PublishDisableLinks)"
  643. EnableLink="$(PublishEnableLinks)"
  644. SkipRuleItems="@(MsDeploySkipRules)"
  645. ImportSetParametersItems="%25_DeploySetParametersFile%25"
  646. ExePath="%25MSDeployPath%25">
  647. <Output TaskParameter="CommandLine" PropertyName="_SampleDeployScriptOnSetParametersFileWithWhatIf" />
  648. </MSdeploy>
  649. <!--Generate the Set Parameter file-->
  650. <ExportParametersFile
  651. Parameters="@(_SampleSetParametersFiltered)"
  652. OptimisticParameterDefaultValue="$(EnableOptimisticParameterDefaultValue)"
  653. SetParameterFile="$(GenerateSampleParametersValueLocation)"
  654. GenerateFileEvenIfEmpty="True"
  655. />
  656. <ItemGroup>
  657. <FileWrites Include="$(GenerateSampleParametersValueLocation)" />
  658. </ItemGroup>
  659. <!--Now write the sample batch file. Note this relies on the fact that the Batch file should be under the same location as the package and manifestfiles -->
  660. <!--Note that by default Command line file only support the ANSI. Even if we code it against utf-8, the cmd.exe won't be able to handle it.
  661. Only the package and setparameters.xml file name matter. You change the deploy parameters into setparameters.xml which support utf-8 properly.-->
  662. <WriteLinesToFile File="$(GenerateSampleDeployScriptLocation)"
  663. Overwrite="True"
  664. Encoding="us-ascii"
  665. Lines="@rem ---------------------------------------------------------------------------------
  666. @rem Copyright 2008 Microsoft Corporation. All rights reserved.
  667. @rem This is provided as sample to deploy the package using msdeploy.exe
  668. @rem For information about IIS Web Deploy technology,
  669. @rem please visit $(_MSdeployFwdLink)
  670. @rem Note: This batch file assumes the package and setparametsrs.xml are in the same folder with this file
  671. @rem ---------------------------------------------------------------------------------
  672. @if %_echo%!==! echo off
  673. setlocal
  674. @rem ---------------------------------------------------------------------------------
  675. @rem Please Make sure you have Web Deploy install in your machine.
  676. @rem Alternatively, you can explicit set the MsDeployPath to the location it is on your machine
  677. @rem set MSDeployPath=&quot;$(MSDeployPath)&quot;
  678. @rem ---------------------------------------------------------------------------------
  679. @rem ---------------------------------------------------------------------------------
  680. @rem if user does not set MsDeployPath environment variable, we will try to retrieve it from registry.
  681. @rem ---------------------------------------------------------------------------------
  682. if &quot;%MSDeployPath%&quot; == &quot;&quot; (
  683. for /F &quot;usebackq tokens=1,2,*&quot; %%h in (`reg query &quot;HKLM\SOFTWARE\Microsoft\IIS Extensions\MSDeploy&quot; /s ^| findstr -i &quot;InstallPath&quot;`) do (
  684. if /I &quot;%%h&quot; == &quot;InstallPath&quot; (
  685. if /I &quot;%%i&quot; == &quot;REG_SZ&quot; (
  686. if not &quot;%%j&quot; == &quot;&quot; (
  687. if &quot;%%~dpj&quot; == &quot;%%j&quot; (
  688. set MSDeployPath=%%j
  689. ))))))
  690. @rem ------------------------------------------
  691. $(_GenerateSampleDeployScript_Set_MSDeployPath)
  692. @rem ------------------------------------------
  693. if not exist &quot;%MSDeployPath%msdeploy.exe&quot; (
  694. echo. msdeploy.exe is not found on this machine. Please install Web Deploy before execute the script.
  695. echo. Please visit $(_MSdeployFwdLink)
  696. goto :usage
  697. )
  698. set RootPath=%~dp0
  699. if /I &quot;%_DeploySetParametersFile%&quot; == &quot;&quot; (
  700. set _DeploySetParametersFile=$(GenerateSampleDeployScriptParameters)
  701. )
  702. @rem ------------------------------------------
  703. $(_GenerateSampleDeployScript_Set_DeploySetParametersFile)
  704. @rem ------------------------------------------
  705. set _ArgTestDeploy=
  706. set _ArgDestinationType=auto
  707. set _ArgComputerNameWithQuote=&quot;&quot;
  708. set _ArgUserNameWithQuote=&quot;&quot;
  709. set _ArgPasswordWithQuote=&quot;&quot;
  710. set _ArgEncryptPasswordWithQuote=&quot;&quot;
  711. set _ArgIncludeAclsWithQuote=&quot;False&quot;
  712. set _ArgAuthTypeWithQuote=&quot;&quot;
  713. set _ArgtempAgentWithQuote=&quot;&quot;
  714. set _ArgLocalIIS=
  715. set _ArgLocalIISVersion=
  716. set _HaveArgMSDeployAdditonalFlags=
  717. @rem ---------------------------------------------------------------------------------
  718. @rem Simple Parse the arguments
  719. @rem ---------------------------------------------------------------------------------
  720. :NextArgument
  721. set _ArgCurrent=%~1
  722. set _ArgFlagFirst=%_ArgCurrent:~0,1%
  723. set _ArgFlag=%_ArgCurrent:~0,3%
  724. set _ArgValue=%_ArgCurrent:~3%
  725. if /I &quot;%_ArgFlag%&quot; == &quot;&quot; goto :GetStarted
  726. if /I &quot;%_ArgFlag%&quot; == &quot;~0,3&quot; goto :GetStarted
  727. if /I &quot;%_ArgFlag%&quot; == &quot;/T&quot; set _ArgTestDeploy=true&amp;goto :ArgumentOK
  728. if /I &quot;%_ArgFlag%&quot; == &quot;/Y&quot; set _ArgTestDeploy=false&amp;goto :ArgumentOK
  729. if /I &quot;%_ArgFlag%&quot; == &quot;/L&quot; set _ArgLocalIIS=true&amp;goto :ArgumentOK
  730. if /I &quot;%_ArgFlag%&quot; == &quot;/M:&quot; set _ArgComputerNameWithQuote=&quot;%_ArgValue%&quot;&amp;goto :ArgumentOK
  731. if /I &quot;%_ArgFlag%&quot; == &quot;/U:&quot; set _ArgUserNameWithQuote=&quot;%_ArgValue%&quot;&amp;goto :ArgumentOK
  732. if /I &quot;%_ArgFlag%&quot; == &quot;/P:&quot; set _ArgPasswordWithQuote=&quot;%_ArgValue%&quot;&amp;goto :ArgumentOK
  733. if /I &quot;%_ArgFlag%&quot; == &quot;/E:&quot; set _ArgEncryptPasswordWithQuote=&quot;%_ArgValue%&quot;&amp;goto :ArgumentOK
  734. if /I &quot;%_ArgFlag%&quot; == &quot;/I:&quot; set _ArgIncludeAclsWithQuote=&quot;%_ArgValue%&quot;&amp;goto :ArgumentOK
  735. if /I &quot;%_ArgFlag%&quot; == &quot;/A:&quot; set _ArgAuthTypeWithQuote=&quot;%_ArgValue%&quot;&amp;goto :ArgumentOK
  736. if /I &quot;%_ArgFlag%&quot; == &quot;/G:&quot; set _ArgtempAgentWithQuote=&quot;%_ArgValue%&quot;&amp;goto :ArgumentOK
  737. @rem Any addition flags, pass through to the msdeploy
  738. if &quot;%_HaveArgMSDeployAdditonalFlags%&quot; == &quot;&quot; (
  739. goto :Assign_ArgMsDeployAdditionalFlags
  740. )
  741. set _ArgMsDeployAdditionalFlags=%_ArgMsDeployAdditionalFlags:&amp;=^&amp;% %_ArgCurrent:&amp;=^&amp;%
  742. set _HaveArgMSDeployAdditonalFlags=1
  743. goto :ArgumentOK
  744. :Assign_ArgMsDeployAdditionalFlags
  745. set _ArgMsDeployAdditionalFlags=%_ArgCurrent:&amp;=^&amp;%
  746. set _HaveArgMSDeployAdditonalFlags=1
  747. goto :ArgumentOK
  748. :ArgumentOK
  749. shift
  750. goto :NextArgument
  751. :GetStarted
  752. @rem ------------------------------------------
  753. $(_GenerateSampleDeployScript_AfterParseArguments)
  754. @rem ------------------------------------------
  755. if /I &quot;%_ArgTestDeploy%&quot; == &quot;&quot; goto :usage
  756. if /I &quot;%_ArgDestinationType%&quot; == &quot;&quot; goto :usage
  757. set _Destination=%_ArgDestinationType%
  758. if not %_ArgComputerNameWithQuote% == &quot;&quot; set _Destination=%_Destination%,computerName=%_ArgComputerNameWithQuote%
  759. if not %_ArgUserNameWithQuote% == &quot;&quot; set _Destination=%_Destination%,userName=%_ArgUserNameWithQuote%
  760. if not %_ArgPasswordWithQuote% == &quot;&quot; set _Destination=%_Destination%,password=%_ArgPasswordWithQuote%
  761. if not %_ArgAuthTypeWithQuote% == &quot;&quot; set _Destination=%_Destination%,authtype=%_ArgAuthTypeWithQuote%
  762. if not %_ArgEncryptPasswordWithQuote% == &quot;&quot; set _Destination=%_Destination%,encryptPassword=%_ArgEncryptPasswordWithQuote%
  763. if not %_ArgIncludeAclsWithQuote% == &quot;&quot; set _Destination=%_Destination%,includeAcls=%_ArgIncludeAclsWithQuote%
  764. if not %_ArgtempAgentWithQuote% == &quot;&quot; set _Destination=%_Destination%,tempAgent=%_ArgtempAgentWithQuote%
  765. @rem ------------------------------------------
  766. $(_GenerateSampleDeployScript_AfterSet_Destination)
  767. @rem ------------------------------------------
  768. @rem ---------------------------------------------------------------------------------
  769. @rem add -whatif when -T is specified
  770. @rem ---------------------------------------------------------------------------------
  771. if /I &quot;%_ArgTestDeploy%&quot; NEQ &quot;false&quot; (
  772. set _MsDeployAdditionalFlags=-whatif %_MsDeployAdditionalFlags%
  773. )
  774. @rem ------------------------------------------
  775. $(_GenerateSampleDeployScript_AfterSet_WhatIf)
  776. @rem ------------------------------------------
  777. @rem ---------------------------------------------------------------------------------
  778. @rem add flags for IISExpress when -L is specified
  779. @rem ---------------------------------------------------------------------------------
  780. if /I &quot;%_ArgLocalIIS%&quot; == &quot;true&quot; (
  781. call :SetIISExpressArguments
  782. )
  783. if /I &quot;%_ArgLocalIIS%&quot; == &quot;true&quot; (
  784. if not exist &quot;%IISExpressPath%%IISExpressManifest%&quot; (
  785. echo. IISExpress is not found on this machine. Please install through Web Platform Installer before execute the script.
  786. echo. or remove /L flag
  787. echo. Please visit $(_MSdeployFwdLink)
  788. goto :usage
  789. )
  790. if not exist &quot;%IISExpressUserProfileDirectory%&quot; (
  791. echo. %IISExpressUserProfileDirectory% is not exists
  792. echo. IISExpress is found on the machine. But the user have run IISExpress at least once.
  793. echo. Please visit $(_MSdeployFwdLink) for detail
  794. goto :usage
  795. )
  796. set _MsDeployAdditionalFlags=%_MsDeployAdditionalFlags% -appHostConfigDir:%IISExpressUserProfileDirectory% -WebServerDir:&quot;%IISExpressPath%&quot; -webServerManifest:&quot;%IISExpressManifest%&quot;
  797. )
  798. @rem ---------------------------------------------------------------------------------
  799. @rem check the existence of the package file
  800. @rem ---------------------------------------------------------------------------------
  801. if not exist &quot;$(GenerateSampleDeployScriptSourceRoot)&quot; (
  802. echo &quot;$(GenerateSampleDeployScriptSourceRoot)&quot; does not exist.
  803. echo This batch file relies on this deploy source file^(s^) in the same folder.
  804. goto :usage
  805. )
  806. @rem ---------------------------------------------
  807. $(_GenerateSampleDeployScript_BeforeExecuteMsDeployExe)
  808. @rem ---------------------------------------------
  809. @rem ---------------------------------------------------------------------------------
  810. @rem Execute msdeploy.exe command line
  811. @rem ---------------------------------------------------------------------------------
  812. call :CheckParameterFile
  813. echo. Start executing msdeploy.exe
  814. echo -------------------------------------------------------
  815. if not exist &quot;%_DeploySetParametersFile%&quot; (
  816. set _MSDeployCommandline=$(_SampleDeployScript)
  817. ) else (
  818. set _MSDeployCommandline=$(_SampleDeployScriptOnSetParametersFile)
  819. )
  820. if &quot;%_HaveArgMSDeployAdditonalFlags%&quot; == &quot;&quot; (
  821. goto :MSDeployWithOutArgMsDeployAdditionalFlag
  822. )
  823. goto :MSDeployWithArgMsDeployAdditionalFlag
  824. goto :eof
  825. @rem ---------------------------------------------------------------------------------
  826. @rem MSDeployWithArgMsDeployAdditionalFlag
  827. @rem ---------------------------------------------------------------------------------
  828. :MSDeployWithArgMsDeployAdditionalFlag
  829. echo. %_MSDeployCommandline% %_MsDeployAdditionalFlags% %_ArgMsDeployAdditionalFlags:&amp;=^&amp;%
  830. %_MSDeployCommandline% %_MsDeployAdditionalFlags% %_ArgMsDeployAdditionalFlags:&amp;=^&amp;%
  831. goto :eof
  832. @rem ---------------------------------------------------------------------------------
  833. @rem MSDeployWithOutArgMsDeployAdditionalFlag
  834. @rem ---------------------------------------------------------------------------------
  835. :MSDeployWithOutArgMsDeployAdditionalFlag
  836. echo. %_MSDeployCommandline% %_MsDeployAdditionalFlags%
  837. %_MSDeployCommandline% %_MsDeployAdditionalFlags%
  838. goto :eof
  839. @rem ---------------------------------------------------------------------------------
  840. @rem Find and set IISExpress argument.
  841. @rem ---------------------------------------------------------------------------------
  842. :SetIISExpressArguments
  843. if &quot;%IISExpressPath%&quot; == &quot;&quot; (
  844. for /F &quot;usebackq tokens=1,2,*&quot; %%h in (`reg query &quot;HKLM\SOFTWARE\Microsoft\IISExpress&quot; /s ^| findstr -i &quot;InstallPath&quot;`) do (
  845. if /I &quot;%%h&quot; == &quot;InstallPath&quot; (
  846. if /I &quot;%%i&quot; == &quot;REG_SZ&quot; (
  847. if not &quot;%%j&quot; == &quot;&quot; (
  848. if &quot;%%~dpj&quot; == &quot;%%j&quot; (
  849. set IISExpressPath=%%j
  850. ))))))
  851. if &quot;%IISExpressPath%&quot; == &quot;&quot; (
  852. for /F &quot;usebackq tokens=1,2,*&quot; %%h in (`reg query &quot;HKLM\SOFTWARE\Wow6432Node\Microsoft\IISExpress&quot; /s ^| findstr -i &quot;InstallPath&quot;`) do (
  853. if /I &quot;%%h&quot; == &quot;InstallPath&quot; (
  854. if /I &quot;%%i&quot; == &quot;REG_SZ&quot; (
  855. if not &quot;%%j&quot; == &quot;&quot; (
  856. if &quot;%%~dpj&quot; == &quot;%%j&quot; (
  857. set IISExpressPath=%%j
  858. ))))))
  859. if &quot;%PersonalDocumentFolder%&quot; == &quot;&quot; (
  860. for /F &quot;usebackq tokens=2*&quot; %%i in (`reg query &quot;HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders&quot; /v Personal`) do (
  861. set PersonalDocumentFolder=%%j
  862. ))
  863. if &quot;%IISExpressManifest%&quot; == &quot;&quot; (
  864. for /F &quot;usebackq tokens=1,2,*&quot; %%h in (`reg query &quot;HKLM\SOFTWARE\Microsoft\IISExpress&quot; /s ^| findstr -i &quot;Manifest&quot;`) do (
  865. if /I &quot;%%h&quot; == &quot;Manifest&quot; (
  866. if /I &quot;%%i&quot; == &quot;REG_SZ&quot; (
  867. if not &quot;%%j&quot; == &quot;&quot; (
  868. set IISExpressManifest=%%j
  869. )))))
  870. if &quot;%IISExpressManifest%&quot; == &quot;&quot; (
  871. for /F &quot;usebackq tokens=1,2,*&quot; %%h in (`reg query &quot;HKLM\SOFTWARE\Wow6432Node\Microsoft\IISExpress&quot; /s ^| findstr -i &quot;Manifest&quot;`) do (
  872. if /I &quot;%%h&quot; == &quot;Manifest&quot; (
  873. if /I &quot;%%i&quot; == &quot;REG_SZ&quot; (
  874. if not &quot;%%j&quot; == &quot;&quot; (
  875. set IISExpressManifest=%%j
  876. )))))
  877. set IISExpressUserProfileDirectory=&quot;%PersonalDocumentFolder%\IISExpress\config&quot;
  878. @rem ---------------------------------------------
  879. $(_GenerateSampleDeployScript_AfterSetIISexpressRelatedVariable)
  880. @rem ---------------------------------------------
  881. goto :eof
  882. @rem ---------------------------------------------------------------------------------
  883. @rem CheckParameterFile -- check if the package's setparamters.xml exists or not
  884. @rem ---------------------------------------------------------------------------------
  885. :CheckParameterFile
  886. if exist &quot;%_DeploySetParametersFile%&quot; (
  887. echo SetParameters from:
  888. echo &quot;%_DeploySetParametersFile%&quot;
  889. echo You can change IIS Application Name, Physical path, connectionString
  890. echo or other deploy parameters in the above file.
  891. ) else (
  892. echo SetParamterFiles does not exist in package location.
  893. echo Use package embedded defaultValue to deploy.
  894. )
  895. echo -------------------------------------------------------
  896. goto :eof
  897. @rem ---------------------------------------------------------------------------------
  898. @rem Usage
  899. @rem ---------------------------------------------------------------------------------
  900. :usage
  901. echo =========================================================
  902. if not exist &quot;$(_ScriptGenerateSampleDeployScriptReadMeLocation)&quot; (
  903. echo Usage:%~nx0 [/T^|/Y] [/M:ComputerName] [/U:userName] [/P:password] [/G:tempAgent] [additional msdeploy flags ...]
  904. echo Required flags:
  905. echo /T Calls msdeploy.exe with the &quot;-whatif&quot; flag, which simulates deployment.
  906. echo /Y Calls msdeploy.exe without the &quot;-whatif&quot; flag, which deploys the package to the current machine or destination server
  907. echo Optional flags:
  908. echo. By Default, this script deploy to the current machine where this script is invoked which will use current user credential without tempAgent.
  909. echo. Only pass these arguments when in advance scenario.
  910. echo /M: Msdeploy destination name of remote computer or proxy-URL. Default is local.
  911. echo /U: Msdeploy destination user name.
  912. echo /P: Msdeploy destination password.
  913. echo /G: Msdeploy destination tempAgent. True or False. Default is false.
  914. echo /A: specifies the type of authentication to be used. The possible values are NTLM and Basic. If the wmsvc provider setting is specified, the default authentication type is Basic; otherwise, the default authentication type is NTLM.
  915. echo /L: Deploy to Local IISExpress User Instance.
  916. echo.[additional msdeploy flags]: note: &quot; is required for passing = through command line.
  917. echo &quot;-skip:objectName=setAcl&quot; &quot;-skip:objectName=dbFullSql&quot;
  918. echo.Alternative environment variable _MsDeployAdditionalFlags is also honored.
  919. echo.
  920. echo. Please make sure MSDeploy is installed in the box $(_MSdeployFwdLink)
  921. echo.
  922. echo In addition, you can change IIS Application Name, Physical path,
  923. echo connectionString and other deploy parameters in the following file:
  924. echo &quot;%_DeploySetParametersFile%&quot;
  925. echo.
  926. echo For more information about this batch file, visit $(_SampleDeployCmdFwdLink)
  927. ) else (
  928. start notepad &quot;$(_ScriptGenerateSampleDeployScriptReadMeLocation)&quot;
  929. )
  930. echo =========================================================
  931. goto :eof
  932. "/>
  933. <ItemGroup>
  934. <FileWrites Include="$(GenerateSampleDeployScriptLocation)" />
  935. </ItemGroup>
  936. <!--Force evaluation of the $(GenerateSampleDeployScriptLocation)-->
  937. <CreateProperty Value="$(GenerateSampleDeployScriptLocation)">
  938. <Output TaskParameter="Value" PropertyName="_GenerateSampleDeployScriptLocation"/>
  939. </CreateProperty>
  940. <!--Generate localized readme.txt for this batch file-->
  941. <GetPublishingLocalizedString
  942. ID="PublishLocalizedString_SampleScriptHelpPrerequisites"
  943. ArgumentCount="3"
  944. Arguments="$(_MSdeployFwdLink);$(GenerateSampleDeployScriptSourceFileName);$(GenerateSampleParametersValueFileName)">
  945. <Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
  946. </GetPublishingLocalizedString>
  947. <GetPublishingLocalizedString
  948. ID="PublishLocalizedString_SampleScriptHelpSection1"
  949. ArgumentCount="1"
  950. Arguments="$([System.IO.Path]::GetFileName($(_GenerateSampleDeployScriptLocation)))">
  951. <Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
  952. </GetPublishingLocalizedString>
  953. <GetPublishingLocalizedString
  954. ID="PublishLocalizedString_SampleScriptHelpRequired">
  955. <Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
  956. </GetPublishingLocalizedString>
  957. <GetPublishingLocalizedString
  958. ID="PublishLocalizedString_SampleScriptHelpRequiredExplainedFlagT">
  959. <Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
  960. </GetPublishingLocalizedString>
  961. <GetPublishingLocalizedString
  962. ID="PublishLocalizedString_SampleScriptHelpRequiredExplainedFlagY">
  963. <Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
  964. </GetPublishingLocalizedString>
  965. <GetPublishingLocalizedString
  966. ID="PublishLocalizedString_SampleScriptHelpOptional">
  967. <Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
  968. </GetPublishingLocalizedString>
  969. <GetPublishingLocalizedString
  970. ID="PublishLocalizedString_SampleScriptHelpOptionalExplainedFlagM">
  971. <Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
  972. </GetPublishingLocalizedString>
  973. <GetPublishingLocalizedString
  974. ID="PublishLocalizedString_SampleScriptHelpOptionalExplainedFlagUP">
  975. <Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
  976. </GetPublishingLocalizedString>
  977. <GetPublishingLocalizedString
  978. ID="PublishLocalizedString_SampleScriptHelpOptionalExplainedFlagG">
  979. <Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
  980. </GetPublishingLocalizedString>
  981. <GetPublishingLocalizedString
  982. ID="PublishLocalizedString_SampleScriptHelpOptionalExplainedFlagA">
  983. <Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
  984. </GetPublishingLocalizedString>
  985. <GetPublishingLocalizedString
  986. ID="PublishLocalizedString_SampleScriptHelpOptionalExplainedFlagL">
  987. <Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
  988. </GetPublishingLocalizedString>
  989. <GetPublishingLocalizedString
  990. ID="PublishLocalizedString_SampleScriptHelpOptionalExplainedAdditionalFlags">
  991. <Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
  992. </GetPublishingLocalizedString>
  993. <GetPublishingLocalizedString
  994. ID="PublishLocalizedString_SampleScriptHelpEnviroment">
  995. <Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
  996. </GetPublishingLocalizedString>
  997. <GetPublishingLocalizedString
  998. ID="PublishLocalizedString_SampleScriptHelpEnviromentExplained"
  999. ArgumentCount="1"
  1000. Arguments="$(GenerateSampleParametersValueFileName)">
  1001. <Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
  1002. </GetPublishingLocalizedString>
  1003. <GetPublishingLocalizedString
  1004. ID="PublishLocalizedString_SampleScriptHelpMoreInfo"
  1005. ArgumentCount="1"
  1006. Arguments="$(_SampleDeployCmdFwdLink)">
  1007. <Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
  1008. </GetPublishingLocalizedString>
  1009. <WriteLinesToFile File="$(GenerateSampleDeployScriptReadMeLocation)"
  1010. Overwrite="True"
  1011. Encoding="utf-8"
  1012. Lines="@(_PublishLocalizedString_SampleScriptHelpString,'')" />
  1013. <ItemGroup>
  1014. <FileWrites Include="$(GenerateSampleDeployScriptReadMeLocation)" />
  1015. </ItemGroup>
  1016. <!--Get Localized string before displaying message where we generate the batch file-->
  1017. <GetPublishingLocalizedString
  1018. Importance="High"
  1019. ID="PublishLocalizedString_FinishGenerateSampleMsDeployBatchScript"
  1020. ArgumentCount="2"
  1021. Arguments="$(GenerateSampleDeployScriptLocation);$(GenerateSampleParametersValueLocation)"
  1022. LogType="Message" />
  1023. <!--<Message Importance="high"
  1024. Text="Sample script for deploying this package is generated at the following location:
  1025. $(GenerateSampleDeployScriptLocation)
  1026. For this sample script, you can change the deploy parameters by changing the following file:
  1027. $(GenerateSampleParametersValueLocation)" />-->
  1028. </Target>
  1029. <!--ImportAfter Extension-->
  1030. <PropertyGroup>
  1031. <ImportByWildcardAfterMicrosoftWebPublishingMSDeployCommonTargets Condition="'$(ImportByWildcardAfterMicrosoftWebPublishingMSDeployCommonTargets)'==''">true</ImportByWildcardAfterMicrosoftWebPublishingMSDeployCommonTargets>
  1032. </PropertyGroup>
  1033. <Import Project="$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportAfter\*" Condition="'$(ImportByWildcardAfterMicrosoftWebPublishingMSDeployCommonTargets)' == 'true' and exists('$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportAfter')"/>
  1034. </Project>