Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cromwellryan/2582620 to your computer and use it in GitHub Desktop.
Save cromwellryan/2582620 to your computer and use it in GitHub Desktop.
.Net 2.0 MSBuild file for ASP.Net projects
<!--
***********************************************************************************************
Microsoft.Web.Publishing.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 DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--Import task from our dll-->
<UsingTask TaskName="GetProjectProperties" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="TransformXml" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="ParameterizeTransformXml" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="MSDeploy" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="VSMSDeploy" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="CopyPipelineFiles" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="GetPipelineDestinationFileNameMatch" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="EscapeTextForRegularExpressions" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="RemoveTrailingSlash" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="ConcatFullServiceUrlWithSiteName" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="IsCleanMSDeployPackageNeeded" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="CheckPathAttributes" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="CheckItemsCount" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="CheckItemsForDuplication" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="CreateProviderList" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="GatherLinkExtensionsToBeExposedInVS" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="MapUriToIisWebServer" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="ImportParametersFile" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="ExportParametersFile" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="SortParametrsByPriority" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="RemoveEmptyDirectories" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="FilterByItems" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="ExportManifestFile" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="GetDeployManagedRuntimeVersion" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="NormalizeServiceUrl" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="SqlScriptPreprocessSqlVariables" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="GetPublishingLocalizedString" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="AspNetMerge" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<!--***************************************************************-->
<!-- Web Publish Pipeline Version/Supports
_WPPVersion: Version Stamp
_WPPSupports: Function support list-->
<!--***************************************************************-->
<PropertyGroup>
<!-- This typo is also in WDP, when we fix here, we need to fix teh WDP as well -->
<_WPPVerstion>1.5</_WPPVerstion>
<_WPPSupports>IISExpress</_WPPSupports>
</PropertyGroup>
<ItemGroup>
<_WPPSupports Include="$(_WPPSupports)" />
</ItemGroup>
<!--Generic mapping for the IISExpress Application Pools to IIS Application Pools common names-->
<ItemGroup>
<_IISApplicationPool Include="Clr4IntegratedAppPool">
<DestinationIISApplicationPool>ASP.NET v4.0</DestinationIISApplicationPool>
</_IISApplicationPool>
<_IISApplicationPool Include="Clr4ClassicAppPool">
<DestinationIISApplicationPool>ASP.NET v4.0 Classic</DestinationIISApplicationPool>
</_IISApplicationPool>
<_IISApplicationPool Include="Clr2IntegratedAppPool">
<DestinationIISApplicationPool>DefaultAppPool</DestinationIISApplicationPool>
</_IISApplicationPool>
<_IISApplicationPool Include="Clr2ClassicAppPool">
<DestinationIISApplicationPool>Classic .NET AppPool</DestinationIISApplicationPool>
</_IISApplicationPool>
</ItemGroup>
<!--***************************************************************-->
<!-- Setting up the property like MS.Common.Targets files has it. -->
<!--This is to handle some project doesn't include the MS.Common.Targets file-->
<!--***************************************************************-->
<PropertyGroup Condition="'$(BaseIntermediateOutputPath)'=='' ">
<BaseIntermediateOutputPath >obj\</BaseIntermediateOutputPath>
<BaseIntermediateOutputPath Condition="!HasTrailingSlash('$(BaseIntermediateOutputPath)')">$(BaseIntermediateOutputPath)\</BaseIntermediateOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(IntermediateOutputPath)' == '' ">
<IntermediateOutputPath Condition=" '$(PlatformName)' == 'AnyCPU' Or '$(PlatformName)' == ''">$(BaseIntermediateOutputPath)$(Configuration)\</IntermediateOutputPath>
<IntermediateOutputPath Condition=" '$(IntermediateOutputPath)' == '' ">$(BaseIntermediateOutputPath)$(PlatformName)\$(Configuration)\</IntermediateOutputPath>
<IntermediateOutputPath Condition="!HasTrailingSlash('$(IntermediateOutputPath)')">$(IntermediateOutputPath)\</IntermediateOutputPath>
</PropertyGroup>
<!--***************************************************************-->
<!--Global setting for Web publish pipeline -->
<!--***************************************************************-->
<PropertyGroup>
<WebPublishPipelineProjectDirectory Condition="'$(WebPublishPipelineProjectDirectory)'==''">$(MSBuildProjectDirectory)</WebPublishPipelineProjectDirectory>
<WebPublishPipelineSourceRootDirectory Condition="'$(WebPublishPipelineSourceRootDirectory)'==''">$(WebPublishPipelineProjectDirectory)</WebPublishPipelineSourceRootDirectory>
<WebPublishPipelineTransformRootDirectory Condition="'$(WebPublishPipelineTransformRootDirectory)'==''"></WebPublishPipelineTransformRootDirectory>
<WebPublishPipelineProjectName Condition="'$(WebPublishPipelineProjectName)'==''">$(MSBuildProjectName)</WebPublishPipelineProjectName>
<IsDesktopBuild Condition="'$(IsDesktopBuild)'=='' And '$(TeamFoundationServerUrl)' != ''">False</IsDesktopBuild>
<_MSDeployVersionsToTry Condition="'$(_MSDeployVersionsToTry)'==''">7.1;7.5;8.0</_MSDeployVersionsToTry>
<WebPublishPipelineWAPProjectSettings Condition="'$(WebPublishPipelineWAPProjectSettings)' ==''">$(MSBuildProjectFullPath)</WebPublishPipelineWAPProjectSettings>
<_WPPDefaultIntermediateOutputPathPathRoot Condition="'$(WebPublishPipelineProjectDirectory)' != '$(MSBuildProjectDirectory)'">$(MSBuildProjectDirectory)\</_WPPDefaultIntermediateOutputPathPathRoot>
</PropertyGroup>
<PropertyGroup Condition="'$(_WPPDefaultIntermediateOutputPath)' == ''">
<_WPPDefaultIntermediateOutputPath>$(IntermediateOutputPath)</_WPPDefaultIntermediateOutputPath>
<_WPPDefaultIntermediateOutputPath Condition="'$([System.IO.Path]::IsPathRooted($(IntermediateOutputPath)))' == 'False'">$(_WPPDefaultIntermediateOutputPathPathRoot)$(IntermediateOutputPath)</_WPPDefaultIntermediateOutputPath>
<_WPPDefaultIntermediateOutputFullPath>$([System.IO.Path]::GetFullPath($(_WPPDefaultIntermediateOutputPath)))</_WPPDefaultIntermediateOutputFullPath>
</PropertyGroup>
<!--***************************************************************-->
<!--To allow the Team build to have custom setting for the Web Applicaiton project without change the project file -->
<!--by default, if user have a file call $(WebPublishPipelineProjectName).wpp.targets, we will import these setting in before we start -->
<!--***************************************************************-->
<PropertyGroup>
<WebPublishPipelineCustomizeTargetFile Condition="'$(WebPublishPipelineCustomizeTargetFile)'==''">$(WebPublishPipelineProjectDirectory)\$(WebPublishPipelineProjectName).wpp.targets</WebPublishPipelineCustomizeTargetFile>
</PropertyGroup>
<Import Project="$(WebPublishPipelineCustomizeTargetFile)" Condition="Exists($(WebPublishPipelineCustomizeTargetFile))"/>
<!--***************************************************************-->
<!--Global setting for Clean target -->
<!--***************************************************************-->
<PropertyGroup>
<CleanDependsOn>
$(CleanDependsOn);
CleanWebsitesPackage;
CleanWebsitesPackageTempDir;
CleanWebsitesTransformParametersFiles;
</CleanDependsOn>
</PropertyGroup>
<!--***************************************************************-->
<!--Global setting for How/what we should collect for all project-->
<!--***************************************************************-->
<PropertyGroup Condition="'$(WebPublishPipelineProjectDirectory)' == '$(MSBuildProjectDirectory)'">
<!-- If FileToIncludeForPublish is not set, default it to OnlyFilesToRunTheApp-->
<FilesToIncludeForPublish Condition="'$(FilesToIncludeForPublish)'==''">OnlyFilesToRunTheApp</FilesToIncludeForPublish>
<AlternativeProjectDirectory></AlternativeProjectDirectory>
</PropertyGroup>
<PropertyGroup Condition="'$(WebPublishPipelineProjectDirectory)' != '$(MSBuildProjectDirectory)'">
<!-- If ProjectDirectory is different than the default mabuildProjectDirectory, , default it to AllFilesInProjectFolder-->
<FilesToIncludeForPublish Condition="'$(FilesToIncludeForPublish)'==''">AllFilesInProjectFolder</FilesToIncludeForPublish>
<AlternativeProjectDirectory>$(WebPublishPipelineProjectDirectory)</AlternativeProjectDirectory>
<AlternativeProjectDirectory Condition="!HasTrailingSlash('$(AlternativeProjectDirectory)')">$(AlternativeProjectDirectory)</AlternativeProjectDirectory>
</PropertyGroup>
<PropertyGroup>
<ExcludeGeneratedDebugSymbol Condition="'$(ExcludeGeneratedDebugSymbol)'=='' And '$(_DebugSymbolsProduced)' != 'true'">True</ExcludeGeneratedDebugSymbol>
<ExcludeGeneratedDebugSymbol Condition="'$(ExcludeGeneratedDebugSymbol)'=='' And '$(_DebugSymbolsProduced)' == 'true'">False</ExcludeGeneratedDebugSymbol>
<ExcludeApp_Data Condition="'$(ExcludeApp_Data)'==''">False</ExcludeApp_Data>
<SkipApp_DataFolder Condition="'$(SkipApp_DataFolder)'==''">$(ExcludeApp_Data)</SkipApp_DataFolder>
<UseMsdeployExe Condition="'$(UseMsdeployExe)'==''">False</UseMsdeployExe>
<!--Whether to collect the Link Files to it Link Location during the PipelineCollectFilesPhase, default is True-->
<EnableCollectLinkFilesInProject Condition="'$(EnableCollectLinkFilesInProject)'==''">True</EnableCollectLinkFilesInProject>
<!--Whether to deploy the Link Files to it Link Location during package/publish, default is True. -->
<ExcludeLinkFilesInProject Condition="'$(ExcludeLinkFilesInProject)'==''">False</ExcludeLinkFilesInProject>
<CleanPackageTempDir Condition="'$(CleanPackageTempDir)'==''">False</CleanPackageTempDir>
<!--in the case of the old project, default IncludeIisSettings to true such that we will honor UseIis by default-->
<IncludeIisSettings Condition="'$(IncludeIisSettings)'==''">False</IncludeIisSettings>
<!--The following flag enable the exclude files from publish for all item in @(ExcludeFromPackageFiles)-->
<ExcludeFilesFromPackage Condition="'$(ExcludeFilesFromPackage)'==''">True</ExcludeFilesFromPackage>
<!--The following flag enable the import msdeploy parameters.xml files from publish for all item in @(ParametersXMLFiles)-->
<ImportParametersFiles Condition="'$(ImportParametersFiles)'==''">True</ImportParametersFiles>
<EnableOptimisticParameterDefaultValue Condition="'$(EnableOptimisticParameterDefaultValue)'==''">True</EnableOptimisticParameterDefaultValue>
<ParameterApplicationPool Condition="'$(ParameterApplicationPool)'==''">True</ParameterApplicationPool>
<IIS6ParameterApplicationPool Condition="'$(IIS6ParameterApplicationPool)'==''">False</IIS6ParameterApplicationPool>
<!--This controls all MSDeployParameter that generated by VS-->
<DisableAllVSGeneratedMSDeployParameter Condition="'$(DisableAllVSGeneratedMSDeployParameter)'==''">False</DisableAllVSGeneratedMSDeployParameter>
<!--The following flag enable auto parameterization for the web.config connection strings-->
<AutoParameterizationWebConfigConnectionStrings Condition="'$(AutoParameterizationWebConfigConnectionStrings)'==''">True</AutoParameterizationWebConfigConnectionStrings>
<AutoParameterizationWebConfigCSNoDefaultValue Condition="'$(AutoParameterizationWebConfigCSNoDefaultValue)'==''">False</AutoParameterizationWebConfigCSNoDefaultValue>
<AutoParameterizationWebConfigConnectionStringsIntermediateOutput Condition="'$(AutoParameterizationWebConfigConnectionStringsIntermediateOutput)'==''">CSAutoParameterize</AutoParameterizationWebConfigConnectionStringsIntermediateOutput>
<AutoParameterizationWebConfigConnectionStringsLocation Condition="'$(AutoParameterizationWebConfigConnectionStringsLocation)'==''">$(_WPPDefaultIntermediateOutputPath)$(AutoParameterizationWebConfigConnectionStringsIntermediateOutput)</AutoParameterizationWebConfigConnectionStringsLocation>
<!--The following flag set the VS UI support for the database tag, default is "dbfullSql" provider. You can change this in your project file.-->
<DeploySqlProvider Condition="'$(DeploySqlProvider)'==''"></DeploySqlProvider>
<!--This flag control the sql script Transacted or not when VS UI include a script script, default is false. You can change the behavior in your project file-->
<SqlScriptSourceTransacted Condition="'$(SqlScriptSourceTransacted)'==''"></SqlScriptSourceTransacted>
<!--This flag control the auto sql script Transacted or not when VS UI include a database schema/data script, default is true. You can change the behavior in your project file-->
<AutoSqlScriptSourceTransacted Condition="'$(AutoSqlScriptSourceTransacted)'==''"></AutoSqlScriptSourceTransacted>
<DatabaseDeployIntermediateRelativePath Condition="'$(DatabaseDeployIntermediateRelativePath)'==''">Database</DatabaseDeployIntermediateRelativePath>
<DatabaseDeployIntermediateOutputPath Condition="'$(DatabaseDeployIntermediateOutputPath)'==''">$(_WPPDefaultIntermediateOutputPath)$(DatabaseDeployIntermediateRelativePath)</DatabaseDeployIntermediateOutputPath>
<_WebConfigsToAutoParmeterizeCsTransformOutputParametersFile>$(AutoParameterizationWebConfigConnectionStringsLocation).parameters.xml</_WebConfigsToAutoParmeterizeCsTransformOutputParametersFile>
<!-- This is the target file for the way to customize for collection files-->
<FilesToIncludeTargetFile Condition="'$(FilesToIncludeTargetFile)'==''">Microsoft.Web.Publishing.$(FilesToIncludeForPublish).targets</FilesToIncludeTargetFile>
<DeployDefaultTarget Condition="'$(DeployDefaultTarget)'==''">Package</DeployDefaultTarget>
<DeployTarget Condition="'$(DeployTarget)'==''">PipelineDeployPhase</DeployTarget>
<RetryAttemptsForDeployment Condition="'$(RetryAttemptsForDeployment)'==''">2</RetryAttemptsForDeployment>
<DeployOnBuildDefault>False</DeployOnBuildDefault>
<DeployOnBuild Condition="'$(DeployOnBuild)'==''">$(DeployOnBuildDefault)</DeployOnBuild>
</PropertyGroup>
<!--***************************************************************-->
<!--Special flag for WAP to enable _CopyWebApplication to use Web Publishing pipeline-->
<!--***************************************************************-->
<PropertyGroup>
<UseWPP_CopyWebApplication Condition="'$(UseWPP_CopyWebApplication)'==''">False</UseWPP_CopyWebApplication>
</PropertyGroup>
<!--***************************************************************-->
<!--Global setting for where sto start the pipeline-->
<!--***************************************************************-->
<PropertyGroup>
<PipelineDependsOnBuild Condition="'$(PipelineDependsOnBuild)'=='' AND '$(BuildingInsideVisualStudio)' != 'true'">True</PipelineDependsOnBuild>
<PipelineDependsOnBuild Condition="'$(PipelineDependsOnBuild)'==''">False</PipelineDependsOnBuild>
<!--VS IDE currently doesn't handle the Build command to include the Deploy, we ignore it when $(BuildingInsideVisualStudio) is true-->
<_DeployOnBuild>$(DeployOnBuild)</_DeployOnBuild>
<_DeployOnBuild Condition="'$(BuildingInsideVisualStudio)' == 'true'">False</_DeployOnBuild>
<!--if $(DeployOnBuild) is true, we hook the DeployTarget into the BuildDependsOn-->
<!--This is to work with team build environment so build solution will work -->
<PrepareForRunDependsOn Condition="$(_DeployOnBuild)">
$(PrepareForRunDependsOn);
$(DeployTarget);
</PrepareForRunDependsOn>
<!--else if $(PipelineDependsOnBuild) is true, we hook the $(PipelineDependsOn) with Build -->
<!--This is typically command line scenario such that msbuild project /t:package will work properly -->
<!--We use the following property to detect BuildCircularDependency that we might introduce in the msbuild due to $(UseWPP_CopyWebApplication) and $(PipelineDependsOnBuild) both set to true
Instead of letting msbuild failed error early with no message, we record message tweak it to make the build work then Log the error messsage later to allow user to fix the issue.-->
<WPPCopyWebApplicaitonPipelineCircularDependencyError>False</WPPCopyWebApplicaitonPipelineCircularDependencyError>
<WPPCopyWebApplicaitonPipelineCircularDependencyError Condition="$(UseWPP_CopyWebApplication) And !$(Disable_CopyWebApplication) And $(PipelineDependsOnBuild) And !$(_DeployOnBuild)">True</WPPCopyWebApplicaitonPipelineCircularDependencyError>
<PipelineDependsOnBuild Condition="$(WPPCopyWebApplicaitonPipelineCircularDependencyError)">False</PipelineDependsOnBuild>
<PipelineDependsOn Condition="$(PipelineDependsOnBuild) And !$(_DeployOnBuild)">
$(PipelineDependsOn);
Build;
</PipelineDependsOn>
<!--else if $(PipelineDependsOnBuild) is false, we hook the $(PipelineDependsOn) with only necessary target that we care about -->
<!--This is typically IDE scenario where IDE already called build before the Publish API is called-->
<PipelineDependsOn Condition="!$(PipelineDependsOnBuild) And !$(_DeployOnBuild)" >
$(PipelineDependsOn);
BeforeBuild;
BuildOnlySettings;
ResolveReferences;
PrepareResourceNames;
ComputeIntermediateSatelliteAssemblies;
GetCopyToOutputDirectoryItems;
_SGenCheckForOutputs;
AfterBuild;
</PipelineDependsOn>
</PropertyGroup>
<!--***************************************************************-->
<!--Global setting for controling how to Transform project's configuration file -->
<!--***************************************************************-->
<PropertyGroup>
<ProjectConfigFileName Condition="'$(ProjectConfigFileName)'==''">Web.config</ProjectConfigFileName>
</PropertyGroup>
<ItemGroup>
<!--a item collection such that we can get the file name and extension from it-->
<_VSProjectConfigFileName Include="$(ProjectConfigFileName)" />
</ItemGroup>
<PropertyGroup>
<ProjectConfigTransformFileName Condition="'$(ProjectConfigTransformFileName)'==''">@(_VSProjectConfigFileName->'%(FileName).$(Configuration)%(Extension)')</ProjectConfigTransformFileName>
<TransformWebConfigEnabled Condition="'$(TransformWebConfigEnabled)'==''">true</TransformWebConfigEnabled>
<TransformWebConfigStackTraceEnabled Condition="'$(TransformWebConfigStackTraceEnabled)'==''">False</TransformWebConfigStackTraceEnabled>
<UseParameterizeToTransformWebConfig Condition="'$(UseParameterizeToTransformWebConfig)'==''">False</UseParameterizeToTransformWebConfig>
<TransformWebConfigIntermediateOutput Condition="'$(TransformWebConfigIntermediateOutput)'==''">TransformWebConfig</TransformWebConfigIntermediateOutput>
<TransformWebConfigIntermediateLocation Condition="'$(TransformWebConfigIntermediateLocation)'==''">$(_WPPDefaultIntermediateOutputPath)$(TransformWebConfigIntermediateOutput)</TransformWebConfigIntermediateLocation>
<_WebConfigTransformOutputParametersFile>$(TransformWebConfigIntermediateLocation).parameters.xml</_WebConfigTransformOutputParametersFile>
<ParameterizeTransformXmlUseXPath Condition="'$(ParameterizeTransformXmlUseXPath)'==''">True</ParameterizeTransformXmlUseXPath>
</PropertyGroup>
<!--***************************************************************-->
<!-- Overwrite WAP default for _CopyWebApplication -->
<!--***************************************************************-->
<PropertyGroup>
<!--We need the following in case WAP project is not exist-->
<WebProjectOutputDirInsideProjectDefault>True</WebProjectOutputDirInsideProjectDefault>
<WebProjectOutputDirInsideProjectDefault Condition="('$(OutDir)' != '$(OutputPath)') Or ('$(IsDesktopBuild)' == 'False')" >False</WebProjectOutputDirInsideProjectDefault>
<WebProjectOutputDirInsideProject Condition="'$(WebProjectOutputDirInsideProject)' == ''">$(WebProjectOutputDirInsideProjectDefault)</WebProjectOutputDirInsideProject>
<CleanWebProjectOutputDir>True</CleanWebProjectOutputDir>
<CleanWebProjectOutputDir Condition="$(WebProjectOutputDirInsideProject)" >False</CleanWebProjectOutputDir>
</PropertyGroup>
<!--***************************************************************-->
<!--Global setting for controling Where the defaultPackageOuputDirectory for team build.-->
<!--***************************************************************-->
<PropertyGroup>
<!--We need the following in case WAP project is not exist-->
<DefaultPackageOutputDir Condition="'$(DefaultPackageOutputDir)'=='' And !$(WebProjectOutputDirInsideProject) ">$(OutDir)_PublishedWebsites\$(WebPublishPipelineProjectName)_Package</DefaultPackageOutputDir>
<DefaultPackageOutputDir Condition="'$(DefaultPackageOutputDir)'==''">$(_WPPDefaultIntermediateOutputPath)Package</DefaultPackageOutputDir>
<DefaultPackageFileName Condition="'$(DefaultPackageFileName)'==''">$(WebPublishPipelineProjectName).zip</DefaultPackageFileName>
<DefaultMSDeployDestinationSite Condition="'$(DefaultMSDeployDestinationSite)'==''">Default Web Site</DefaultMSDeployDestinationSite>
<DefaultMsDeployAltSuffix Condition="'$(DefaultMsDeployAltSuffix)'==''">_deploy</DefaultMsDeployAltSuffix>
<DefaultMSDeployDestinationApplicationName Condition="'$(DefaultMSDeployDestinationApplicationName)'==''">$(WebPublishPipelineProjectName)</DefaultMSDeployDestinationApplicationName>
<DefaultDeployIisAppPath Condition="'$(DefaultDeployIisAppPath)'==''">$(DefaultMSDeployDestinationSite)/$(DefaultMSDeployDestinationApplicationName)$(DefaultMsDeployAltSuffix)</DefaultDeployIisAppPath>
<DefaultDeployIisRootAppPath Condition="'$(DefaultDeployIisRootAppPath)'==''">$(DefaultMSDeployDestinationApplicationName)$(DefaultMsDeployAltSuffix)</DefaultDeployIisRootAppPath>
</PropertyGroup>
<!--***************************************************************-->
<!--Global setting for controling how and where package created.-->
<!--***************************************************************-->
<PropertyGroup>
<PackageAsSingleFile Condition="'$(PackageAsSingleFile)'==''">True</PackageAsSingleFile>
<!--DesktopBuildPackageLocation is been set by vs UI-->
<PackageLocation Condition="'$(PackageLocation)'=='' and !(('$(OutDir)' != '$(OutputPath)') Or ('$(IsDesktopBuild)' == 'False')) ">$(DesktopBuildPackageLocation)</PackageLocation>
<PackageFileName Condition="'$(PackageFileName)'=='' And $(PackageAsSingleFile) And '$(PackageLocation)' != ''">$(PackageLocation)</PackageFileName>
<PackageFileName Condition="'$(PackageFileName)'==''">$(DefaultPackageOutputDir)\$(DefaultPackageFileName)</PackageFileName>
<PackageArchiveRootDir Condition="'$(PackageArchiveRootDir)'=='' And !$(PackageAsSingleFile) And '$(PackageLocation)' != ''">$(PackageLocation)</PackageArchiveRootDir>
<PackageArchiveRootDir Condition="'$(PackageArchiveRootDir)'==''">$(DefaultPackageOutputDir)</PackageArchiveRootDir>
<PackageTempRootDir Condition="'$(PackageTempRootDir)'==''">$(_WPPDefaultIntermediateOutputPath)Package</PackageTempRootDir>
<!--IisApp is a msdeploy concept meaning contentpath+'mark as app on server after deploy'. If it is true, we will emit IisApp in manifest files rather than contentPath-->
<DeployAsIisApp Condition="'$(DeployAsIisApp)'==''">true</DeployAsIisApp>
<IncludeSetAclProviderOnDestination Condition="'$(IncludeSetAclProviderOnDestination)'==''">True</IncludeSetAclProviderOnDestination>
<MarkApp_DataWritableOnDestination Condition="'$(MarkApp_DataWritableOnDestination)'==''">True</MarkApp_DataWritableOnDestination>
<IgnoreDeployManagedRuntimeVersion Condition="'$(IgnoreDeployManagedRuntimeVersion)'==''">False</IgnoreDeployManagedRuntimeVersion>
<DeployDefaultTargetFrameworkVersion Condition="'$(DeployDefaultTargetFrameworkVersion)'==''">$(TargetFrameworkVersion)</DeployDefaultTargetFrameworkVersion>
<DeployManagedRuntimeVersion Condition="'$(DeployManagedRuntimeVersion)'==''"></DeployManagedRuntimeVersion>
<DeployEnable32bitAppOnWin64 Condition="'$(DeployEnable32bitAppOnWin64)'==''"></DeployEnable32bitAppOnWin64>
<DeployManagedPipelineMode Condition="'$(DeployManagedPipelineMode)'==''"></DeployManagedPipelineMode>
<!--The following setting specify the SourceManifest and DestinationManifest default location -->
<!--<PackageSourceManifest Condition="'$(PackageSourceManifest)'==''"></PackageSourceManifest>-->
<!--The following setting specify the GenerateSampleDeployScript-->
<GenerateSampleDeployScript Condition="'$(GenerateSampleDeployScript)'==''">True</GenerateSampleDeployScript>
<!--<GenerateSampleDeployScriptLocation Condition="'$(GenerateSampleDeployScriptLocation)'==''"></GenerateSampleDeployScriptLocation>-->
<PackageLogDir Condition="'$(PackageLogDir)'==''">$(DefaultPackageOutputDir)\Log</PackageLogDir>
<EnablePackageProcessLoggingAndAssert Condition="'$(EnablePackageProcessLoggingAndAssert)'==''">False</EnablePackageProcessLoggingAndAssert>
<!--Deployment Trace level have 3 different level: Error, Warning, Info (From System.Diagnostic.TraceLevel, Default to Informational-->
<PackageTraceLevel Condition="'$(PackageTraceLevel)'==''">Info</PackageTraceLevel>
<_CreatePackage Condition="'$(_CreatePackage)'==''" >True</_CreatePackage>
<_UseDefaultLinkExtensionValue>False</_UseDefaultLinkExtensionValue>
<_UseDefaultLinkExtensionValue Condition="'$(PackageEnableLinks)'=='' and '$(PackageDisableLinks)'==''">True</_UseDefaultLinkExtensionValue>
<PackageEnableLinks Condition="$(_UseDefaultLinkExtensionValue)"></PackageEnableLinks>
<PackageDisableLinks Condition="$(_UseDefaultLinkExtensionValue)">AppPoolExtension;ContentExtension;CertificateExtension</PackageDisableLinks>
<PackageEnableLinks Condition="'$(IncludeAppPool)'=='true' and $(_UseDefaultLinkExtensionValue)">AppPoolExtension</PackageEnableLinks>
<PackageDisableLinks Condition="'$(IncludeAppPool)'=='true' and $(_UseDefaultLinkExtensionValue)">ContentExtension;CertificateExtension</PackageDisableLinks>
<ProjectParametersXMLFile Condition="'$(ProjectParametersXMLFile)'=='' And Exists('$(MSBuildProjectDirectory)\Parameters.xml')">$(MSBuildProjectDirectory)\Parameters.xml</ProjectParametersXMLFile>
<ProjectParametersXMLFile Condition="'$(ProjectParametersXMLFile)'==''">$(WebPublishPipelineProjectDirectory)\Parameters.xml</ProjectParametersXMLFile>
<EnableProjectDeployParameterPrefix Condition="'$(EnableProjectDeployParameterPrefix)'==''">False</EnableProjectDeployParameterPrefix>
<DeployParameterPrefix Condition="$(EnableProjectDeployParameterPrefix) and '$(DeployParameterPrefix)'==''">$(WebPublishPipelineProjectName) </DeployParameterPrefix>
<DeployParameterIISAppName Condition="'$(DeployParameterIISAppName)'==''">$(DeployParameterPrefix)IIS Web Application Name</DeployParameterIISAppName>
<DeployParameterIISAppPoolName Condition="'$(DeployParameterIISAppPoolName)'==''">$(DeployParameterPrefix)IIS Web Application Pool Name</DeployParameterIISAppPoolName>
<DeployParameterApp_DataWritePermission Condition="'$(DeployParameterApp_DataWritePermission)'==''">$(DeployParameterPrefix)Add write permission to App_Data Folder</DeployParameterApp_DataWritePermission>
<DeployParameterIISAppPhysicalPath Condition="'$(DeployParameterIISAppPhysicalPath)'==''">$(DeployParameterPrefix)Web Application Physical Path</DeployParameterIISAppPhysicalPath>
<!--By default the description will be provided by Msdeploy Tags auto description -->
<DeployParameterAutoDescriptionbyTags Condition="'$(DeployParameterAutoDescriptionbyTags)'==''">True</DeployParameterAutoDescriptionbyTags>
<DeployParameterIISAppNameDescription Condition="'$(DeployParameterIISAppNameDescription)'==''"></DeployParameterIISAppNameDescription>
<DeployParameterIISAppPoolNameDescription Condition="'$(DeployParameterIISAppPoolNameDescription)'==''"></DeployParameterIISAppPoolNameDescription>
<DeployParameterIISAppPhysicalPathDescription Condition="'$(DeployParameterIISAppPhysicalPathDescription)'==''"></DeployParameterIISAppPhysicalPathDescription>
<DeployParameterIISAppConnectionStringDescription Condition="'$(DeployParameterIISAppConnectionStringDescription)'==''"></DeployParameterIISAppConnectionStringDescription>
<DeployParameterSqlScriptVariablesDescription Condition="'$(DeployParameterSqlScriptVariablesDescription)'==''"></DeployParameterSqlScriptVariablesDescription>
<MsDeployDatabaseTag Condition="'$(MsDeployDatabaseTag)'==''">SqlConnectionString</MsDeployDatabaseTag>
<MsDeploySqlCommandVariableKind Condition="'$(MsDeploySqlCommandVariableKind)'==''">SqlCommandVariable</MsDeploySqlCommandVariableKind>
<!--check sql script with unsupported sqlcmd commands. The following are a list of msdeploySQLUnsupportedCommand-->
<!--UnsupportedKeywords="$(MsdeploySqlUnsupportedCommand)"-->
<!--CheckForUnsupportCommands="$(CheckSqlScriptForUnsupportedCommands)"-->
<!--The list below is for msdeploy V1, those the keywords that it doesn't support-->
<MsdeploySqlUnsupportedCommand Condition="'$(MsdeploySqlUnsupportedCommand)'==''">:Connect;:!!;:Exit;:Help;:r;:Quit;</MsdeploySqlUnsupportedCommand>
<CheckSqlScriptForUnsupportedCommands Condition="'$(CheckSqlScriptForUnsupportedCommands)'==''">True</CheckSqlScriptForUnsupportedCommands>
<!--By default flag unsupported sqlcommand as Error-->
<TreadSqlScriptUnsupportedCommandsAsWarning Condition="'$(TreadSqlScriptUnsupportedCommandsAsWarning)'==''">False</TreadSqlScriptUnsupportedCommandsAsWarning>
<_PackageTempDir>$(PackageTempRootDir)\PackageTmp</_PackageTempDir>
<_PackageTempDirFullPath>$([System.IO.Path]::GetFullPath($(_PackageTempDir))</_PackageTempDirFullPath>
</PropertyGroup>
<!--SqlScriptPreProcess Default setting -->
<PropertyGroup>
<EnableSqlScriptVariableParameterize Condition="'$(EnableSqlScriptVariableParameterize)'==''">True</EnableSqlScriptVariableParameterize>
<!--By default, BatchDelimiter is "Go", "" is the same for ManagedBatchParser.Parser -->
<SqlScriptPreProcessBatchDelimiter Condition="'$(SqlScriptPreProcessBatchDelimiter)'==''"></SqlScriptPreProcessBatchDelimiter>
<SqlScriptPreProcessResolveIncludes Condition="'$(SqlScriptPreProcessResolveIncludes)'==''">False</SqlScriptPreProcessResolveIncludes>
</PropertyGroup>
<ItemGroup>
<ParametersXMLFiles Condition="Exists($(ProjectParametersXMLFile))" Include="$(ProjectParametersXMLFile)" />
</ItemGroup>
<!--***************************************************************-->
<!--Global setting for controling how and where to deploy-->
<!--***************************************************************-->
<PropertyGroup>
<!--If this is not set ('') by default, when we retrieve the IisUrl property, we will append the _deploy at the end of this to be DeployIisAppPath-->
<DeployIisAppPath Condition="'$(DeployIisAppPath)'==''"></DeployIisAppPath>
<RemoteSitePhysicalPath Condition="'$(RemoteSitePhysicalPath)'==''"></RemoteSitePhysicalPath>
<DefaultDeployIisAppPhysicalPath Condition="'$(DefaultDeployIisAppPhysicalPath)'==''">$(WebPublishPipelineProjectDirectory)$(DefaultMsDeployAltSuffix)</DefaultDeployIisAppPhysicalPath>
<DeployIisAppPhysicalPath Condition="'$(DeployIisAppPhysicalPath)'==''"></DeployIisAppPhysicalPath>
<_DestinationIisAppPhysicalPath>$(DeployIisAppPhysicalPath)</_DestinationIisAppPhysicalPath>
<_DestinationIisAppPhysicalPath Condition="'$(_DestinationIisAppPhysicalPath)'==''">$(DefaultDeployIisAppPhysicalPath)</_DestinationIisAppPhysicalPath>
<!-- If this is not set, by default, it will use the $(LocalIisVersion)-->
<DestinationIisVersion Condition="'$(DestinationIisVersion)'==''"></DestinationIisVersion>
<DestinationUseIis Condition="'$(DestinationUseIis)' ==''"></DestinationUseIis>
<PublishEnableLinks Condition="'$(PublishEnableLinks)'==''">$(PackageEnableLinks)</PublishEnableLinks>
<PublishDisableLinks Condition="'$(PublishDisableLinks)'==''">$(PackageDisableLinks)</PublishDisableLinks>
<DeployEncryptKey Condition="'$(DeployEncryptKey)'==''"></DeployEncryptKey>
<SkipExtraFilesOnServer Condition="'$(SkipExtraFilesOnServer)'==''">False</SkipExtraFilesOnServer>
<MsDeployServiceUrl Condition="$(MsDeployServiceUrl)==''"></MsDeployServiceUrl>
</PropertyGroup>
<!--***************************************************************-->
<!--Global setting on MSDeployParameterPriority to change the Parameter order show up in inetmgr UI-->
<!--The lower the number, the earlier it show up in the Inetmgr UI (-100, -80, -70, ....60, 100)-->
<!-- Default priority is 0. Any integer number is allowed. -->
<!--***************************************************************-->
<PropertyGroup>
<VsIisAppParametersPriority Condition="'$(VsIisAppParametersPriority)'==''">-100</VsIisAppParametersPriority>
<VsContentPathParametersPriority Condition="'$(VsContentPathParametersPriority)'==''">-80</VsContentPathParametersPriority>
<VsDestinationVDirParametersPriority Condition="'$(VsDestinationVDirParametersPriority)'==''">-70</VsDestinationVDirParametersPriority>
<VsSetAclPriority Condition="'$(VsSetAclPriority)'==''">-60</VsSetAclPriority>
<UserParametersFileParametersPriority Condition="'$(UserParametersFileParametersPriority)'==''">-50</UserParametersFileParametersPriority>
<UserWebConfigParametersPriority Condition="'$(UserWebConfigParametersPriority)'==''">-40</UserWebConfigParametersPriority>
<VsSQLDatabaseScriptParametersPriority Condition="'$(VsSQLDatabaseScriptParametersPriority)'==''">60</VsSQLDatabaseScriptParametersPriority>
<VsWebConfigAutoCsParametersPriority Condition="'$(VsWebConfigAutoCsParametersPriority)'==''">100</VsWebConfigAutoCsParametersPriority>
</PropertyGroup>
<!--***************************************************************-->
<!-- Some assumption on where MSDeploy.exe exist -->
<!--***************************************************************-->
<PropertyGroup>
<!--Unless specified otherwise, the tools will go to HKLM\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\1 to get the installpath for msdeploy.exe.-->
<MSDeployPath Condition="'$(MSDeployPath)'==''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\3@InstallPath)</MSDeployPath>
<MSDeployPath Condition="'$(MSDeployPath)'==''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\2@InstallPath)</MSDeployPath>
<MSDeployPath Condition="'$(MSDeployPath)'==''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\1@InstallPath)</MSDeployPath>
</PropertyGroup>
<!--***************************************************************-->
<!--Some global setting on where the MSDeploy should create the sourceManifest,
package parameter, publish paraemter, sample script-->
<!--***************************************************************-->
<ItemGroup>
<_MSDeployPackageFile Include="$(PackageFileName)" />
<_MSDeployArchiveDir Include="$(PackageArchiveRootDir)\Archive" />
<_MSDeployPackageLocation Condition="$(PackageAsSingleFile)" Include="$(PackageFileName)" />
<_MSDeployPackageLocation Condition="!$(PackageAsSingleFile)" Include="@(_MSDeployArchiveDir)" />
</ItemGroup>
<PropertyGroup>
<GenerateSampleDeployScriptLocation Condition="$(GenerateSampleDeployScript) And '$(GenerateSampleDeployScriptLocation)'==''">@(_MSDeployPackageLocation->'%(RootDir)%(Directory)%(FileName).deploy.cmd')</GenerateSampleDeployScriptLocation>
<PackageSourceManifest Condition="'$(PackageSourceManifest)'==''">@(_MSDeployPackageLocation->'%(RootDir)%(Directory)%(FileName).SourceManifest.xml')</PackageSourceManifest>
<UseDeclareParametersXMLInMsDeploy Condition="'$(UseDeclareParametersXMLInMsDeploy)'==''">False</UseDeclareParametersXMLInMsDeploy>
<PackageParametersFile Condition="'$(PackageParametersFile)'==''">@(_MSDeployPackageLocation->'%(RootDir)%(Directory)%(FileName).Package.Parameters.xml')</PackageParametersFile>
<PublishParametersFile Condition="'$(PublishParametersFile)'==''">@(_MSDeployPackageLocation->'%(RootDir)%(Directory)%(FileName).Publish.Parameters.xml')</PublishParametersFile>
<GenerateSampleDeployScriptFileName Condition="$(GenerateSampleDeployScript) And '$(GenerateSampleDeployScriptLocation)'==''">@(_MSDeployPackageLocation->'%(FileName).deploy.cmd')</GenerateSampleDeployScriptFileName>
<GenerateSampleDeployScriptLocation Condition="$(GenerateSampleDeployScript) And '$(GenerateSampleDeployScriptLocation)'==''">@(_MSDeployPackageLocation->'%(RootDir)%(Directory)%(FileName).deploy.cmd')</GenerateSampleDeployScriptLocation>
<GenerateSampleDeployScriptReadMeFileName Condition="$(GenerateSampleDeployScript) And '$(GenerateSampleDeployScriptReadMeLocation)'==''">@(_MSDeployPackageLocation->'%(FileName).deploy-readme.txt')</GenerateSampleDeployScriptReadMeFileName>
<GenerateSampleDeployScriptReadMeLocation Condition="$(GenerateSampleDeployScript) And '$(GenerateSampleDeployScriptReadMeLocation)'==''">@(_MSDeployPackageLocation->'%(RootDir)%(Directory)%(FileName).deploy-readme.txt')</GenerateSampleDeployScriptReadMeLocation>
<GenerateSampleParametersValueLocationDefault Condition="'$(GenerateSampleParametersValueLocationDefault)'==''">@(_MSDeployPackageLocation->'%(RootDir)%(Directory)%(FileName).SetParameters.xml')</GenerateSampleParametersValueLocationDefault>
<GenerateSampleParametersValueLocation Condition="$(GenerateSampleDeployScript) And '$(GenerateSampleParametersValueLocation)'==''">$(GenerateSampleParametersValueLocationDefault)</GenerateSampleParametersValueLocation>
<GenerateSampleParametersValueFileName Condition="$(GenerateSampleDeployScript)">@(_MSDeployPackageLocation->'%(FileName).SetParameters.xml')</GenerateSampleParametersValueFileName>
</PropertyGroup>
<!--********************************************************************-->
<!--Enforce all item in @(ExcludeFromPackageFiles) The <FromTarget> itemmetadata -->
<!--This will help in the long run for debugging purpose-->
<!--Sample: to exclude files from publish, you can add the following to your project file-->
<!--Sample exclude the root folder's default.aspx page-->
<!--
<ExcludeFromPackageFiles Include="Default.aspx">
<FromTarget>Project</FromTarget>
</ExcludeFromPackageFiles>
-->
<!--Sample to exclude SampleExclude folder-->
<!--
<ExcludeFromPackageFolders Include="SampleExclude">
<FromTarget>Project</FromTarget>
</ExcludeFromPackageFolders>
-->
<!--********************************************************************-->
<ItemDefinitionGroup>
<!--use this colleciton to exclude items from the pipeline, remember to set $(ExcludeFilesFromPackage) to true-->
<ExcludeFromPackageFiles>
<FromTarget>Unknown</FromTarget>
</ExcludeFromPackageFiles>
<ExcludeFromPackageFolders>
<FromTarget>Unknown</FromTarget>
</ExcludeFromPackageFolders>
</ItemDefinitionGroup>
<!--********************************************************************-->
<!--Enforce all item have these metadata value for all pipeline metadata-->
<!--Default for Exclude is False-->
<!--********************************************************************-->
<ItemDefinitionGroup>
<FilesForPackagingFromProject>
<DestinationRelativePath></DestinationRelativePath>
<Exclude>False</Exclude>
<FromTarget>Unknown</FromTarget>
<Category>Run</Category>
<ProjectFileType>Default</ProjectFileType>
</FilesForPackagingFromProject>
</ItemDefinitionGroup>
<!--****************************************************************************-->
<!--Replace Rule schema enforcement-->
<!--public ReplaceRule(string RuleName,
string objectName,
string scopeAttributeName,
string scopeAttributeValue,
string targetAttributeName,
string match,
string replace);-->
<!--****************************************************************************-->
<ItemDefinitionGroup>
<MsDeployReplaceRules>
<ObjectName></ObjectName>
<ScopeAttributeName></ScopeAttributeName>
<ScopeAttributeValue></ScopeAttributeValue>
<TargetAttributeName></TargetAttributeName>
<Match></Match>
<Replace></Replace>
</MsDeployReplaceRules>
</ItemDefinitionGroup>
<!--***************************************************************-->
<!--skip rule schema enforcement
DeploymentSkipRule(string skipAction, string objectName, string absolutePath, string XPath);-->
<!--***************************************************************-->
<ItemDefinitionGroup>
<MsDeploySkipRules>
<SkipAction></SkipAction>
<ObjectName></ObjectName>
<AbsolutePath></AbsolutePath>
<XPath></XPath>
<KeyAttribute></KeyAttribute>
</MsDeploySkipRules>
</ItemDefinitionGroup>
<!--***************************************************************-->
<!--DeclareParameters schema enforcement
DeploymentParameter(string name, string type, string scope, string match, string description, string defaultValue); -->
<!--***************************************************************-->
<ItemDefinitionGroup>
<MsDeployDeclareParameters>
<Kind></Kind>
<Scope></Scope>
<Match></Match>
<Description></Description>
<DefaultValue></DefaultValue>
<Tags></Tags>
<ExcludeFromSetParameter></ExcludeFromSetParameter>
</MsDeployDeclareParameters>
</ItemDefinitionGroup>
<!--***************************************************************-->
<!--SyncParameter schema enforcement
public DeploymentParameter(string name, string value); -->
<!--***************************************************************-->
<ItemDefinitionGroup>
<MsDeploySimpleSetParameters>
<Value></Value>
</MsDeploySimpleSetParameters>
</ItemDefinitionGroup>
<!--***************************************************************-->
<!--SyncParameter schema enforcement
public DeploymentParameter(string type, string scope, string match, string value); -->
<!--***************************************************************-->
<ItemDefinitionGroup>
<MsDeploySetParameters>
<Kind></Kind>
<Scope></Scope>
<Match></Match>
<Value></Value>
<Description></Description>
<DefaultValue></DefaultValue>
<Tags></Tags>
</MsDeploySetParameters>
</ItemDefinitionGroup>
<!--***************************************************************-->
<!--MsDeployProviderSetting schema enforcement
public DeploymentParameter(string type, string scope, string match, string value); -->
<!--***************************************************************-->
<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>
<!--***************************************************************-->
<!--MsDeploySourceManifest schema enforcement -->
<!-- AdditionalProviderSettings denote the additionProviderSetting need to be set in the manifest files-->
<!--***************************************************************-->
<ItemDefinitionGroup>
<MsDeploySourceManifest>
<Path>Unknown</Path>
<AdditionalProviderSettings></AdditionalProviderSettings>
</MsDeploySourceManifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup>
<SqlCommandVariableMetaData>
<Value/>
<IsDeclared/>
<SourcePath/>
<SourcePath_RegExExcaped/>
<DestinationGroup/>
</SqlCommandVariableMetaData>
</ItemDefinitionGroup>
<!--***************************************************************-->
<!-- Import the corresponding way of file collection into the target-->
<!--***************************************************************-->
<!--default to is one of the following-->
<!--
Please see examples in $(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\
Microsoft.Web.Publishing.AllFilesInProjectFolder.targets
Microsoft.Web.Publishing.AllFilesInTheProject.targets
Microsoft.Web.Publishing.OnlyFilesToRunTheApp.targets
-->
<!--<Import Project="Microsoft.Web.Publishing.$(FilesToIncludeForPublish).targets" />-->
<Import Project="$(FilesToIncludeTargetFile)" />
<!--********************************************************************-->
<!--Target ExcludeApp_Data -->
<!--********************************************************************-->
<PropertyGroup>
<ExcludeApp_DataDependsOn Condition="'$(ExcludeApp_DataDependsOn)'==''">
</ExcludeApp_DataDependsOn>
</PropertyGroup>
<Target Name="ExcludeApp_Data"
DependsOnTargets="$(ExcludeApp_DataDependsOn)"
Condition="$(ExcludeApp_Data)">
<!--Get Localized string before displaying message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_ExcludeAllFilesUnderFolder"
ArgumentCount="1"
Arguments="App_Data"
LogType="Message" />
<!--Explicit mark all the file as Exclude=True, leverage the item for the -->
<!--Maybe we need to introduce @(ExcludeFromPackageFolders)-->
<ItemGroup>
<ExcludeFromPackageFolders Include="App_Data">
<FromTarget>ExcludeApp_Data</FromTarget>
</ExcludeFromPackageFolders>
</ItemGroup>
</Target>
<!--********************************************************************-->
<!--Target ExcludeGeneratedDebugSymbol -->
<!--********************************************************************-->
<PropertyGroup>
<ExcludeGeneratedDebugSymbolDependsOn Condition="'$(ExcludeGeneratedDebugSymbolDependsOn)'==''">
</ExcludeGeneratedDebugSymbolDependsOn>
</PropertyGroup>
<Target Name="ExcludeGeneratedDebugSymbol"
DependsOnTargets="$(ExcludeGeneratedDebugSymbolDependsOn)"
Condition="$(ExcludeGeneratedDebugSymbol)">
<!--Get Localized string before displaying message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_ExcludeAllDebugSymbols"
LogType="Message" />
<ItemGroup>
<ExcludeFromPackageFiles Include="@(FilesForPackagingFromProject)" Condition="'%(FilesForPackagingFromProject.Extension)'=='.pdb'">
<FromTarget>ExcludeGeneratedDebugSymbol</FromTarget>
</ExcludeFromPackageFiles>
</ItemGroup>
</Target>
<!--********************************************************************-->
<!--Target ExcludeFilesFromPackage-->
<!--**********************************************************************-->
<PropertyGroup>
<OnBeforeExcludeFilesFromPackage Condition="'$(OnBeforeExcludeFilesFromPackage)'==''">
ExcludeApp_Data;
ExcludeGeneratedDebugSymbol;
</OnBeforeExcludeFilesFromPackage>
<!--Targets get execute after this Target-->
<OnAfterExcludeFilesFromPackage Condition="'$(OnAfterExcludeFilesFromPackage)'==''">
</OnAfterExcludeFilesFromPackage>
<ExcludeFilesFromPackageDependsOn Condition="'$(ExcludeFilesFromPackageDependsOn)' == ''">
$(OnBeforeExcludeFilesFromPackage);
</ExcludeFilesFromPackageDependsOn>
</PropertyGroup>
<Target Name="ExcludeFilesFromPackage" DependsOnTargets="$(ExcludeFilesFromPackageDependsOn)"
Condition="$(ExcludeFilesFromPackage)">
<!--Add the exclude Folder into the list (Note that ItemGroup doesn't work in this scenario.
Note that this is specify in the DestinationRelativePath in the item.Spec-->
<CreateItem Include="@(ExcludeFromPackageFolders->'$(AlternativeProjectDirectory)%(Identity)\**')"
AdditionalMetadata="FromTarget=%(FromTarget)">
<Output TaskParameter="Include" ItemName="ExcludeFromPackageFiles"/>
</CreateItem>
<!--Log the information Set $(EnablePackageProcessLoggingAndAssert) to True if you want to see this information-->
<MakeDir Condition="$(EnablePackageProcessLoggingAndAssert) And !Exists($(PackageLogDir))"
Directories="$(PackageLogDir)" />
<WriteLinesToFile Condition="$(EnablePackageProcessLoggingAndAssert)"
Encoding="utf-8"
File="$(PackageLogDir)\ExcludeFromPackageFiles.txt"
Lines="@(ExcludeFromPackageFiles->'
Files:%(Identity)
FromTarget:%(FromTarget)
DestinationRelativePath:%(DestinationRelativePath)')"
Overwrite="True" />
<!--This exclude if the filter item spec is specified as DestinationRelativePath.-->
<FilterByItems PipelineItems="@(FilesForPackagingFromProject)"
SourceMetadataName="DestinationRelativePath"
FilterRootFolder="$(AlternativeProjectDirectory)"
FilterBaseOnRelativePath="True"
Filter="@(ExcludeFromPackageFiles)">
<Output TaskParameter="InFilter" ItemName="_NeedtoMarkasExclude_FilesForPackagingFromProject"/>
</FilterByItems>
<!--This exclude if the filter item's DestinationRelativePath is specified.
This is useful for case like Reference Dll and pdb where the source is not under the current project.-->
<FilterByItems PipelineItems="@(FilesForPackagingFromProject)"
SourceMetadataName="DestinationRelativePath"
FilterRootFolder="$(AlternativeProjectDirectory)"
FilterBaseOnRelativePath="True"
FilterMetadataName="DestinationRelativePath"
Filter="@(ExcludeFromPackageFiles)">
<Output TaskParameter="InFilter" ItemName="_NeedtoMarkasExclude_FilesForPackagingFromProject"/>
</FilterByItems>
<ItemGroup>
<FilesForPackagingFromProject Remove="@(_NeedtoMarkasExclude_FilesForPackagingFromProject)" />
<FilesForPackagingFromProject Include="@(_NeedtoMarkasExclude_FilesForPackagingFromProject)">
<Exclude>True</Exclude>
</FilesForPackagingFromProject>
</ItemGroup>
<!-- (Debug Only, Turn on EnablePackageProcessLoggingAndAssert if needed )
Dump the list to the log file in the log dir-->
<WriteLinesToFile Condition="$(EnablePackageProcessLoggingAndAssert)"
Encoding="utf-8"
File="$(PackageLogDir)\AfterExcludeFilesFilesList.txt"
Lines="@(FilesForPackagingFromProject->'
From:%(Identity)
DestinationRelativePath:%(DestinationRelativePath)
Exclude:%(Exclude)
FromTarget:%(FromTarget)
Category:%(Category)
ProjectFileType:%(ProjectFileType)')" Overwrite="True" />
<CallTarget Targets="$(OnAfterExcludeFilesFromPackage)" RunEachTargetSeparately="False" />
</Target>
<!--********************************************************************-->
<!--Target ImportParametersFiles-->
<!--**********************************************************************-->
<PropertyGroup>
<OnBeforeImportParametersFiles Condition="'$(OnBeforeImportParametersFiles)'==''">
</OnBeforeImportParametersFiles>
<!--Targets get execute after this Target-->
<OnAfterImportParametersFiles Condition="'$(OnAfterImportParametersFiles)'==''">
</OnAfterImportParametersFiles>
<ImportParametersFilesDependsOn Condition="'$(ImportParametersFilesDependsOn)' == ''">
$(OnBeforeImportParametersFiles);
</ImportParametersFilesDependsOn>
</PropertyGroup>
<Target Name="ImportParametersFiles" DependsOnTargets="$(ImportParametersFilesDependsOn)"
Condition="$(ImportParametersFiles)">
<ImportParametersFile Files="@(ParametersXMLFiles)">
<Output TaskParameter="Result" ItemName="_ImportedMSDeployDeclareParameters"/>
</ImportParametersFile>
<ItemGroup>
<MsDeployDeclareParameters Include="@(_ImportedMSDeployDeclareParameters)">
<Value>%(_ImportedMSDeployDeclareParameters.DefaultValue)</Value>
<Priority>$(UserParametersFileParametersPriority)</Priority>
</MsDeployDeclareParameters>
</ItemGroup>
</Target>
<!--********************************************************************-->
<!--Target ValidateGlobalPackageSetting -->
<!--********************************************************************-->
<!--Targets get execute before this Target-->
<PropertyGroup>
<OnBeforeValidateGlobalPackageSetting Condition="'$(OnBeforeValidateGlobalPackageSetting)'==''">
GetProjectWebProperties;
</OnBeforeValidateGlobalPackageSetting>
<!--Targets get execute after this Target-->
<OnAfterValidateGlobalPackageSetting Condition="'$(OnAfterValidateGlobalPackageSetting)'==''">
</OnAfterValidateGlobalPackageSetting>
<ValidateGlobalPackageSettingDependsOn Condition="'$(ValidateGlobalPackageSettingDependsOn)'==''">
$(OnBeforeValidateGlobalPackageSetting);
</ValidateGlobalPackageSettingDependsOn>
</PropertyGroup>
<Target Name="ValidateGlobalPackageSetting"
DependsOnTargets="$(ValidateGlobalPackageSettingDependsOn)" Condition="$(_CreatePackage)">
<!--Get Localized string before displaying message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_MsBuildPropertySettingValue"
ArgumentCount="2"
Arguments="PackageAsSingleFile;$(PackageAsSingleFile)"
LogType="Message" />
<!--Get Localized string before displaying message-->
<GetPublishingLocalizedString
Condition="$(PackageAsSingleFile)"
ID="PublishLocalizedString_CheckingForValidMsBuildPropertyValue"
ArgumentCount="2"
Arguments="PackageFileName;$(PackageFileName)"
LogType="Message" />
<!--<Message Condition="$(PackageAsSingleFile)" Text="PackageFileName is $(PackageFileName), Checking..."/>-->
<!--Get Localized string before displaying message-->
<GetPublishingLocalizedString
Condition="!$(PackageAsSingleFile)"
ID="PublishLocalizedString_CheckingForValidMsBuildPropertyValue"
ArgumentCount="2"
Arguments="PackageArchiveRootDir;$(PackageArchiveRootDir)"
LogType="Message" />
<!--<Message Condition="!$(PackageAsSingleFile)" Text="PackageArchiveRootDir is $(PackageArchiveRootDir), Checking"/>-->
<PropertyGroup>
<_CheckPackageLocation Condition="$(PackageAsSingleFile)">$(PackageFileName)</_CheckPackageLocation>
<_CheckPackageLocation Condition="!$(PackageAsSingleFile)">$(PackageArchiveRootDir)</_CheckPackageLocation>
<_CheckPackageLocationArchiveDir Condition="!$(PackageAsSingleFile)">$(PackageArchiveRootDir)\Archive</_CheckPackageLocationArchiveDir>
</PropertyGroup>
<CheckPathAttributes Path="$(_CheckPackageLocation)" Condition="'$(_CheckPackageLocation)' != ''">
<Output TaskParameter="IsExists" PropertyName="_CheckPackageLocationExists" />
<Output TaskParameter="IsFolder" PropertyName="_CheckPackageLocationIsFolder" />
</CheckPathAttributes>
<CheckPathAttributes Condition="'$(_CheckPackageLocationArchiveDir)' != ''" Path="$(_CheckPackageLocationArchiveDir)">
<Output TaskParameter="IsExists" PropertyName="_CheckPackageLocationArchiveDirExists" />
<Output TaskParameter="IsFolder" PropertyName="_CheckPackageLocationArchiveDirIsFolder" />
</CheckPathAttributes>
<!--Check on valid location-->
<!--Get Localized string before displaying error-->
<GetPublishingLocalizedString
Condition="$(PackageAsSingleFile) And $(_CheckPackageLocationExists) And $(_CheckPackageLocationIsFolder)"
ID="PublishLocalizedString_ErrorPackageAsFilePointToAnExistingFolder"
ArgumentCount="1"
Arguments="$(PackageFileName)"
LogType="Error" />
<!--<Error Condition="$(PackageAsSingleFile) And $(_CheckPackageLocationExists) And $(_CheckPackageLocationIsFolder)"
Text="'$(PackageFileName)' exist as a folder. You can't package as a single file to be the same name as an existing folder. Please delete the folder before packaging. Alternative,you can call msbuild with /t:CleanWebsitesPackage target to remove it." />-->
<GetPublishingLocalizedString
Condition="!$(PackageAsSingleFile) And $(_CheckPackageLocationExists) And !$(_CheckPackageLocationIsFolder)"
ID="PublishLocalizedString_ErrorPackageAsFolderPointToAnExistingFile"
ArgumentCount="1"
Arguments="$(PackageArchiveRootDir)"
LogType="Error" />
<!--<Error Condition="!$(PackageAsSingleFile) And $(_CheckPackageLocationExists) And !$(_CheckPackageLocationIsFolder)"
Text="'$(PackageArchiveRootDir)' exist as a file. You can't package as an archive directory to be the same as an existing file. Please delete the file before packaging. Alternative,you can call msbuild with /t:CleanWebsitesPackage target to remove it." />-->
<GetPublishingLocalizedString
Condition="!$(PackageAsSingleFile) And $(_CheckPackageLocationArchiveDirExists) And !$(_CheckPackageLocationArchiveDirIsFolder)"
ID="PublishLocalizedString_ErrorPackageAsFolderPointToAnExistingFile"
ArgumentCount="1"
Arguments="$(PackageArchiveRootDir)\Archive"
LogType="Error" />
<!--<Error Condition="!$(PackageAsSingleFile) And $(_CheckPackageLocationArchiveDirExists) And !$(_CheckPackageLocationArchiveDirIsFolder)"
Text="'$(PackageArchiveRootDir)\Archive' exist as a file. You can't package as an archive directory to be the same as an existing file. Please delete the file before packaging. Alternative,you can call msbuild with /t:CleanWebsitesPackage target to clean it." />-->
<!--Check on the IIS version compatibility-->
<!--Get Localized string before displaying error-->
<GetPublishingLocalizedString
Condition="$(DestinationUseIis) And ($(DestinationIisVersion) &lt; '7') And $(_DeploymentUseIis) And ($(LocalIisVersion) &gt;= '7')"
ID="PublishLocalizedString_ErrorCannotDeployFromIIS7AboveToLowerIIS"
ArgumentCount="3"
Arguments="$(IncludeIisSettings);$(DestinationIisVersion);$(LocalIisVersion)"
LogType="Error" />
<!--<Error Condition="$(DestinationUseIis) And ($(DestinationIisVersion) &lt; '7') And $(_DeploymentUseIis) And ($(LocalIisVersion) &gt;= '7')"
Text="Deploy with IIS Setting from a IIS 7 or above to a lower verstion of IIS server is not supported. To fix the problem, please set the %24(IncludeIisSettings) to false. Your current setting are %24(IncludeIisSettings) is $(IncludeIisSettings), %24(DestinationIisVersion) is $(DestinationIisVersion) and %24(LocalIisVersion) is $(LocalIisVersion)." />-->
</Target>
<Target Name="ProcessItemToExcludeFromDeployment">
<ItemGroup>
<ExcludeFromPackageFiles Condition="'$(ExcludeFilesFromDeployment)'!=''" Include="$(ExcludeFilesFromDeployment)" />
<ExcludeFromPackageFolders Condition="'$(ExcludeFoldersFromDeployment)'!=''" Include="$(ExcludeFoldersFromDeployment)" />
</ItemGroup>
</Target>
<!--********************************************************************-->
<!--Target WPPCopyWebApplicaitonPipelineCircularDependencyError -->
<!--********************************************************************-->
<Target Name="WPPCopyWebApplicaitonPipelineCircularDependencyError" Condition="$(WPPCopyWebApplicaitonPipelineCircularDependencyError)">
<!--Get Localized string before displaying error-->
<GetPublishingLocalizedString
Condition="$(WPPCopyWebApplicaitonPipelineCircularDependencyError)"
ID="PublishLocalizedString_ErrorUseWPP_CopyWebApplicationAndPipelineDependsOnBuildBothTrue"
LogType="Error" />
<!--
<Error Condition="$(WPPCopyWebApplicaitonPipelineCircularDependencyError)"
Text="These two Properties are not compatable %24(UseWPP_CopyWebApplication) and %24(PipelineDependsOnBuild) both are True.
Please correct the problem by either set %24(Disable_CopyWebApplication) to true or set %24(PipelineDependsOnBuild) to false to break the circular build dependency.
Detail: %24(UseWPP_CopyWebApplication) make the publsih pipeline (WPP) to be Part of the build and %24(PipelineDependsOnBuild) make the WPP depend on build thus cause the build circular build dependency. " />
-->
</Target>
<!--********************************************************************-->
<!--Target PipelineCollectFilesPhase -->
<!--********************************************************************-->
<PropertyGroup>
<!--Targets get execute before this Target-->
<OnBeforePipelineCollectFilesPhase Condition="'$(OnBeforePipelineCollectFilesPhase)'==''">
WPPCopyWebApplicaitonPipelineCircularDependencyError;
ProcessItemToExcludeFromDeployment;
GetProjectWebProperties;
ValidateGlobalPackageSetting;
$(PipelineDependsOn);
</OnBeforePipelineCollectFilesPhase>
<!--Targets get execute after this Target-->
<OnAfterPipelineCollectFilesPhase Condition="'$(OnAfterPipelineCollectFilesPhase)'==''">
ExcludeFilesFromPackage;
ImportParametersFiles;
</OnAfterPipelineCollectFilesPhase>
<PipelineCollectFilesPhaseDependsOn Condition="'$(PipelineCollectFilesPhaseDependsOn)'==''">
$(OnBeforePipelineCollectFilesPhase);
$(PublishPipelineCollectFilesCore);
</PipelineCollectFilesPhaseDependsOn>
</PropertyGroup>
<Target Name="PipelineCollectFilesPhase"
Outputs="@(FilesForPackagingFromProject)"
DependsOnTargets="$(PipelineCollectFilesPhaseDependsOn)">
<!--Get Localized string before displaying message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_WebPublishPipelineCollectFilesPhase"
LogType="Message" />
<!--Log the information Set $(EnablePackageProcessLoggingAndAssert) to True if you want to see this information-->
<MakeDir Condition="$(EnablePackageProcessLoggingAndAssert) And !Exists('$(PackageLogDir)')"
Directories="$(PackageLogDir)" />
<!-- (Debug Only, Turn on EnablePackageProcessLoggingAndAssert if needed )
Dump the list to the log file in the log dir-->
<WriteLinesToFile Condition="$(EnablePackageProcessLoggingAndAssert)"
Encoding="utf-8"
File="$(PackageLogDir)\PreExcludePipelineCollectFilesPhaseFileList.txt"
Lines="@(FilesForPackagingFromProject->'
From:%(Identity)
DestinationRelativePath:%(DestinationRelativePath)
Exclude:%(Exclude)
FromTarget:%(FromTarget)
Category:%(Category)
ProjectFileType:%(ProjectFileType)')" Overwrite="True" />
<!-- (Debug Only, Turn on EnablePackageProcessLoggingAndAssert if needed )
Check for Duplicate DestinationRelativePath, When there is a duplicate it is an Error-->
<CheckItemsForDuplication
Condition="$(EnablePackageProcessLoggingAndAssert)"
Items="@(FilesForPackagingFromProject)"
TraceLevel="Error"
MetadataToVerify="DestinationRelativePath">
<Output TaskParameter="HasDuplicate" PropertyName="_FilesForPackagingDestinationRelativePathHasDuplicate"/>
</CheckItemsForDuplication>
<!-- (Debug Only, Turn on EnablePackageProcessLoggingAndAssert if needed )
Check for Duplicate Source, this is a warning, it may be desire-->
<CheckItemsForDuplication
Condition="$(EnablePackageProcessLoggingAndAssert)"
Items="@(FilesForPackagingFromProject)"
TraceLevel="Warning">
<Output TaskParameter="HasDuplicate" PropertyName="_FilesForPackagingIdentityHasDuplicate"/>
</CheckItemsForDuplication>
<CallTarget Targets="$(OnAfterPipelineCollectFilesPhase)" RunEachTargetSeparately="False" />
</Target>
<!--********************************************************************-->
<!--Target TransformWebConfig -->
<!--********************************************************************-->
<PropertyGroup>
<OnBeforeTransformWebConfig Condition="'$(OnBeforeTransformWebConfig)'==''">
</OnBeforeTransformWebConfig>
<OnAfterTransformWebConfig Condition="'$(OnAfterTransformWebConfig)'==''">
</OnAfterTransformWebConfig>
<TransformWebConfigDependsOn>
$(OnBeforeTransformWebConfig)
PreTransformWebConfig;
TransformWebConfigCore;
ParameterizeTransformWebConfigCore;
PostTransformWebConfig;
</TransformWebConfigDependsOn>
</PropertyGroup>
<Target Name="TransformWebConfig"
DependsOnTargets="$(TransformWebConfigDependsOn)">
</Target>
<PropertyGroup>
<CollectWebConfigsToTransformDependsOn>
PipelineCollectFilesPhase;
</CollectWebConfigsToTransformDependsOn>
</PropertyGroup>
<Target Name="CollectWebConfigsToTransform" DependsOnTargets="$(CollectWebConfigsToTransformDependsOn)">
<!-- Gather Sources, Transforms, and Destinations for the TransformXml task -->
<ItemGroup Condition="'$(ProjectConfigTransformFileName)'!=''">
<WebConfigsToTransform Include="@(FilesForPackagingFromProject)"
Condition="'%(FilesForPackagingFromProject.Filename)%(FilesForPackagingFromProject.Extension)'=='$(ProjectConfigFileName)'">
<TransformFile>%(RelativeDir)$(ProjectConfigTransformFileName)</TransformFile>
<TransformOriginalFile>$(TransformWebConfigIntermediateLocation)\original\%(DestinationRelativePath)</TransformOriginalFile>
<TransformOutputFile>$(TransformWebConfigIntermediateLocation)\transformed\%(DestinationRelativePath)</TransformOutputFile>
<TransformScope>$([System.IO.Path]::GetFullPath($(_PackageTempDir)\%(DestinationRelativePath)))</TransformScope>
</WebConfigsToTransform>
<_WebConfigsToTransformOuputs Include="@(WebConfigsToTransform->'%(TransformOutputFile)')" />
</ItemGroup>
<PropertyGroup>
<_WebConfigsToTransformOuputsDirectories>@(_WebConfigsToTransformOuputs->'%(RootDir)%(Directory)')</_WebConfigsToTransformOuputsDirectories>
</PropertyGroup>
<ItemGroup>
<_WebConfigsToTransformOuputsDirectories Include="$(_WebConfigsToTransformOuputsDirectories)" />
</ItemGroup>
<!-- Debugging messages -->
<PropertyGroup>
<_MessageArguments>@(WebConfigsToTransform->'%(DestinationRelativePath)', ', ')</_MessageArguments>
</PropertyGroup>
<GetPublishingLocalizedString
ID="PublishLocalizedString_FoundApplicationConfigForTransformation"
ArgumentCount="1"
Arguments="$(_MessageArguments)"
LogType="Message" />
<!-- Make sure required directories exist -->
<MakeDir Directories="@(_WebConfigsToTransformOuputsDirectories)" Condition="!Exists(%(Identity))"/>
<CallTarget Targets="$(OnAfterTransformWebConfig)" RunEachTargetSeparately="False" />
</Target>
<!--********************************************************************-->
<!--Target PreTransformWebConfig -->
<!--********************************************************************-->
<PropertyGroup>
<PreTransformWebConfigDependsOn>
CollectWebConfigsToTransform;
</PreTransformWebConfigDependsOn>
</PropertyGroup>
<Target Name="PreTransformWebConfig"
DependsOnTargets="$(PreTransformWebConfigDependsOn)">
<!--Mark all the assistent file whose DependsOn is web.config to Exclude-->
<FilterByItems PipelineItems="@(FilesForPackagingFromProject)"
SourceMetadataName="DependentUpon"
FilterMetadataName="DestinationRelativePath"
Filter="@(WebConfigsToTransform)"
Condition="$(ExcludeTransformAssistFilesFromPublish)"
>
<Output TaskParameter="InFilter" ItemName="_NeedtoMarkasExclude_ConfigAssistFiles"/>
</FilterByItems>
<ItemGroup>
<!--Mark all the assistent file whose DependsOn is web.config to Exclude-->
<FilesForPackagingFromProject Remove="@(_NeedtoMarkasExclude_ConfigAssistFiles)" Condition="$(ExcludeTransformAssistFilesFromPublish)">
</FilesForPackagingFromProject>
<FilesForPackagingFromProject Include="@(_NeedtoMarkasExclude_ConfigAssistFiles)" Condition="$(ExcludeTransformAssistFilesFromPublish)">
<Exclude>True</Exclude>
</FilesForPackagingFromProject>
<!--Gather all the web.config which doesn't have the transform file -->
<_TempNoTrnasformWebConfigToTransform Include="@(WebConfigsToTransform)"
Condition="!Exists(%(TransformFile))" />
<!--Remove all the web.config doesn't have transform file -->
<WebConfigsToTransform Remove="@(_TempNoTrnasformWebConfigToTransform)"/>
</ItemGroup>
<PropertyGroup>
<_WebConfigTransformOutput>@(WebConfigsToTransform->'%(TransformOutputFile)')</_WebConfigTransformOutput>
<_WebConfigTransformOutput Condition="$(UseParameterizeToTransformWebConfig)">$(_WebConfigTransformOutput);$(_WebConfigTransformOutputParametersFile)</_WebConfigTransformOutput>
</PropertyGroup>
<!-- Remove the output file if there is change on $(UseParameterizeToTransformWebConfig)-->
<Delete Files="@(WebConfigsToTransform->'%(TransformOutputFile)');$(_WebConfigTransformOutputParametersFile)"
Condition="(!$(UseParameterizeToTransformWebConfig) And Exists($(_WebConfigTransformOutputParametersFile)))
Or ($(UseParameterizeToTransformWebConfig) And !Exists($(_WebConfigTransformOutputParametersFile)))"
ContinueOnError="true"/>
<!-- Debugging messages -->
<WriteLinesToFile Condition="$(EnablePackageProcessLoggingAndAssert) And ('@(WebConfigsToTransform)'!='') And !%(Exclude)"
Encoding="utf-8"
Overwrite="True"
File="$(PackageLogDir)\PreTransformWebConfig.Log"
Lines="@(PreTransformWebConfig->'
Transforming input: (WebConfigsToTransform)
with: %(TransformFile)
output: %(TransformOutputFile)
')" />
<WriteLinesToFile Condition="$(EnablePackageProcessLoggingAndAssert)"
Encoding="utf-8"
Overwrite="False"
File="$(PackageLogDir)\PreTransformWebConfig.Log"
Lines="_WebConfigTransformOutput: $(_WebConfigTransformOutput)" />
<!--Copy the original web.config-->
<CopyPipelineFiles PipelineItems="@(WebConfigsToTransform)"
SourceDirectory="$(WebPublishPipelineProjectDirectory)"
TargetDirectory="$(TransformWebConfigIntermediateLocation)\original"
SkipMetadataExcludeTrueItems="True"
UpdateItemSpec="False"
DeleteItemsMarkAsExcludeTrue ="True">
<Output TaskParameter="UpdatedPipelineItems" ItemName="_UpdatedWebConfigsToTransform"/>
</CopyPipelineFiles>
<!-- Delete those web.config have been updated if existed-->
<Delete Files="@(_UpdatedWebConfigsToTransform->'%(TransformOutputFile)')" />
</Target>
<!--********************************************************************-->
<!--Target TransformWebConfigCore -->
<!--********************************************************************-->
<PropertyGroup>
<TransformWebConfigCoreDependsOn>
PreTransformWebConfig;
</TransformWebConfigCoreDependsOn>
</PropertyGroup>
<Target Name="TransformWebConfigCore"
DependsOnTargets="$(TransformWebConfigCoreDependsOn)"
Inputs="@(WebConfigsToTransform);%(TransformFile)"
Outputs="$(_WebConfigTransformOutput)"
Condition="@(WebConfigsToTransform)!='' And $(TransformWebConfigEnabled) And !$(UseParameterizeToTransformWebConfig)">
<!-- Execute transformations -->
<TransformXml Source="@(WebConfigsToTransform)"
Transform="%(TransformFile)"
Destination="%(TransformOutputFile)"
Condition="!%(Exclude)"
StackTrace="$(TransformWebConfigStackTraceEnabled)"
SourceRootPath="$(WebPublishPipelineSourceRootDirectory)"
TransformRootPath="$(WebPublishPipelineTransformRootDirectory)"/>
</Target>
<!--********************************************************************-->
<!--Target ParameterizeTransformWebConfigCore -->
<!--********************************************************************-->
<PropertyGroup>
<ParameterizeTransformWebConfigCoreDependsOn>
PreTransformWebConfig;
</ParameterizeTransformWebConfigCoreDependsOn>
</PropertyGroup>
<Target Name="ParameterizeTransformWebConfigCore"
DependsOnTargets="$(TransformWebConfigCoreDependsOn)"
Inputs="@(WebConfigsToTransform);%(TransformFile)"
Outputs="%(TransformOutputFile)"
Condition="$(TransformWebConfigEnabled) And $(UseParameterizeToTransformWebConfig)">
<!-- Remove all the output file-->
<Delete Files="@(WebConfigsToTransform->'%(TransformOutputFile)');$(_WebConfigTransformOutputParametersFile)" />
<!-- Execute transformations -->
<ParameterizeTransformXml
Source="@(WebConfigsToTransform)"
IsSourceAFile="True"
Transform="%(TransformFile)"
IsTransformAFile="True"
Destination="%(TransformOutputFile)"
IsDestinationAFile="True"
Scope="%(TransformScope)"
EnableTokenizeParameters="True"
UseXpathToFormParameter="$(ParameterizeTransformXmlUseXPath)"
StackTrace="$(TransformWebConfigStackTraceEnabled)"
SourceRootPath="$(WebPublishPipelineSourceRootDirectory)"
TransformRootPath="$(WebPublishPipelineTransformRootDirectory)"
Condition="!%(Exclude)">
<!-- Created the DeclareParameters for later after DB import is included-->
<Output TaskParameter="DeclareParameters" ItemName="_ParameterizeTransformWebConfig"/>
</ParameterizeTransformXml>
<!-- Set GenerateFileEvenIfEmpty to true to make sure incremental build works-->
<ExportParametersFile
Parameters="@(_ParameterizeTransformWebConfig)"
DeclareParameterFile="$(_WebConfigTransformOutputParametersFile)"
GenerateFileEvenIfEmpty="True"
/>
</Target>
<!--********************************************************************-->
<!--Target PostTransformWebConfig -->
<!--********************************************************************-->
<PropertyGroup>
<PostTransformWebConfigDependsOn>
TransformWebConfigCore;
ParameterizeTransformWebConfigCore;
</PostTransformWebConfigDependsOn>
</PropertyGroup>
<Target Name="PostTransformWebConfig"
DependsOnTargets="$(PostTransformWebConfigDependsOn)">
<ItemGroup>
<!--Remove untransformed Web.configs from the pipeline-->
<FilesForPackagingFromProject Remove="@(WebConfigsToTransform)" Condition="'@(WebConfigsToTransform)'!='' And !%(WebConfigsToTransform.Exclude) And Exists(%(WebConfigsToTransform.TransformOutputFile))"/>
<!--Add the transformed Web.configs at the new loction to the pipeline-->
<FilesForPackagingFromProject Include="@(WebConfigsToTransform->'%(TransformOutputFile)')" Condition="'@(WebConfigsToTransform)'!='' And !%(WebConfigsToTransform.Exclude) And Exists(%(WebConfigsToTransform.TransformOutputFile))"/>
</ItemGroup>
<!--Get Localized string before displaying message-->
<GetPublishingLocalizedString
Importance="High"
Condition="'@(WebConfigsToTransform)'!='' And !%(WebConfigsToTransform.Exclude) And Exists(%(WebConfigsToTransform.TransformOutputFile))"
ID="PublishLocalizedString_TransformConfigUsingTransformFileToTransformOutputFile"
ArgumentCount="3"
Arguments="@(WebConfigsToTransform->'%(Identity)');%(TransformFile); %(TransformOutputFile)"
LogType="Message" />
<!--<Message Importance="high"
Condition="'@(WebConfigsToTransform)'!='' And !%(WebConfigsToTransform.Exclude) And Exists(%(WebConfigsToTransform.TransformOutputFile))"
Text="Transformed @(WebConfigsToTransform) using %(TransformFile) into %(TransformOutputFile)" />-->
<ImportParametersFile Files="$(_WebConfigTransformOutputParametersFile)" Condition="$(UseParameterizeToTransformWebConfig) and Exists($(_WebConfigTransformOutputParametersFile))">
<Output TaskParameter="Result" ItemName="_ImportParameterizeTransformWebConfig"/>
</ImportParametersFile>
<ItemGroup>
<MsDeployDeclareParameters Include="@(_ImportParameterizeTransformWebConfig)"
Condition="!$(DisableAllVSGeneratedMSDeployParameter)">
<Value>%(_ImportParameterizeTransformWebConfig.DefaultValue)</Value>
<Priority>$(UserWebConfigParametersPriority)</Priority>
</MsDeployDeclareParameters>
</ItemGroup>
<!--Log the information Set $(EnablePackageProcessLoggingAndAssert) to True if you want to see this information-->
<MakeDir Condition="$(EnablePackageProcessLoggingAndAssert) And !Exists('$(PackageLogDir)')"
Directories="$(PackageLogDir)" />
<WriteLinesToFile Condition="$(EnablePackageProcessLoggingAndAssert)"
Encoding="utf-8"
File="$(PackageLogDir)\AfterTransformWebConfig.txt"
Lines="@(FilesForPackagingFromProject->'
From:%(Identity)
DestinationRelativePath:%(DestinationRelativePath)
Exclude:%(Exclude)
FromTarget:%(FromTarget)
Category:%(Category)
ProjectFileType:%(ProjectFileType)')" Overwrite="True" />
</Target>
<!--********************************************************************-->
<!--Target PreAutoParameterizationWebConfigConnectionStrings -->
<!--********************************************************************-->
<PropertyGroup>
<PreAutoParameterizationWebConfigConnectionStringsDependsOn>
PipelineTransformPhase;
</PreAutoParameterizationWebConfigConnectionStringsDependsOn>
</PropertyGroup>
<Target Name="PreAutoParameterizationWebConfigConnectionStrings"
DependsOnTargets="$(PreAutoParameterizationWebConfigConnectionStringsDependsOn)">
<ItemGroup>
<_WebConfigsToAutoParmeterizeCS Include="@(FilesForPackagingFromProject)"
Condition="'%(FilesForPackagingFromProject.Filename)%(FilesForPackagingFromProject.Extension)'=='$(ProjectConfigFileName)' And !%(FilesForPackagingFromProject.Exclude)">
<TransformOriginalFile>$(AutoParameterizationWebConfigConnectionStringsLocation)\original\%(DestinationRelativePath)</TransformOriginalFile>
<TransformOutputFile>$(AutoParameterizationWebConfigConnectionStringsLocation)\transformed\%(DestinationRelativePath)</TransformOutputFile>
<TransformScope>$([System.IO.Path]::GetFullPath($(_PackageTempDir)\%(DestinationRelativePath)))</TransformScope>
</_WebConfigsToAutoParmeterizeCS>
<_WebConfigsToAutoParmeterizeCSOuputFiles Include="@(_WebConfigsToAutoParmeterizeCS->'%(TransformOutputFile)')">
</_WebConfigsToAutoParmeterizeCSOuputFiles>
</ItemGroup>
<PropertyGroup>
<_WebConfigsToAutoParmeterizeCSOuputDirectories>@(_WebConfigsToAutoParmeterizeCSOuputFiles->'%(RootDir)%(Directory)')</_WebConfigsToAutoParmeterizeCSOuputDirectories>
<_WebConfigsToAutoParmeterizeCSOuput>@(_WebConfigsToAutoParmeterizeCS->'%(TransformOutputFile)');$(_WebConfigsToAutoParmeterizeCsTransformOutputParametersFile)</_WebConfigsToAutoParmeterizeCSOuput>
</PropertyGroup>
<ItemGroup>
<_WebConfigsToAutoParmeterizeCSOuputDirectories Include="$(_WebConfigsToAutoParmeterizeCSOuputDirectories)" />
</ItemGroup>
<!-- Remove the output file if there is change on $(UseParameterizeToTransformWebConfig)-->
<Delete Files="@(_WebConfigsToAutoParmeterizeCS->'%(TransformOutputFile)');$(_WebConfigsToAutoParmeterizeCsTransformOutputParametersFile)"
Condition="!Exists($(_WebConfigsToAutoParmeterizeCsTransformOutputParametersFile))"
ContinueOnError="true"/>
<!-- Make sure required directories exist -->
<MakeDir Directories="@(_WebConfigsToAutoParmeterizeCSOuputDirectories)" Condition="!Exists(%(Identity))"/>
<WriteLinesToFile Condition="$(EnablePackageProcessLoggingAndAssert) And ('@(_WebConfigsToAutoParmeterizeCS)'!='') And !%(Exclude)"
Encoding="utf-8"
Overwrite="True"
File="$(PackageLogDir)\PreAutoParameterizationWebConfigConnectionStrings.Log"
Lines="@(_WebConfigsToAutoParmeterizeCS->'
AutoCSTransform input: %(Identity)
output: %(TransformOutputFile)
')" />
<WriteLinesToFile Condition="$(EnablePackageProcessLoggingAndAssert)"
Encoding="utf-8"
Overwrite="False"
File="$(PackageLogDir)\PreAutoParameterizationWebConfigConnectionStrings.Log"
Lines="_WebConfigsToAutoParmeterizeCsTransformOutputParametersFile: $(_WebConfigsToAutoParmeterizeCsTransformOutputParametersFile)" />
<!--Copy the original web.config-->
<CopyPipelineFiles PipelineItems="@(_WebConfigsToAutoParmeterizeCS)"
SourceDirectory="$(WebPublishPipelineProjectDirectory)"
TargetDirectory="$(AutoParameterizationWebConfigConnectionStringsLocation)\original"
SkipMetadataExcludeTrueItems="True"
UpdateItemSpec="False"
DeleteItemsMarkAsExcludeTrue ="True">
<Output TaskParameter="UpdatedPipelineItems" ItemName="_UpdatedWebConfigsToAutoParmeterizeCS"/>
</CopyPipelineFiles>
<!-- Delete those web.config have been updated if existed-->
<Delete Files="@(_UpdatedWebConfigsToAutoParmeterizeCS->'%(TransformOutputFile)')" />
</Target>
<!--********************************************************************-->
<!--Target AutoParameterizationWebConfigConnectionStringsCore -->
<!--********************************************************************-->
<PropertyGroup>
<AutoParameterizationWebConfigConnectionStringsCoreDependsOn>
</AutoParameterizationWebConfigConnectionStringsCoreDependsOn>
</PropertyGroup>
<Target Name="AutoParameterizationWebConfigConnectionStringsCore"
Inputs="@(_WebConfigsToAutoParmeterizeCS)"
Outputs="$(_WebConfigsToAutoParmeterizeCSOuput)"
DependsOnTargets="$(AutoParameterizationWebConfigConnectionStringsCoreDependsOn)">
<!-- First Delete the output parameter file-->
<!-- Remove the output file if there is change on $(UseParameterizeToTransformWebConfig)-->
<Delete Files="@(_WebConfigsToAutoParmeterizeCS->'%(TransformOutputFile)');$(_WebConfigsToAutoParmeterizeCsTransformOutputParametersFile)"/>
<GetPublishingLocalizedString
ID="PublishLocalizedString_WebConfigConnectionStringParameterDescription">
<Output TaskParameter="Result" PropertyName="_PublishLocalizedString_WebConfigConnectionStringParameterDescription" />
</GetPublishingLocalizedString>
<PropertyGroup>
<DeployParameterWebConfigConnectionStringName Condition="'$(DeployParameterWebConfigConnectionStringName)'==''">$(DeployParameterPrefix)%24(name)-$(ProjectConfigFileName) Connection String</DeployParameterWebConfigConnectionStringName>
<DeployParameterWebConfigConnectionStringDescription Condition="'$(DeployParameterWebConfigConnectionStringDescription)'==''">%24(name) $(_PublishLocalizedString_WebConfigConnectionStringParameterDescription)</DeployParameterWebConfigConnectionStringDescription>
</PropertyGroup>
<!--First create the Tokenized Transformation in line-->
<CreateProperty Value="
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;configuration xmlns:xdt=&quot;http://schemas.microsoft.com/XML-Document-Transform&quot;&gt;
&lt;connectionStrings&gt;
&lt;add
connectionString=&quot;{% token='%24(ReplacableToken_%23(parameter)_%23(tokennumber))' xpathlocator='name' parameter='$(DeployParameterWebConfigConnectionStringName)' description='$(DeployParameterWebConfigConnectionStringDescription)' defaultValue='%24(connectionString)' tags='$(MsDeployDatabaseTag)' %}&quot;
xdt:Transform=&quot;SetTokenizedAttributes(connectionString)&quot; xdt:SupressWarnings=&quot;True&quot; /&gt;
&lt;/connectionStrings&gt;
&lt;/configuration&gt;
" >
<Output TaskParameter="Value" PropertyName="_AutoParameterizeCSTransformWithDefaultValue"/>
</CreateProperty>
<!--First create the Tokenized Transformation in line without Default Value-->
<CreateProperty Value="
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;configuration xmlns:xdt=&quot;http://schemas.microsoft.com/XML-Document-Transform&quot;&gt;
&lt;connectionStrings&gt;
&lt;add
connectionString=&quot;{% token='%24(ReplacableToken_%23(parameter)_%23(tokennumber))' xpathlocator='name' parameter='$(DeployParameterWebConfigConnectionStringName)' description='$(DeployParameterWebConfigConnectionStringDescription)' tags='$(MsDeployDatabaseTag)' %}&quot;
xdt:Transform=&quot;SetTokenizedAttributes(connectionString)&quot; xdt:SupressWarnings=&quot;True&quot; /&gt;
&lt;/connectionStrings&gt;
&lt;/configuration&gt;
" >
<Output TaskParameter="Value" PropertyName="_AutoParameterizeCSTransformNoDefaultValue"/>
</CreateProperty>
<PropertyGroup>
<_AutoParameterizeCSTransform>$(_AutoParameterizeCSTransformWithDefaultValue)</_AutoParameterizeCSTransform>
<_AutoParameterizeCSTransform Condition="$(AutoParameterizationWebConfigCSNoDefaultValue)">$(_AutoParameterizeCSTransformNoDefaultValue)</_AutoParameterizeCSTransform>
<_AutoParameterizeCSUseXPath Condition="'$(_AutoParameterizeCSUseXPath)'==''">True</_AutoParameterizeCSUseXPath>
</PropertyGroup>
<!-- Now we use the tokenize transform to auto parameterize the web.config-->
<ParameterizeTransformXml
Source="@(_WebConfigsToAutoParmeterizeCS)"
IsSourceAFile="True"
Transform="$(_AutoParameterizeCSTransform)"
IsTransformAFile="False"
Destination="%(TransformOutputFile)"
IsDestinationAFile="True"
Scope="%(TransformScope)"
EnableTokenizeParameters="True"
UseXpathToFormParameter="$(_AutoParameterizeCSUseXPath)"
StackTrace="$(TransformWebConfigStackTraceEnabled)"
SourceRootPath="$(WebPublishPipelineSourceRootDirectory)"
Condition="!%(Exclude)">
<!-- Created the DeclareParameters for later after DB import is included-->
<Output TaskParameter="DeclareParameters" ItemName="_ParamsFromWebConfigsToAutoParmeterizeCS"/>
</ParameterizeTransformXml>
<!-- Set GenerateFileEvenIfEmpty to true to make sure incremental build works-->
<ExportParametersFile
Parameters="@(_ParamsFromWebConfigsToAutoParmeterizeCS)"
DeclareParameterFile="$(_WebConfigsToAutoParmeterizeCsTransformOutputParametersFile)"
GenerateFileEvenIfEmpty="True"
/>
</Target>
<!--********************************************************************-->
<!--Target PostAutoParameterizationWebConfigConnectionStrings -->
<!--********************************************************************-->
<PropertyGroup>
<PostAutoParameterizationWebConfigConnectionStringsDependsOn>
</PostAutoParameterizationWebConfigConnectionStringsDependsOn>
</PropertyGroup>
<Target Name="PostAutoParameterizationWebConfigConnectionStrings"
DependsOnTargets="$(PostAutoParameterizationWebConfigConnectionStringsDependsOn)">
<ItemGroup>
<!--Remove untransformed Web.configs from the pipeline-->
<FilesForPackagingFromProject Remove="@(_WebConfigsToAutoParmeterizeCS)" Condition="'@(_WebConfigsToAutoParmeterizeCS)'!='' And !%(_WebConfigsToAutoParmeterizeCS.Exclude) And Exists(%(_WebConfigsToAutoParmeterizeCS.TransformOutputFile))"/>
<!--Add the transformed Web.configs at the new loction to the pipeline-->
<FilesForPackagingFromProject Include="@(_WebConfigsToAutoParmeterizeCS->'%(TransformOutputFile)')" Condition="'@(_WebConfigsToAutoParmeterizeCS)'!='' And !%(_WebConfigsToAutoParmeterizeCS.Exclude) And Exists(%(_WebConfigsToAutoParmeterizeCS.TransformOutputFile))"/>
</ItemGroup>
<!--Get Localized string before displaying message-->
<GetPublishingLocalizedString
Importance="High"
Condition="'@(_WebConfigsToAutoParmeterizeCS)'!='' And !%(_WebConfigsToAutoParmeterizeCS.Exclude) And Exists(%(_WebConfigsToAutoParmeterizeCS.TransformOutputFile))"
ID="PublishLocalizedString_AutoConnectionStringTransformConfigToTransformOutputFile"
ArgumentCount="2"
Arguments="@(_WebConfigsToAutoParmeterizeCS->'%(Identity)');%(TransformOutputFile)"
LogType="Message" />
<!--<Message Importance="high"
Condition="'@(_WebConfigsToAutoParmeterizeCS)'!='' And !%(_WebConfigsToAutoParmeterizeCS.Exclude) And Exists(%(_WebConfigsToAutoParmeterizeCS.TransformOutputFile))"
Text="Auto ConnectionString Transformed @(_WebConfigsToAutoParmeterizeCS) into %(TransformOutputFile)" />-->
<ImportParametersFile Files="$(_WebConfigsToAutoParmeterizeCsTransformOutputParametersFile)"
Condition="!$(DisableAllVSGeneratedMSDeployParameter) And Exists($(_WebConfigsToAutoParmeterizeCsTransformOutputParametersFile))" >
<Output TaskParameter="Result" ItemName="_ImportAutoParameterizeCSTransformWebConfig"/>
</ImportParametersFile>
<ItemGroup>
<MsDeployDeclareParameters Include="@(_ImportAutoParameterizeCSTransformWebConfig)">
<Value>%(_ImportAutoParameterizeCSTransformWebConfig.DefaultValue)</Value>
<Priority>$(VsWebConfigAutoCsParametersPriority)</Priority>
</MsDeployDeclareParameters>
</ItemGroup>
<WriteLinesToFile Condition="$(EnablePackageProcessLoggingAndAssert)"
Encoding="utf-8"
File="$(PackageLogDir)\PostAutoParameterizationWebConfigConnectionStrings.txt"
Lines="@(FilesForPackagingFromProject->'
From:%(Identity)
DestinationRelativePath:%(DestinationRelativePath)
Exclude:%(Exclude)
FromTarget:%(FromTarget)
Category:%(Category)
ProjectFileType:%(ProjectFileType)')" Overwrite="True" />
</Target>
<!--********************************************************************-->
<!--Target AutoParameterizationWebConfigConnectionStrings-->
<!--**********************************************************************-->
<PropertyGroup>
<OnBeforeAutoParameterizationWebConfigConnectionStrings Condition="'$(OnBeforeAutoParameterizationWebConfigConnectionStrings)'==''">
PipelineTransformPhase;
</OnBeforeAutoParameterizationWebConfigConnectionStrings>
<!--Targets get execute after this Target-->
<OnAfterAutoParameterizationWebConfigConnectionStrings Condition="'$(OnAfterAutoParameterizationWebConfigConnectionStrings)'==''">
</OnAfterAutoParameterizationWebConfigConnectionStrings>
<AutoParameterizationWebConfigConnectionStringsDependsOn Condition="'$(AutoParameterizationWebConfigConnectionStringsDependsOn)' == ''">
$(OnBeforeAutoParameterizationWebConfigConnectionStrings);
PreAutoParameterizationWebConfigConnectionStrings;
AutoParameterizationWebConfigConnectionStringsCore;
PostAutoParameterizationWebConfigConnectionStrings;
</AutoParameterizationWebConfigConnectionStringsDependsOn>
</PropertyGroup>
<Target Name="AutoParameterizationWebConfigConnectionStrings" DependsOnTargets="$(AutoParameterizationWebConfigConnectionStringsDependsOn)"
Condition="$(AutoParameterizationWebConfigConnectionStrings)">
</Target>
<!--********************************************************************-->
<!--Target PipelineTransformPhase -->
<!--********************************************************************-->
<PropertyGroup>
<!--Default global ExcludeTransformAssistFilesFromPublish to True. By default remove web.debug.config, web.release.config-->
<ExcludeTransformAssistFilesFromPublish Condition="'$(ExcludeTransformAssistFilesFromPublish)'==''">True</ExcludeTransformAssistFilesFromPublish>
<!--Targets get execute before this Target-->
<OnBeforePipelineTransformPhase Condition="'$(OnBeforePipelineTransformPhase)'==''">
PipeLineCollectFilesPhase;
</OnBeforePipelineTransformPhase>
<!--Targets get execute after this Target-->
<OnAfterPipelineTransformPhase Condition="'$(OnAfterPipelineTransformPhase)'==''">
</OnAfterPipelineTransformPhase>
<PipelineTransformPhaseDependsOn Condition="'$(PipelineTransformPhaseDependsOn)'==''">
$(OnBeforePipelineTransformPhase);
TransformWebConfig;
</PipelineTransformPhaseDependsOn>
</PropertyGroup>
<Target Name="PipelineTransformPhase"
Outputs="@(FilesForPackagingFromProject)"
DependsOnTargets="$(PipelineTransformPhaseDependsOn)">
<!--This is a phase separation point-->
<!--Get Localized string before displaying message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_WebPublishPipelineTransformPhase"
LogType="Message" />
<!--<Message Text="Pipeline Transform Phase" />-->
<CallTarget Targets="$(OnAfterPipelineTransformPhase)" RunEachTargetSeparately="False" />
</Target>
<!--******************************************************************** -->
<!-- _WPPCopyWebApplication Target -->
<!-- This will materialize all the in-memory files list which is nor mark -->
<!-- as excldued from packaging into the package temp folder. -->
<!--ToDo: remove the condition on ContentPath Package (we are doing it now because IIS team is not support it yet-->
<!-- ******************************************************************** -->
<PropertyGroup>
<OnBefore_WPPCopyWebApplication Condition="'$(OnBefore_WPPCopyWebApplication)'==''">
</OnBefore_WPPCopyWebApplication>
<OnBefore_WPPCopyWebApplication>
$(OnBefore_WPPCopyWebApplication);
CleanWebProjectOutputDir;
PipelineTransformPhase;
</OnBefore_WPPCopyWebApplication>
<!--Targets get execute after this Target-->
<OnAfter_WPPCopyWebApplication Condition="'$(OnAfter_WPPCopyWebApplication)'==''">
</OnAfter_WPPCopyWebApplication>
<_WPPCopyWebApplicationDependsOn Condition="'$(_WPPCopyWebApplicationDependsOn)' == ''">
$(OnBefore_WPPCopyWebApplication);
</_WPPCopyWebApplicationDependsOn>
</PropertyGroup>
<Target Name="_WPPCopyWebApplication"
DependsOnTargets="$(_WPPCopyWebApplicationDependsOn)"
>
<!-- In the case of the incremental Packaging/Publish, we need to find out the extra file and delee them-->
<ItemGroup>
<_AllExtraFilesUnderProjectOuputFolder Include="$(WebProjectOutputDir)\**" />
<_AllExtraFilesUnderProjectOuputFolder
Remove="@(FilesForPackagingFromProject->'$(WebProjectOutputDir)\%(DestinationRelativePath)')" />
</ItemGroup>
<!--Remove all extra files in the temp folder that's not in the @(FilesForPackagingFromProject-->
<Delete Files="@(_AllExtraFilesUnderProjectOuputFolder)" />
<!-- Make sure the folder exist -->
<MakeDir Directories="$(WebProjectOutputDir)" Condition="!Exists('$(WebProjectOutputDir)')"/>
<!--Get Localized string before displaying message-->
<GetPublishingLocalizedString
Importance="High"
ID="PublishLocalizedString_WebPublishPipelineCopyWebApplication"
ArgumentCount="2"
Arguments="$(WebPublishPipelineProjectName);$(WebProjectOutputDir)"
LogType="Message" />
<!--<Message Importance="high"
Text="Copying Web Application Project Files for $(WebPublishPipelineProjectName) to $(WebProjectOutputDir)" />-->
<!--Force Copy Of all file to the WebProjectOutputDir if needed-->
<CopyPipelineFiles PipelineItems="@(FilesForPackagingFromProject)"
SourceDirectory="$(WebPublishPipelineProjectDirectory)"
TargetDirectory="$(WebProjectOutputDir)"
SkipMetadataExcludeTrueItems="True"
UpdateItemSpec="True"
DeleteItemsMarkAsExcludeTrue ="True">
</CopyPipelineFiles>
<!--Remove all Empty folder that's left. Since it is not critial, we only log warning if we failed to delete empty folder.-->
<RemoveEmptyDirectories Directories="$(WebProjectOutputDir)" LogErrorAsWarning="True" />
<MakeDir Directories="$(WebProjectOutputDir)" Condition="!Exists('$(WebProjectOutputDir)')"/>
<CallTarget Targets="$(OnAfter_WPPCopyWebApplication)" RunEachTargetSeparately="False" />
</Target>
<!--********************************************************************-->
<!--Target PipelinePreDeployCopyAllFilesToOneFolder -->
<!--********************************************************************-->
<PropertyGroup>
<!--Targets get execute before this Target-->
<OnBeforePipelinePreDeployCopyAllFilesToOneFolder Condition="'$(OnBeforePipelinePreDeployCopyAllFilesToOneFolder)'==''">
</OnBeforePipelinePreDeployCopyAllFilesToOneFolder>
<!--Targets get execute after this Target-->
<OnAfterPipelinePreDeployCopyAllFilesToOneFolder Condition="'$(OnAfterPipelinePreDeployCopyAllFilesToOneFolder)'==''">
</OnAfterPipelinePreDeployCopyAllFilesToOneFolder>
<PipelinePreDeployCopyAllFilesToOneFolderDependsOn Condition="'$(PipelinePreDeployCopyAllFilesToOneFolderDependsOn)'==''">
$(OnBeforePipelinePreDeployCopyAllFilesToOneFolder);
PipelineTransformPhase;
AutoParameterizationWebConfigConnectionStrings;
CopyAllFilesToSingleFolderForPackage;
</PipelinePreDeployCopyAllFilesToOneFolderDependsOn>
</PropertyGroup>
<Target Name="PipelinePreDeployCopyAllFilesToOneFolder"
DependsOnTargets="$(PipelinePreDeployCopyAllFilesToOneFolderDependsOn)">
<!--This is a phase separation point. Some deploy doesn't need to copy all file to a folder, But for MSDeploy, it required to have all file in a single folder-->
<!--Get Localized string before displaying message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_WebPublishPipelineDeployPhaseStage1"
LogType="Message" />
<!--<Message Text="Pipeline PreDeploy CopyAllFilesToOneFolder Stage" />-->
<CallTarget Targets="$(OnAfterPipelinePreDeployCopyAllFilesToOneFolder)" RunEachTargetSeparately="False" />
</Target>
<!--********************************************************************-->
<!--GetProjectProperties Task-->
<!--********************************************************************-->
<!--GetProjectWebPropertiesDependsOn-->
<PropertyGroup>
<GetProjectWebPropertiesDependsOn Condition="'$(GetProjectWebPropertiesDependsOn)'==''">
</GetProjectWebPropertiesDependsOn>
</PropertyGroup>
<Target Name="GetProjectWebProperties"
Condition="'$(UseIis)' == '' Or '$(IisUrl)' == '' Or '$(LocalIisVersion)' == '' Or '$(DestinationIisVersion)' ==''"
DependsOnTargets="$(GetProjectWebPropertiesDependsOn)">
<PropertyGroup>
<LocalIisVersion>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Inetstp@MajorVersion)</LocalIisVersion>
<LocalIisVersion Condition="'$(LocalIisVersion)'==''">0</LocalIisVersion>
</PropertyGroup>
<GetProjectProperties ProjectFileFullPath="$(WebPublishPipelineWAPProjectSettings)">
<Output TaskParameter="UseIis" PropertyName="UseIis" Condition="'$(UseIis)' == ''" />
<Output TaskParameter="IisUrl" PropertyName="IisUrl" Condition="'$(IisUrl)' == ''"/>
</GetProjectProperties>
<!--We can only do this here after UseIis is determined-->
<PropertyGroup>
<_DeploymentUseIis Condition="'$(_DeploymentUseIis)'=='' And $(IncludeIisSettings)">$(UseIis)</_DeploymentUseIis>
<_DeploymentUseIis Condition="'$(_DeploymentUseIis)'==''">False</_DeploymentUseIis>
<_DeploymentAsIisApp>$(DeployAsIisApp)</_DeploymentAsIisApp>
<_DeploymentAsIisApp Condition="$(_DeploymentUseIis)">False</_DeploymentAsIisApp>
<DestinationUseIis Condition="'$(DestinationUseIis)'=='' And $(IncludeIisSettings)">$(UseIis)</DestinationUseIis>
<DestinationUseIis Condition="'$(DestinationUseIis)'==''">False</DestinationUseIis>
<_DeploymentUseIISExpressHint>$(UseIISExpress)</_DeploymentUseIISExpressHint>
<_DeploymentUseIISExpressHint Condition="'$(_DeploymentUseIISExpressHint)'==''">False</_DeploymentUseIISExpressHint>
</PropertyGroup>
<!--We should only get IIS relative informaiton when $(IncludeIisSettings) is true-->
<MapUriToIisWebServer Condition="$(UseIis) And ('$(IisUrl)' != '') And $(IncludeIisSettings)"
ProjectIisUrl="$(IisUrl)"
UseIISExpressHintFlag="$(_DeploymentUseIISExpressHint)">
<Output TaskParameter="MetakeyPath" PropertyName="_MSDeployIisUrlSource_MetakeyPathSearchPath" />
<Output TaskParameter="MetakeyPathUsingSiteName" PropertyName="_MSDeployIisUrlSource_MetakeyPath" />
<Output TaskParameter="AppHostConfigPath" PropertyName="_MSDeployIisUrlSource_AppHostConfigPath" />
<Output TaskParameter="IisWebsiteId" PropertyName="IisUrl_SiteID" />
<Output TaskParameter="IisWebsiteFriendlyName" PropertyName="IisUrl_SiteFriendlyName" />
<Output TaskParameter="SiteRelativePath" PropertyName="IisUrl_SiteRelativePath" />
<Output TaskParameter="WebServerAppHostConfigDirectory" PropertyName="IisServer_WebServerAppHostConfigDirectory" />
<Output TaskParameter="WebServerDirectory" PropertyName="IisServer_WebServerDirectory" />
<Output TaskParameter="WebServerManifest" PropertyName="IisServer_WebServerManifest" />
<Output TaskParameter="IisMajorVersion" PropertyName="IisServer_IisMajorVersion" />
<Output TaskParameter="ApplicationPoolName" PropertyName="IisServer_IisAppPoolName" />
</MapUriToIisWebServer>
<FilterByItems PipelineItems="@(_IISApplicationPool)"
Filter="$(IisServer_IisAppPoolName)">
<Output TaskParameter="InFilter" ItemName="_IISApplicationPoolFound"/>
</FilterByItems>
<PropertyGroup>
<_Destination_IisServer_IisAppPoolName Condition="'@(_IISApplicationPoolFound)'!=''">%(_IISApplicationPoolFound.DestinationIISApplicationPool)</_Destination_IisServer_IisAppPoolName>
<_Destination_IisServer_IisAppPoolName Condition="'$(_Destination_IisServer_IisAppPoolName)'==''">$(IisServer_IisAppPoolName)</_Destination_IisServer_IisAppPoolName>
</PropertyGroup>
<!--Set the Site default to Site : note: UI need to be smarter on this-->
<PropertyGroup>
<_IsRootWebsite>False</_IsRootWebsite>
<_IsRootWebsite Condition="('$(IisUrl_SiteRelativePath)' == '/')">True</_IsRootWebsite>
<DefaultDeployIisAppPath Condition="$(_IsRootWebsite)">$(DefaultDeployIisRootAppPath)</DefaultDeployIisAppPath>
<LocalIisVersion Condition="'$(IisServer_IisMajorVersion)' != '0' And '$(IisServer_IisMajorVersion)' != '' ">$(IisServer_IisMajorVersion)</LocalIisVersion>
<DestinationIisVersion Condition="'$(DestinationIisVersion)'==''">$(LocalIisVersion)</DestinationIisVersion>
</PropertyGroup>
<!--elevate this property out to global scope to be used by transport target-->
<CreateProperty Value="$(_DeploymentUseIis)">
<Output TaskParameter="Value" PropertyName="IncludeIisSettingsOnPublish"/>
</CreateProperty>
</Target>
<!--********************************************************************-->
<!-- Package Task-->
<!--********************************************************************-->
<PropertyGroup>
<PackageDependsOn Condition="'$(PackageDependsOn)'==''">
PipelinePreDeployCopyAllFilesToOneFolder;
</PackageDependsOn>
</PropertyGroup>
<Target Name="Package"
Condition="$(_CreatePackage)"
DependsOnTargets="$(PackageDependsOn)">
<!--Log the information Set $(EnablePackageProcessLoggingAndAssert) to True if you want to see this information-->
<MakeDir Condition="$(EnablePackageProcessLoggingAndAssert) And !Exists('$(PackageLogDir)')"
Directories="$(PackageLogDir)" />
<WriteLinesToFile Condition="$(EnablePackageProcessLoggingAndAssert)"
Encoding="utf-8"
File="$(PackageLogDir)\Prepackage.txt"
Lines="@(FilesForPackagingFromProject->'
From:%(Identity)
DestinationRelativePath:%(DestinationRelativePath)
Exclude:%(Exclude)
FromTarget:%(FromTarget)
Category:%(Category)
ProjectFileType:%(ProjectFileType)')" Overwrite="True" />
<!--Get Localized string before displaying message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_WebPublishPipelineMSDeploySettings"
LogType="Message" />
<GetPublishingLocalizedString
Condition="'$(LocalIisVersion)' != ''"
ID="PublishLocalizedString_MsBuildPropertySettingValue"
ArgumentCount="2"
Arguments="LocalIisVersion;$(LocalIisVersion)"
LogType="Message" />
<GetPublishingLocalizedString
Condition="'$(DestinationIisVersion)' != ''"
ID="PublishLocalizedString_MsBuildPropertySettingValue"
ArgumentCount="2"
Arguments="DestinationIisVersion;$(DestinationIisVersion)"
LogType="Message" />
<GetPublishingLocalizedString
Condition="'$(UseIis)' != ''"
ID="PublishLocalizedString_MsBuildPropertySettingValue"
ArgumentCount="2"
Arguments="UseIis;$(UseIis)"
LogType="Message" />
<GetPublishingLocalizedString
Condition="'$(IisUrl)' != ''"
ID="PublishLocalizedString_MsBuildPropertySettingValue"
ArgumentCount="2"
Arguments="IisUrl;$(IisUrl)"
LogType="Message" />
<GetPublishingLocalizedString
Condition="'$(IncludeIisSettings)' != ''"
ID="PublishLocalizedString_MsBuildPropertySettingValue"
ArgumentCount="2"
Arguments="IncludeIisSettings;$(IncludeIisSettings)"
LogType="Message" />
<GetPublishingLocalizedString
Condition="'$(_DeploymentUseIis)' != ''"
ID="PublishLocalizedString_MsBuildPropertySettingValue"
ArgumentCount="2"
Arguments="_DeploymentUseIis;$(_DeploymentUseIis)"
LogType="Message" />
<GetPublishingLocalizedString
Condition="'$(DestinationUseIis)' != ''"
ID="PublishLocalizedString_MsBuildPropertySettingValue"
ArgumentCount="2"
Arguments="DestinationUseIis;$(DestinationUseIis)"
LogType="Message" />
<GetPublishingLocalizedString
Condition="'$(IisUrl_SiteID)' != ''"
ID="PublishLocalizedString_MsBuildPropertySettingValue"
ArgumentCount="2"
Arguments="IisUrl_SiteID;$(IisUrl_SiteID)"
LogType="Message" />
<GetPublishingLocalizedString
Condition="'$(IisUrl_SiteFriendlyName)' != ''"
ID="PublishLocalizedString_MsBuildPropertySettingValue"
ArgumentCount="2"
Arguments="IisUrl_SiteFriendlyName;$(IisUrl_SiteFriendlyName)"
LogType="Message" />
<GetPublishingLocalizedString
Condition="'$(IisUrl_SiteRelativePath)' != ''"
ID="PublishLocalizedString_MsBuildPropertySettingValue"
ArgumentCount="2"
Arguments="IisUrl_SiteRelativePath;$(IisUrl_SiteRelativePath)"
LogType="Message" />
<GetPublishingLocalizedString
Condition="'$(IisServer_IisAppPoolName)' != ''"
ID="PublishLocalizedString_MsBuildPropertySettingValue"
ArgumentCount="2"
Arguments="IisServer_IisAppPoolName;$(IisServer_IisAppPoolName)"
LogType="Message" />
<GetPublishingLocalizedString
Condition="'$(_Destination_IisServer_IisAppPoolName)' != ''"
ID="PublishLocalizedString_MsBuildPropertySettingValue"
ArgumentCount="2"
Arguments="_Destination_IisServer_IisAppPoolName;$(_Destination_IisServer_IisAppPoolName)"
LogType="Message" />
<!--<Message Text="Invoking MSDeploy to generate the package
Machine IIS Version is $(LocalIisVersion)
Deploy IIS Version is $(DestinationIisVersion)
UseIis is $(UseIis)
IisUrl is $(IisUrl)
IncludeIisSettings is $(IncludeIisSettings)
_DeploymentUseIis is $(_DeploymentUseIis)
DestinationUseIis is $(DestinationUseIis)
IisUrl_SiteID is $(IisUrl_SiteID)
IisUrl_SiteFriendlyName is $(IisUrl_SiteFriendlyName)
IisUrl_SiteRelativePath is $(IisUrl_SiteRelativePath)"
/>-->
<ItemGroup>
<_PackageFileLocation Include="$(PackageFileName)" />
</ItemGroup>
<PropertyGroup>
<_PackageRoot Condition="$(PackageAsSingleFile)">@(_PackageFileLocation->'%(RootDir)%(Directory)')</_PackageRoot>
<_PackageRoot Condition="!$(PackageAsSingleFile)">$(PackageArchiveRootDir)</_PackageRoot>
</PropertyGroup>
<!--make sure all folders are exist-->
<MakeDir Condition="!Exists($(_PackageRoot))" Directories="$(_PackageRoot)" />
<!--Call package base on condition-->
<CallTarget Targets="PackageUsingManifest"/>
</Target>
<!--******************************************************************** -->
<!-- CopyAllFilesToSingleFolderForPackage Task -->
<!-- This will materialize all the in-memory files list which is nor mark -->
<!-- as excldued from packaging into the package temp folder. -->
<!--ToDo: remove the condition on ContentPath Package (we are doing it now because IIS team is not support it yet-->
<!-- ******************************************************************** -->
<PropertyGroup>
<OnBeforeCopyAllFilesToSingleFolderForPackage Condition="'$(OnBeforeCopyAllFilesToSingleFolderForPackage)'==''">
</OnBeforeCopyAllFilesToSingleFolderForPackage>
<OnBeforeCopyAllFilesToSingleFolderForPackage Condition="$(CleanPackageTempDir)">
$(OnBeforeCopyAllFilesToSingleFolderForPackage);
CleanWebsitesPackageTempDir;
</OnBeforeCopyAllFilesToSingleFolderForPackage>
<!--Targets get execute after this Target-->
<OnAfterCopyAllFilesToSingleFolderForPackage Condition="'$(OnAfterCopyAllFilesToSingleFolderForPackage)'==''">
</OnAfterCopyAllFilesToSingleFolderForPackage>
<CopyAllFilesToSingleFolderForPackageDependsOn Condition="'$(CopyAllFilesToSingleFolderForPackageDependsOn)' == ''">
$(OnBeforeCopyAllFilesToSingleFolderForPackage);
</CopyAllFilesToSingleFolderForPackageDependsOn>
</PropertyGroup>
<Target Name="CopyAllFilesToSingleFolderForPackage"
DependsOnTargets="$(CopyAllFilesToSingleFolderForPackageDependsOn)"
>
<!-- In the case of the incremental Packaging/Publish, we need to find out the extra file and delee them-->
<ItemGroup>
<_AllExtraFilesUnderTempFolder Include="$(_PackageTempDir)\**" />
<_AllExtraFilesUnderTempFolder
Remove="@(FilesForPackagingFromProject->'$(_PackageTempDir)\%(DestinationRelativePath)')" />
</ItemGroup>
<!--Remove all extra files in the temp folder that's not in the @(FilesForPackagingFromProject-->
<Delete Files="@(_AllExtraFilesUnderTempFolder)" />
<!-- Make sure the folder exist -->
<MakeDir Directories="$(_PackageTempDir)" Condition="!Exists('$(_PackageTempDir)')"/>
<!--Get Localized string before displaying message-->
<GetPublishingLocalizedString
Importance="High"
ID="PublishLocalizedString_WebPublishPipelineMaterializeAllFilesToTempDir"
ArgumentCount="1"
Arguments="$(_PackageTempDir)"
LogType="Message" />
<!--<Message Importance="high"
Text="Copying all files to temporary location below for package/publish:
$(_PackageTempDir)" />-->
<!--Force Copy Of all file to the _PackageTempDir if needed-->
<CopyPipelineFiles PipelineItems="@(FilesForPackagingFromProject)"
SourceDirectory="$(WebPublishPipelineProjectDirectory)"
TargetDirectory="$(_PackageTempDir)"
SkipMetadataExcludeTrueItems="True"
UpdateItemSpec="True"
DeleteItemsMarkAsExcludeTrue ="True">
<Output TaskParameter="ResultPipelineItems" ItemName="_FilesForPackagingFromProjectTempory"/>
</CopyPipelineFiles>
<!--Work around the MSBuild 2.0 limition-->
<ItemGroup>
<FilesForPackagingFromProject Remove="@(FilesForPackagingFromProject)" />
<FilesForPackagingFromProject Include="@(_FilesForPackagingFromProjectTempory)" />
</ItemGroup>
<!--Remove all Empty folder that's left. Since it is not critial, we only log warning if we failed to delete empty folder.-->
<RemoveEmptyDirectories Directories="$(_PackageTempDir)" LogErrorAsWarning="True" />
<MakeDir Directories="$(_PackageTempDir)" Condition="!Exists('$(_PackageTempDir)')"/>
<CallTarget Targets="$(OnAfterCopyAllFilesToSingleFolderForPackage)" RunEachTargetSeparately="False" />
</Target>
<!--********************************************************************-->
<!-- AddIis7ToSourceManifest -->
<!-- ********************************************************************-->
<PropertyGroup>
<BeforeAddIis7ToSourceManifest Condition="'$(BeforeAddIis7ToSourceManifest)'==''">
</BeforeAddIis7ToSourceManifest>
<AfterAddIis7ToSourceManifest Condition="'$(AfterAddIis7ToSourceManifest)'==''">
</AfterAddIis7ToSourceManifest>
<AddIis7ToSourceManifestDependsOn Condition="'$(AddIis7ToSourceManifestDependsOn)' == ''">
$(BeforeAddIis7ToSourceManifest);
PipelinePreDeployCopyAllFilesToOneFolder;
GenerateMsDeployManifestSettings;
</AddIis7ToSourceManifestDependsOn>
</PropertyGroup>
<Target Name="AddIis7ToSourceManifest"
Condition="$(_DeploymentUseIis) And ($(LocalIisVersion) &gt;= '7')"
DependsOnTargets="$(AddIis7ToSourceManifestDependsOn)">
<!--Get Localized string before displaying error-->
<GetPublishingLocalizedString
Condition="'$(IisUrl)'==''"
ID="PublishLocalizedString_ErrorUseIisIsTrueButIisUrlIsEmpty"
LogType="Error" />
<!--<Error Condition="'$(IisUrl)'==''" Text="IisUrl property is required when UseIis property is True" />-->
<ItemGroup>
<MsDeploySourceManifest Include="appHostConfig">
<Path>$(_MSDeployIisUrlSource_AppHostConfigPath)</Path>
</MsDeploySourceManifest>
</ItemGroup>
<CallTarget Condition="'$(AfterAddIis7ToSourceManifest)' != ''"
Targets="$(AfterAddIis7ToSourceManifest)"
RunEachTargetSeparately="False" />
</Target>
<!--********************************************************************-->
<!-- AddDeclareParametersItemsForIis7 -->
<!--We can remove this once Iis team make the package self contain-->
<!-- ********************************************************************-->
<PropertyGroup>
<BeforeAddDeclareParametersItemsForIis7 Condition="'$(BeforeAddDeclareParametersItemsForIis7)'==''">
</BeforeAddDeclareParametersItemsForIis7>
<AfterAddDeclareParametersItemsForIis7 Condition="'$(AfterAddDeclareParametersItemsForIis7)'==''">
</AfterAddDeclareParametersItemsForIis7>
<AddDeclareParametersItemsForIis7DependsOn Condition="'$(AddDeclareParametersItemsForIis7DependsOn)' == ''">
$(BeforeAddDeclareParametersItemsForIis7);
PipelinePreDeployCopyAllFilesToOneFolder;
GenerateMsDeployManifestSettings;
</AddDeclareParametersItemsForIis7DependsOn>
</PropertyGroup>
<Target Name="AddDeclareParametersItemsForIis7"
Condition="$(_DeploymentUseIis) And ($(LocalIisVersion) &gt;= '7')"
DependsOnTargets="$(AddDeclareParametersItemsForIis7DependsOn)">
<!--Parameterize the default value of the Path-->
<EscapeTextForRegularExpressions Text="$(_MSDeployIisUrlSource_AppHostConfigPath)">
<Output TaskParameter="Result" PropertyName="_EscapeRegEx_MSDeployIisUrlSource_AppHostConfigPath" />
</EscapeTextForRegularExpressions>
<ItemGroup Condition="!$(DisableAllVSGeneratedMSDeployParameter) And $(_DeploymentUseIis) And ($(LocalIisVersion) &gt;= '7')" >
<MsDeployDeclareParameters Include="$(DeployParameterIISAppName)">
<Kind>ProviderPath</Kind>
<Scope>AppHostConfig</Scope>
<Match>^$(_EscapeRegEx_MSDeployIisUrlSource_AppHostConfigPath)$</Match>
<Description>$(DeployParameterIISAppNameDescription)</Description>
<DefaultValue>$(_MSDeployIisAppPathIIS7)</DefaultValue>
<Value>$(_MSDeployIisAppPathIIS7)</Value>
<Tags>IisApp</Tags>
<Priority>$(VsIisAppParametersPriority)</Priority>
</MsDeployDeclareParameters>
<MsDeployDeclareParameters Include="$(DeployParameterIISAppPoolName)"
Condition="'$(IisServer_IisAppPoolName)' != '' And '$(ParameterApplicationPool)' == 'True'">
<Kind>DeploymentObjectAttribute</Kind>
<Scope>application</Scope>
<Match>application[@applicationPool='$(IisServer_IisAppPoolName)']/@applicationPool</Match>
<Description>$(DeployParameterIISAppPoolNameDescription)</Description>
<DefaultValue>$(_Destination_IisServer_IisAppPoolName)</DefaultValue>
<Value>$(_Destination_IisServer_IisAppPoolName)</Value>
<Tags></Tags>
<Priority>$(VsIisAppParametersPriority)</Priority>
<ExcludeFromSetParameter>$(VsIisAppParametersPriority)</ExcludeFromSetParameter>
</MsDeployDeclareParameters>
</ItemGroup>
<CallTarget Condition="'$(AfterAddDeclareParametersItemsForIis7)' != ''"
Targets="$(AfterAddDeclareParametersItemsForIis7)"
RunEachTargetSeparately="false" />
</Target>
<!--********************************************************************-->
<!-- AddIis6ToSourceManifest -->
<!-- ********************************************************************-->
<PropertyGroup>
<BeforeAddIis6ToSourceManifest Condition="'$(BeforeAddIis6ToSourceManifest)'==''">
</BeforeAddIis6ToSourceManifest>
<AfterAddIis6ToSourceManifest Condition="'$(AfterAddIis6ToSourceManifest)'==''">
</AfterAddIis6ToSourceManifest>
<AddIis6ToSourceManifestDependsOn Condition="'$(AddIis6ToSourceManifestDependsOn)' == ''">
$(BeforeAddIis6ToSourceManifest);
PipelinePreDeployCopyAllFilesToOneFolder;
GenerateMsDeployManifestSettings;
</AddIis6ToSourceManifestDependsOn>
</PropertyGroup>
<Target Name="AddIis6ToSourceManifest"
Condition="$(_DeploymentUseIis) And ($(LocalIisVersion) &lt; '7') "
DependsOnTargets="$(AddIis6ToSourceManifestDependsOn)">
<!--Get Localized string before displaying error-->
<GetPublishingLocalizedString
Condition="'$(IisUrl)'==''"
ID="PublishLocalizedString_ErrorUseIisIsTrueButIisUrlIsEmpty"
LogType="Error" />
<!--<Error Condition="'$(IisUrl)'==''" Text="IisUrl property is required when UseIis property is True" />-->
<!--Write to Source Manifest file-->
<ItemGroup>
<MsDeploySourceManifest Include="MetaKey">
<Path>$(_MSDeployIisUrlSource_MetakeyPath)</Path>
</MsDeploySourceManifest>
</ItemGroup>
<CallTarget Condition="'$(AfterAddIis6ToSourceManifest)' != ''"
Targets="$(AfterAddIis6ToSourceManifest)"
RunEachTargetSeparately="False" />
</Target>
<!--********************************************************************-->
<!-- AddDeclareParametersItemsForIis6 -->
<!--We can remove this once Iis team make the package self contain-->
<!-- ********************************************************************-->
<PropertyGroup>
<BeforeAddDeclareParametersItemsForIis6 Condition="'$(BeforeAddDeclareParametersItemsForIis6)'==''">
</BeforeAddDeclareParametersItemsForIis6>
<AfterAddDeclareParametersItemsForIis6 Condition="'$(AfterAddDeclareParametersItemsForIis6)'==''">
</AfterAddDeclareParametersItemsForIis6>
<AddDeclareParametersItemsForIis6DependsOn Condition="'$(AddDeclareParametersItemsForIis6DependsOn)' == ''">
$(BeforeAddDeclareParametersItemsForIis6);
PipelinePreDeployCopyAllFilesToOneFolder;
GenerateMsDeployManifestSettings;
</AddDeclareParametersItemsForIis6DependsOn>
</PropertyGroup>
<Target Name="AddDeclareParametersItemsForIis6"
Condition="$(_DeploymentUseIis) And ($(LocalIisVersion) &lt; '7') "
DependsOnTargets="$(AddDeclareParametersItemsForIis6DependsOn)">
<!--Get Localized string before displaying error-->
<GetPublishingLocalizedString
Condition="'$(IisUrl)'==''"
ID="PublishLocalizedString_ErrorUseIisIsTrueButIisUrlIsEmpty"
LogType="Error" />
<!--<Error Condition="'$(IisUrl)'==''" Text="IisUrl property is required when UseIis property is True" />-->
<!--Parameterize the default value of the Path Note that IIS6 have to use the /lm/w3svc/1/xxxx-->
<!--
<EscapeTextForRegularExpressions Text="/$(_MSDeployIisUrlSource_MetakeyPathSearchPath)">
<Output TaskParameter="Result" PropertyName="_EscapeRegEx_MSDeployIisUrlSource_MetakeyPathSearchPath" />
</EscapeTextForRegularExpressions>
-->
<EscapeTextForRegularExpressions Text="$(_MSDeployIisUrlSource_MetakeyPath)">
<Output TaskParameter="Result" PropertyName="_EscapeRegEx_MSDeployIisUrlSource_MetakeyPathSearchPath" />
</EscapeTextForRegularExpressions>
<ItemGroup
Condition="!$(DisableAllVSGeneratedMSDeployParameter) And $(_DeploymentUseIis) And ($(LocalIisVersion) &lt; '7') ">
<MsDeployDeclareParameters Include="$(DeployParameterIISAppName)" >
<Kind>ProviderPath</Kind>
<Scope>MetaKey</Scope>
<Match>^$(_EscapeRegEx_MSDeployIisUrlSource_MetakeyPathSearchPath)$</Match>
<Description>$(DeployParameterIISAppNameDescription)</Description>
<DefaultValue>$(_MSDeployIisAppPathIIS6)</DefaultValue>
<Value>$(_MSDeployIisAppPathIIS6)</Value>
<Tags>IisApp</Tags>
<Priority>$(VsIisAppParametersPriority)</Priority>
</MsDeployDeclareParameters>
<MsDeployDeclareParameters Include="$(DeployParameterIISAppPoolName)"
Condition="'$(IisServer_IisAppPoolName)' != '' And '$(ParameterApplicationPool)' == 'True' And '$(IIS6ParameterApplicationPool)' == 'True'" >
<Kind>DeploymentObjectAttribute</Kind>
<Scope>metaProperty</Scope>
<Match>metaProperty[@name='AppPoolId' and @value='$(IisServer_IisAppPoolName)']/@value</Match>
<Description>$(DeployParameterIISAppPoolNameDescription)</Description>
<DefaultValue>$(_Destination_IisServer_IisAppPoolName)</DefaultValue>
<Value>$(_Destination_IisServer_IisAppPoolName)</Value>
<Tags></Tags>
<Priority>$(VsIisAppParametersPriority)</Priority>
<ExcludeFromSetParameter>$(VsIisAppParametersPriority)</ExcludeFromSetParameter>
</MsDeployDeclareParameters>
</ItemGroup>
<CallTarget Condition="'$(AfterAddDeclareParametersItemsForIis6)' != ''"
Targets="$(AfterAddDeclareParametersItemsForIis6)"
RunEachTargetSeparately="false" />
</Target>
<!--********************************************************************-->
<!-- AddIisSettingAndFileContentsToSourceManifest -->
<!-- ********************************************************************-->
<PropertyGroup>
<BeforeAddIisSettingAndFileContentsToSourceManifest Condition="'$(BeforeAddIisSettingAndFileContentsToSourceManifest)'==''">
</BeforeAddIisSettingAndFileContentsToSourceManifest>
<AfterAddIisSettingAndFileContentsToSourceManifest Condition="'$(AfterAddIisSettingAndFileContentsToSourceManifest)'==''">
</AfterAddIisSettingAndFileContentsToSourceManifest>
<AddIisSettingAndFileContentsToSourceManifestDependsOn Condition="'$(AddIisSettingAndFileContentsToSourceManifestDependsOn)' == ''">
$(BeforeAddIisSettingAndFileContentsToSourceManifest);
PipelinePreDeployCopyAllFilesToOneFolder;
GenerateMsDeployManifestSettings;
AddContentPathToSourceManifest;
</AddIisSettingAndFileContentsToSourceManifestDependsOn>
</PropertyGroup>
<Target Name="AddIisSettingAndFileContentsToSourceManifest"
DependsOnTargets="$(AddIisSettingAndFileContentsToSourceManifestDependsOn)">
<!--Create the Source Manifest file-->
<CallTarget Targets="$(AfterAddIisSettingAndFileContentsToSourceManifest)" RunEachTargetSeparately="false" Condition="'$(AfterAddIisSettingAndFileContentsToSourceManifest)' != ''" />
</Target>
<!--********************************************************************-->
<!-- AddContentPathToSourceManifest -->
<!-- ********************************************************************-->
<PropertyGroup>
<BeforeAddContentPathToSourceManifest Condition="'$(BeforeAddContentPathToSourceManifest)'==''">
</BeforeAddContentPathToSourceManifest>
<AfterAddContentPathToSourceManifest Condition="'$(AfterAddContentPathToSourceManifest)'==''">
</AfterAddContentPathToSourceManifest>
<AddContentPathToSourceManifestDependsOn Condition="'$(AddContentPathToSourceManifestDependsOn)' == ''">
$(BeforeAddContentPathToSourceManifest);
PipelinePreDeployCopyAllFilesToOneFolder;
GenerateMsDeployManifestSettings;
AddIis7ToSourceManifest;
AddIis6ToSourceManifest
</AddContentPathToSourceManifestDependsOn>
</PropertyGroup>
<Target Name="AddContentPathToSourceManifest"
DependsOnTargets="$(AddContentPathToSourceManifestDependsOn)">
<!--Create the Source Manifest file-->
<!--If user wants to deploy as IisApp which is "contentPath"+"mark folder as app on target server", we emit "IisApp";-->
<!--otherwise, we emit contentPath-->
<GetDeployManagedRuntimeVersion Condition="'$(DeployManagedRuntimeVersion)'=='' And $(_DeploymentAsIisApp) And !$(IgnoreDeployManagedRuntimeVersion)"
TargetFrameworkVersion="$(DeployDefaultTargetFrameworkVersion)">
<Output TaskParameter="Result" PropertyName="DeployManagedRuntimeVersion" />
<Output TaskParameter="Version" PropertyName="DeployManagedRuntimeVersionNumeric" />
</GetDeployManagedRuntimeVersion>
<PropertyGroup Condition="!$(IgnoreDeployManagedRuntimeVersion)">
<_DeployManagedRuntimeVersion Condition="'$(DeployManagedRuntimeVersionNumeric)' != '' And ($(DeployManagedRuntimeVersionNumeric) &gt;= '4.0') ">$(DeployManagedRuntimeVersion)</_DeployManagedRuntimeVersion>
<!--User explicit set the $(DeployManagedRuntimeVersion), we should honor it-->
<_DeployManagedRuntimeVersion Condition="'$(DeployManagedRuntimeVersionNumeric)' == '' And '$(DeployManagedRuntimeVersion)'!=''">$(DeployManagedRuntimeVersion)</_DeployManagedRuntimeVersion>
</PropertyGroup>
<ItemGroup>
<!-- For IIS App, below are default to the known value
<DeployManagedRuntimeVersion Condition="'$(DeployManagedRuntimeVersion)'==''">$(DeployDefaultTargetFrameworkVersion)</DeployManagedRuntimeVersion>
<DeployEnable32bitAppOnWin64 Condition="'$(DeployEnable32bitAppOnWin64)'==''"></DeployEnable32bitAppOnWin64>
<DeployManagedPipelineMode Condition="'$(DeployManagedPipelineMode)'==''"></DeployManagedPipelineMode>
-->
<MsDeploySourceManifest Condition="$(_DeploymentAsIisApp)"
Include="IisApp">
<Path>$(_MSDeployDirPath_FullPath)</Path>
<managedRuntimeVersion>$(_DeployManagedRuntimeVersion)</managedRuntimeVersion>
<enable32bitAppOnWin64>$(DeployEnable32bitAppOnWin64)</enable32bitAppOnWin64>
<managedPipelineMode>$(DeployManagedPipelineMode)</managedPipelineMode>
<AdditionalProviderSettings>managedRuntimeVersion;enable32bitAppOnWin64;managedPipelineMode</AdditionalProviderSettings>
</MsDeploySourceManifest>
<MsDeploySourceManifest Condition="!$(_DeploymentAsIisApp)"
Include="contentPath">
<Path>$(_MSDeployDirPath_FullPath)</Path>
</MsDeploySourceManifest>
<!--Make sure the by default Networkservice/AppPoolIdentity have read permissing to the fodler-->
<MsDeploySourceManifest Include="setAcl"
Condition="$(IncludeSetAclProviderOnDestination)">
<Path>$(_MSDeployDirPath_FullPath)</Path>
<setAclResourceType>Directory</setAclResourceType>
<AdditionalProviderSettings>setAclResourceType</AdditionalProviderSettings>
</MsDeploySourceManifest>
<!--Make sure the by default anonymousAuthenticationUser have read permissing to the fodler so MIME type files will work-->
<MsDeploySourceManifest Include="setAcl"
Condition="$(IncludeSetAclProviderOnDestination)">
<Path>$(_MSDeployDirPath_FullPath)</Path>
<setAclUser>anonymousAuthenticationUser</setAclUser>
<setAclResourceType>Directory</setAclResourceType>
<AdditionalProviderSettings>setAclUser;setAclResourceType</AdditionalProviderSettings>
</MsDeploySourceManifest>
<!--Additionally if App_Data Need to be ReadWrite-->
<MsDeploySourceManifest Include="setAcl"
Condition="$(IncludeSetAclProviderOnDestination) And $(MarkApp_DataWritableOnDestination) And Exists('$(_MSDeployDirPath_FullPath)\App_Data')">
<Path>$(_MSDeployDirPath_FullPath)\App_Data</Path>
<setAclAccess>Write</setAclAccess>
<setAclResourceType>Directory</setAclResourceType>
<AdditionalProviderSettings>setAclResourceType;setAclAccess</AdditionalProviderSettings>
</MsDeploySourceManifest>
</ItemGroup>
<CallTarget Targets="$(AfterAddContentPathToSourceManifest)" RunEachTargetSeparately="false" Condition="'$(AfterAddContentPathToSourceManifest)' != ''" />
</Target>
<!--********************************************************************-->
<!-- AddIisAndContentDeclareParametersItems -->
<!--We can remove this once Iis team make the package self contain-->
<!-- ********************************************************************-->
<PropertyGroup>
<BeforeAddIisAndContentDeclareParametersItems Condition="'$(BeforeAddIisAndContentDeclareParametersItems)'==''">
</BeforeAddIisAndContentDeclareParametersItems>
<AfterAddIisAndContentDeclareParametersItems Condition="'$(AfterAddIisAndContentDeclareParametersItems)'==''">
</AfterAddIisAndContentDeclareParametersItems>
<AddIisAndContentDeclareParametersItemsDependsOn Condition="'$(AddIisAndContentDeclareParametersItemsDependsOn)' == ''">
$(BeforeAddIisAndContentDeclareParametersItems);
PipelinePreDeployCopyAllFilesToOneFolder;
GenerateMsDeployManifestSettings;
AddDeclareParametersItemsForContentPath;
</AddIisAndContentDeclareParametersItemsDependsOn>
</PropertyGroup>
<Target Name="AddIisAndContentDeclareParametersItems"
DependsOnTargets="$(AddIisAndContentDeclareParametersItemsDependsOn)">
<CallTarget Targets="$(AfterAddIisAndContentDeclareParametersItems)" RunEachTargetSeparately="false" Condition="'$(AfterAddIisAndContentDeclareParametersItems)' != ''" />
</Target>
<!--********************************************************************-->
<!-- AddDeclareParametersItemsForContentPath -->
<!--We can remove this once Iis team make the package self contain-->
<!-- ********************************************************************-->
<PropertyGroup>
<BeforeAddDeclareParametersItemsForContentPath Condition="'$(BeforeAddDeclareParametersItemsForContentPath)'==''">
</BeforeAddDeclareParametersItemsForContentPath>
<AfterAddDeclareParametersItemsForContentPath Condition="'$(AfterAddDeclareParametersItemsForContentPath)'==''">
</AfterAddDeclareParametersItemsForContentPath>
<AddDeclareParametersItemsForContentPathDependsOn Condition="'$(AddDeclareParametersItemsForContentPathDependsOn)' == ''">
$(BeforeAddDeclareParametersItemsForContentPath);
PipelinePreDeployCopyAllFilesToOneFolder;
GenerateMsDeployManifestSettings;
AddDeclareParametersItemsForIis7;
AddDeclareParametersItemsForIis6;
</AddDeclareParametersItemsForContentPathDependsOn>
</PropertyGroup>
<Target Name="AddDeclareParametersItemsForContentPath"
DependsOnTargets="$(AddDeclareParametersItemsForContentPathDependsOn)">
<!--Write to Dest Manifest file-->
<PropertyGroup>
<!--default fall back to physical path-->
<_DestinationContentPath>$(_DestinationIisAppPhysicalPath)</_DestinationContentPath>
<!--For iis6 scenario-->
<_DestinationContentPath Condition="($(DestinationUseIis) or $(_DeploymentAsIisApp)) And ($(DestinationIisVersion) &lt; '7') And ('$(_MSDeployIisAppPathIIS6)'!= '') " >$(_MSDeployIisAppPathIIS6)</_DestinationContentPath>
<!--For iis7 and above scenario-->
<_DestinationContentPath Condition="($(DestinationUseIis) or $(_DeploymentAsIisApp)) And ($(DestinationIisVersion) &gt;= '7') And ('$(_MSDeployIisAppPathIIS7)' !='')">$(_MSDeployIisAppPathIIS7)</_DestinationContentPath>
<!--default ParameterName for contentPath, by default they are the same as ApphostConfig/MetaKey so they can reuse the parameter-->
<_MsDeployParameterNameForContentPath>$(DeployParameterIISAppName)</_MsDeployParameterNameForContentPath>
<_MsDeployParameterNameForContentPath Condition="$(_DeploymentUseIis) And (!$(DestinationUseIis))">$(DeployParameterIISAppPhysicalPath)</_MsDeployParameterNameForContentPath>
<_MsDeployParameterTagForContentPath>PhysicalPath</_MsDeployParameterTagForContentPath>
<_MsDeployParameterTagForContentPath Condition="$(_DeploymentAsIisApp)">IisApp</_MsDeployParameterTagForContentPath>
<_MsDeployParameterDefaultValueForContentPath>$(_DestinationContentPath)</_MsDeployParameterDefaultValueForContentPath>
<_MsDeployParameterExcludeSetParameterForContentPath>False</_MsDeployParameterExcludeSetParameterForContentPath>
<_MsDeployParameterPhysicalFolderForSetAcl>{$(_MsDeployParameterNameForContentPath)}</_MsDeployParameterPhysicalFolderForSetAcl>
<_MsDeployParameterPhysicalFolderAppDataForSetAcl>{$(_MsDeployParameterNameForContentPath)}/App_Data</_MsDeployParameterPhysicalFolderAppDataForSetAcl>
</PropertyGroup>
<!--Overwrite the property if it is a rootWebsite-->
<!--
<PropertyGroup Condition="$(_DeploymentUseIis) And $(DestinationUseIis) And $(_IsRootWebsite)">
<_MsDeployParameterNameForContentPath>$(DeployParameterIISAppPhysicalPath)</_MsDeployParameterNameForContentPath>
<_MsDeployParameterTagForContentPath>Hidden</_MsDeployParameterTagForContentPath>
<_MsDeployParameterDefaultValueForContentPath>{$(DeployParameterIISAppName)}</_MsDeployParameterDefaultValueForContentPath>
<_MsDeployParameterExcludeSetParameterForContentPath>True</_MsDeployParameterExcludeSetParameterForContentPath>
</PropertyGroup>
-->
<!--Get Localized string before displaying error-->
<GetPublishingLocalizedString
Condition="$(DestinationUseIis)
And ((($(DestinationIisVersion) &lt; '7') And ('$(_MSDeployIisAppPathIIS6)'== ''))
Or ( ($(DestinationIisVersion) &gt;= '7') And ('$(_MSDeployIisAppPathIIS7)' ==''))) "
ID="PublishLocalizedString_ErrorInvalidPropertyWhenSettingPropertyIsTrue"
ArgumentCount="2"
Arguments="DeployIisAppPath;DestinationUseIIS"
LogType="Error" />
<!--<Error Condition="$(DestinationUseIis)
And ((($(DestinationIisVersion) &lt; '7') And ('$(_MSDeployIisAppPathIIS6)'== ''))
Or ( ($(DestinationIisVersion) &gt;= '7') And ('$(_MSDeployIisAppPathIIS7)' ==''))) "
Text ="Invalid %24(DeployIisAppPath): When %24(DestinationUseIIS) is set True. It is required to have a valid %24(DeployIisAppPath) to be use for creating properly form destination manifest file." />-->
<!--If user wants to deploy as IisApp which is "contentPath"+"mark folder as app on target server", we emit "IisApp";-->
<!--otherwise, we emit contentPath-->
<!--Parameterize the default value of the Path-->
<EscapeTextForRegularExpressions Text="$(_MSDeployDirPath_FullPath)">
<Output TaskParameter="Result" PropertyName="_EscapeRegEx_MSDeployDirPath" />
</EscapeTextForRegularExpressions>
<ItemGroup
Condition="!$(DisableAllVSGeneratedMSDeployParameter) And '$(_DestinationContentPath)' != ''">
<MsDeployDeclareParameters Include="$(_MsDeployParameterNameForContentPath)"
Condition="$(_DeploymentAsIisApp)">
<Kind>ProviderPath</Kind>
<Scope>IisApp</Scope>
<Match>^$(_EscapeRegEx_MSDeployDirPath)$</Match>
<Description>$(DeployParameterIISAppNameDescription)</Description>
<DefaultValue>$(_MsDeployParameterDefaultValueForContentPath)</DefaultValue>
<Value>$(_DestinationContentPath)</Value>
<Tags>$(_MsDeployParameterTagForContentPath)</Tags>
<Priority>$(VsIisAppParametersPriority)</Priority>
<ExcludeFromSetParameter>$(_MsDeployParameterExcludeSetParameterForContentPath)</ExcludeFromSetParameter>
</MsDeployDeclareParameters>
<MsDeployDeclareParameters Include="$(_MsDeployParameterNameForContentPath)"
Condition="!$(_DeploymentAsIisApp)">
<Kind>ProviderPath</Kind>
<Scope>contentPath</Scope>
<Match>^$(_EscapeRegEx_MSDeployDirPath)$</Match>
<Description>$(DeployParameterIISAppPhysicalPathDescription)</Description>
<DefaultValue>$(_MsDeployParameterDefaultValueForContentPath)</DefaultValue>
<Value>$(_DestinationContentPath)</Value>
<Tags>$(_MsDeployParameterTagForContentPath)</Tags>
<Priority>$(VsContentPathParametersPriority)</Priority>
<ExcludeFromSetParameter>$(_MsDeployParameterExcludeSetParameterForContentPath)</ExcludeFromSetParameter>
</MsDeployDeclareParameters>
</ItemGroup>
<!--SetAcl Provider-->
<ItemGroup Condition="!$(DisableAllVSGeneratedMSDeployParameter) and '$(_DestinationContentPath)' != '' and $(IncludeSetAclProviderOnDestination)" >
<MsDeployDeclareParameters Include="$(_MsDeployParameterNameForContentPath)">
<Kind>ProviderPath</Kind>
<Scope>setAcl</Scope>
<Match>^$(_EscapeRegEx_MSDeployDirPath)$</Match>
<Description>$(DeployParameterIISAppPhysicalPathDescription)</Description>
<DefaultValue>$(_MsDeployParameterDefaultValueForContentPath)</DefaultValue>
<Value>$(_DestinationContentPath)</Value>
<Tags></Tags>
<ExcludeFromSetParameter>$(_MsDeployParameterExcludeSetParameterForContentPath)</ExcludeFromSetParameter>
<Priority>$(VsSetAclPriority)</Priority>
</MsDeployDeclareParameters>
<!--Optinally mark write permission for the AppData Folder-->
<MsDeployDeclareParameters Include="$(DeployParameterApp_DataWritePermission)"
Condition="$(MarkApp_DataWritableOnDestination) and Exists('$(_MSDeployDirPath_FullPath)\App_Data')">
<Kind>ProviderPath</Kind>
<Scope>setAcl</Scope>
<Match>^$(_EscapeRegEx_MSDeployDirPath)\\App_Data$</Match>
<Description>Add write permission to App_Data folder</Description>
<DefaultValue>{$(_MsDeployParameterNameForContentPath)}/App_Data</DefaultValue>
<Value>$(_DestinationContentPath)/App_Data</Value>
<Tags>Hidden</Tags>
<Priority>$(VsSetAclPriority)</Priority>
<ExcludeFromSetParameter>True</ExcludeFromSetParameter>
</MsDeployDeclareParameters>
</ItemGroup>
<!--We need this value to generate skip rule to skip App_Data folder-->
<CreateProperty Value="$(_DestinationContentPath)">
<Output TaskParameter="Value" PropertyName="DestinationAppRoot"/>
</CreateProperty>
<CallTarget Targets="$(AfterAddDeclareParametersItemsForContentPath)" RunEachTargetSeparately="false" Condition="'$(AfterAddDeclareParametersItemsForContentPath)' != ''" />
</Target>
<!--********************************************************************-->
<!-- CollectDatabasesToPublish -->
<!--********************************************************************-->
<PropertyGroup>
<PublishDatabases Condition="'$(PublishDatabases)'==''">True</PublishDatabases>
<CollectDatabasesToPublishDependsOn>
</CollectDatabasesToPublishDependsOn>
</PropertyGroup>
<Target Name="CollectDatabasesToPublish" DependsOnTargets="$(CollectDatabasesToPublishDependsOn)" Condition="$(PublishDatabases)">
<MakeDir Directories="$(DatabaseDeployIntermediateOutputPath)" Condition="!Exists($(DatabaseDeployIntermediateOutputPath))" />
<CreateProviderList ProvidersXml="$(PublishDatabaseSettings)"
IntermediateOutputPath="$(DatabaseDeployIntermediateOutputPath)"
MSDeployVersionsToTry="$(_MSDeployVersionsToTry)"
Condition="'$(PublishDatabaseSettings)' != ''">
<Output TaskParameter="List" ItemName="_DatabasesToPackage" />
<Output TaskParameter="SourceManifest" ItemName="_DatabasesToSourceManifest" />
</CreateProviderList>
<CreateProviderList ProvidersFile="$(PublishDatabaseSettingsFile)"
IntermediateOutputPath="$(DatabaseDeployIntermediateOutputPath)"
MSDeployVersionsToTry="$(_MSDeployVersionsToTry)"
Condition="'$(PublishDatabaseSettingsFile)' != ''">
<Output TaskParameter="List" ItemName="_DatabasesToPackage" />
<Output TaskParameter="SourceManifest" ItemName="_DatabasesToSourceManifest" />
</CreateProviderList>
<!-- 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.)
We should avoid process if we have any knowledge on the sql file-->
<SqlScriptPreprocessSqlVariables
UnsupportedKeywords="$(MsdeploySqlUnsupportedCommand)"
CheckForUnsupportCommands="$(CheckSqlScriptForUnsupportedCommands)"
TreadSqlScriptUnsupportedCommandsAsWarning="$(TreadSqlScriptUnsupportedCommandsAsWarning)"
SqlScriptFile="%(_DatabasesToPackage.SourcePath)"
DestinationGroup="%(_DatabasesToPackage.DestinationGroup)"
ResolveIncludes="$(SqlScriptPreProcessResolveIncludes)"
BatchDelimiter="$(SqlScriptPreProcessBatchDelimiter)"
Condition="$(EnableSqlScriptVariableParameterize) and Exists('%(_DatabasesToPackage.SourcePath)')">
<Output TaskParameter="List" ItemName="_DatabasesToPackage_SqlVariables" />
</SqlScriptPreprocessSqlVariables>
<!--Log the information Set $(EnablePackageProcessLoggingAndAssert) to True if you want to see this information-->
<MakeDir Condition="$(EnableSqlScriptVariableParameterize) And $(EnablePackageProcessLoggingAndAssert) And !Exists('$(PackageLogDir)')"
Directories="$(PackageLogDir)" />
<!-- (Debug Only, Turn on EnablePackageProcessLoggingAndAssert if needed )
Dump the list to the log file in the log dir-->
<WriteLinesToFile Condition="$(EnablePackageProcessLoggingAndAssert) and $(EnableSqlScriptVariableParameterize)"
Encoding="utf-8"
File="$(PackageLogDir)\SqlVariables.txt"
Lines="@(_DatabasesToPackage_SqlVariables->'
Name:%(Identity)
Vaule:%(Value)
IsDeclared:%(IsDeclared)
SourcePath=%(SourcePath)
SourcePath_RegExExcaped=%(SourcePath_RegExExcaped)
DestinationGroup=%(DestinationGroup)')" Overwrite="True" />
</Target>
<!--********************************************************************-->
<!-- AddDatabasesToSourceManifest -->
<!--********************************************************************-->
<PropertyGroup>
<BeforeAddDatabasesToSourceManifest Condition="'$(BeforeAddDatabasesToSourceManifest)'==''">
</BeforeAddDatabasesToSourceManifest>
<AfterAddDatabasesToSourceManifest Condition="'$(AfterAddDatabasesToSourceManifest)'==''">
</AfterAddDatabasesToSourceManifest>
<AddDatabasesToSourceManifestDependsOn>
$(BeforeAddDatabasesToSourceManifest);
CollectDatabasesToPublish;
</AddDatabasesToSourceManifestDependsOn>
</PropertyGroup>
<Target Name="AddDatabasesToSourceManifest"
DependsOnTargets="$(AddDatabasesToSourceManifestDependsOn)">
<ItemGroup>
<MsDeploySourceManifest Include="@(_DatabasesToSourceManifest)" />
</ItemGroup>
<CallTarget Targets="$(AfterAddDatabasesToSourceManifest)" RunEachTargetSeparately="false" Condition="'$(AfterAddDatabasesToSourceManifest)' != ''" />
</Target>
<!--********************************************************************-->
<!-- AddDeclareParametersItemsForDatabaseScript -->
<!--********************************************************************-->
<PropertyGroup>
<BeforeAddDeclareParametersItemsForDatabaseScript Condition="'$(BeforeAddDeclareParametersItemsForDatabaseScript)'==''">
</BeforeAddDeclareParametersItemsForDatabaseScript>
<AfterAddDeclareParametersItemsForDatabaseScript Condition="'$(AfterAddDeclareParametersItemsForDatabaseScript)'==''">
</AfterAddDeclareParametersItemsForDatabaseScript>
<AddDeclareParametersItemsForDatabaseScriptDependsOn>
$(BeforeAddDeclareParametersItemsForDatabaseScript);
CollectDatabasesToPublish;
</AddDeclareParametersItemsForDatabaseScriptDependsOn>
</PropertyGroup>
<Target Name="AddDeclareParametersItemsForDatabaseScript"
DependsOnTargets="$(AddDeclareParametersItemsForDatabaseScriptDependsOn)">
<!--Get localized $(DeployParameterSqlScriptVariablesDescription) from the Task.dll if it wasn't bee set by user.-->
<GetPublishingLocalizedString
Condition="'$(DeployParameterSqlScriptVariablesDescription)'==''"
ID="PublishLocalizedString_SqlCommandVariableParameterDescription">
<Output TaskParameter="Result" PropertyName="DeployParameterSqlScriptVariablesDescription" />
</GetPublishingLocalizedString>
<!--Get localized $(DeployParameterIISAppConnectionStringDescription) from the Task.dll if it wasn't bee set by user.-->
<GetPublishingLocalizedString
Condition="'$(DeployParameterIISAppConnectionStringDescription)'=='' And !$(DeployParameterAutoDescriptionbyTags)"
ID="PublishLocalizedString_DatabaseConnectionStringParameterDescription">
<Output TaskParameter="Result" PropertyName="DeployParameterIISAppConnectionStringDescription" />
</GetPublishingLocalizedString>
<!--if $(DeployParameterAutoDescriptionbyTags), we turn off the description.-->
<DeployParameterIISAppConnectionStringDescription Condition="'$(DeployParameterIISAppConnectionStringDescription)'!='' And $(DeployParameterAutoDescriptionbyTags)"></DeployParameterIISAppConnectionStringDescription>
<ItemGroup Condition="!$(DisableAllVSGeneratedMSDeployParameter)">
<_VsPublish_DatabaseToPackage_DeclareParameters Include="@(_DatabasesToPackage->'$(DeployParameterPrefix)%(DestinationGroup) Connection String')">
<Kind>ProviderPath</Kind>
<Scope>%(_DatabasesToPackage.SourceProvider)</Scope>
<Match>^%(_DatabasesToPackage.SourcePath_RegExExcaped)$</Match>
<Description>$(DeployParameterIISAppConnectionStringDescription)</Description>
<DefaultValue>%(_DatabasesToPackage.DestinationPath)</DefaultValue>
<Value>%(_DatabasesToPackage.DestinationPath)</Value>
<Tags>$(MsDeployDatabaseTag)</Tags>
</_VsPublish_DatabaseToPackage_DeclareParameters>
<_VsPublish_DatabaseToPackage_DeclareParameters Include="@(_DatabasesToPackage_SqlVariables->'$(DeployParameterPrefix)Sql script variable %24(%(Identity)) in %(DestinationGroup) scripts')"
Condition="$(EnableSqlScriptVariableParameterize)">
<Kind>$(MsDeploySqlCommandVariableKind)</Kind>
<Scope>^%(_DatabasesToPackage_SqlVariables.SourcePath_RegExExcaped)$</Scope>
<Match>%(_DatabasesToPackage_SqlVariables.Identity)</Match>
<Description>$(DeployParameterSqlScriptVariablesDescription)</Description>
<DefaultValue>%(_DatabasesToPackage_SqlVariables.Value)</DefaultValue>
<Value>%(_DatabasesToPackage_SqlVariables.Value)</Value>
<Tags>sql</Tags>
</_VsPublish_DatabaseToPackage_DeclareParameters>
<!--Work around the TSData script when there are Sqlcommand variable that declare as Empty string-->
<_VsPublish_DatabaseToPackage_DeclareParameters Include="@(_DatabasesToPackage_SqlVariables->'$(DeployParameterPrefix)Sql script variable %24(%(Identity)) in %(DestinationGroup) scripts')"
Condition="$(EnableSqlScriptVariableParameterize) and ('%(_DatabasesToPackage_SqlVariables.Value)' == '') and ('%(_DatabasesToPackage_SqlVariables.IsDeclared)' == 'true')">
<Element>parameterValidation</Element>
<Kind>AllowEmpty</Kind>
</_VsPublish_DatabaseToPackage_DeclareParameters>
<MsDeployDeclareParameters Include="@(_VsPublish_DatabaseToPackage_DeclareParameters)">
<Priority>$(VsSQLDatabaseScriptParametersPriority)</Priority>
</MsDeployDeclareParameters>
</ItemGroup>
<CallTarget Targets="$(AfterAddDeclareParametersItemsForDatabaseScript)" RunEachTargetSeparately="false" Condition="'$(AfterAddDeclareParametersItemsForDatabaseScript)' != ''" />
</Target>
<!--********************************************************************-->
<!-- WriteItemsToSourceManifest -->
<!-- ********************************************************************-->
<PropertyGroup>
<BeforeWriteItemsToSourceManifest Condition="'$(BeforeWriteItemsToSourceManifest)'==''">
</BeforeWriteItemsToSourceManifest>
<AfterWriteItemsToSourceManifest Condition="'$(AfterWriteItemsToSourceManifest)'==''">
</AfterWriteItemsToSourceManifest>
<WriteItemsToSourceManifestDependsOn Condition="'$(WriteItemsToSourceManifestDependsOn)' == ''">
$(BeforeWriteItemsToSourceManifest);
AddIisSettingAndFileContentsToSourceManifest;
AddDatabasesToSourceManifest;
</WriteItemsToSourceManifestDependsOn>
</PropertyGroup>
<Target Name="WriteItemsToSourceManifest"
DependsOnTargets="$(WriteItemsToSourceManifestDependsOn)">
<ExportManifestFile Manifests="@(MsDeploySourceManifest)" ManifestFile="$(PackageSourceManifest)" />
<CallTarget Targets="$(AfterWriteItemsToSourceManifest)" RunEachTargetSeparately="false" Condition="'$(AfterWriteItemsToSourceManifest)' != ''" />
</Target>
<!--********************************************************************-->
<!-- AddDeclareParametersItems -->
<!--We can remove this once Iis team make the package self contain-->
<!-- ********************************************************************-->
<PropertyGroup>
<BeforeAddDeclareParametersItems Condition="'$(BeforeAddDeclareParametersItems)'==''">
</BeforeAddDeclareParametersItems>
<AfterAddDeclareParametersItems Condition="'$(AfterAddDeclareParametersItems)'==''">
</AfterAddDeclareParametersItems>
<AddDeclareParametersItemsDependsOn Condition="'$(AddDeclareParametersItemsDependsOn)' == ''">
$(BeforeAddDeclareParametersItems);
AddIisAndContentDeclareParametersItems;
AddDeclareParametersItemsForDatabaseScript;
</AddDeclareParametersItemsDependsOn>
</PropertyGroup>
<Target Name="AddDeclareParametersItems"
DependsOnTargets="$(AddDeclareParametersItemsDependsOn)">
<PropertyGroup>
<_PublishDefaultVDirectoryPath>$(RemoteSitePhysicalPath)</_PublishDefaultVDirectoryPath>
<_PublishDefaultVDirectoryPath Condition="'$(_PublishDefaultVDirectoryPath)'==''">$(_DestinationIisAppPhysicalPath)</_PublishDefaultVDirectoryPath>
</PropertyGroup>
<!--Create Virtual Directory Parameter if needed-->
<!--Get Localized string before displaying error-->
<GetPublishingLocalizedString
Condition="'$(_DestinationIisAppPhysicalPath)' == '' And $(_DeploymentUseIis)"
ID="PublishLocalizedString_ErrorInvalidPropertyWhenSettingPropertyIsTrue"
ArgumentCount="2"
Arguments="_DestinationIisAppPhysicalPath;_DeploymentUseIis"
LogType="Error" />
<!--<Error Text="%24(_DestinationIisAppPhysicalPath) can't be empty. It will cause the Package to be invalid"
Condition="'$(_DestinationIisAppPhysicalPath)' == '' And $(_DeploymentUseIis)" />-->
<ItemGroup>
<_MSBuildReplaceRuleItemMSBuildProjectDirectory Include="$(WebPublishPipelineProjectDirectory)" />
</ItemGroup>
<EscapeTextForRegularExpressions Text="@(_MSBuildReplaceRuleItemMSBuildProjectDirectory->'%(FullPath)')">
<Output TaskParameter="Result" PropertyName="_EscapeRegExMSBuildProjectDirectory" />
</EscapeTextForRegularExpressions>
<ItemGroup>
<MsDeployDeclareParameters Include="$(DeployParameterPrefix)IisVirtualDirectoryPhysicalPath"
Condition="!$(DisableAllVSGeneratedMSDeployParameter) And $(_DeploymentUseIis)" >
<Kind>DestinationVirtualDirectory</Kind>
<Scope>.*</Scope>
<Match>^$(_EscapeRegExMSBuildProjectDirectory)$</Match>
<Description>$(DeployParameterIISAppPhysicalPathDescription)</Description>
<DefaultValue>$(_DestinationIisAppPhysicalPath)</DefaultValue>
<!--Value is used in the SetParameters when directly publish-->
<Value>$(_PublishDefaultVDirectoryPath)</Value>
<Tags>PhysicalPath</Tags>
<Priority>$(VsDestinationVDirParametersPriority)</Priority>
</MsDeployDeclareParameters>
</ItemGroup>
<CallTarget Targets="$(AfterAddDeclareParametersItems)" RunEachTargetSeparately="false" Condition="'$(AfterAddDeclareParametersItems)' != ''" />
</Target>
<!--********************************************************************-->
<!-- GenerateMsDeployManifestSettings -->
<!-- ********************************************************************-->
<PropertyGroup>
<GenerateMsDeployManifestSettingsDependsOn Condition="'$(GenerateMsDeployManifestSettingsDependsOn)'==''">
</GenerateMsDeployManifestSettingsDependsOn>
</PropertyGroup>
<Target Name="GenerateMsDeployManifestSettings" DependsOnTargets="$(GenerateMsDeployManifestSettingsDependsOn)">
<!--we can only set this property after we get the existing IisUrl-->
<ItemGroup>
<_MSDeployDirPath Include="$(_PackageTempDir)" />
</ItemGroup>
<!--Get localized $(DeployParameterIISAppNameDescription) from the Task.dll if it wasn't bee set by user.-->
<GetPublishingLocalizedString
Condition="'$(DeployParameterIISAppNameDescription)'=='' And !$(DeployParameterAutoDescriptionbyTags)"
ID="PublishLocalizedString_IISAppParameterDescription">
<Output TaskParameter="Result" PropertyName="DeployParameterIISAppNameDescription" />
</GetPublishingLocalizedString>
<!--if $(DeployParameterAutoDescriptionbyTags), we turn off the description.-->
<DeployParameterIISAppNameDescription Condition="'$(DeployParameterIISAppNameDescription)'!='' And $(DeployParameterAutoDescriptionbyTags)"></DeployParameterIISAppNameDescription>
<!--Get localized $(DeployParameterIISAppPhysicalPathDescription) from the Task.dll if it wasn't bee set by user.-->
<GetPublishingLocalizedString
Condition="'$(DeployParameterIISAppPhysicalPathDescription)'=='' And !$(DeployParameterAutoDescriptionbyTags)"
ID="PublishLocalizedString_IISAppPhysicalPathDescription">
<Output TaskParameter="Result" PropertyName="DeployParameterIISAppPhysicalPathDescription" />
</GetPublishingLocalizedString>
<!--if $(DeployParameterAutoDescriptionbyTags), we turn off the description.-->
<DeployParameterIISAppPhysicalPathDescription Condition="'$(DeployParameterIISAppPhysicalPathDescription)'!='' And $(DeployParameterAutoDescriptionbyTags)"></DeployParameterIISAppPhysicalPathDescription>
<PropertyGroup>
<_MSDeployDirPath_FullPath>@(_MSDeployDirPath->'%(FullPath)')</_MSDeployDirPath_FullPath>
<_MSDeployIisAppPathIIS7>$(DeployIisAppPath)</_MSDeployIisAppPathIIS7>
<_MSDeployIisAppPathIIS6>$(DeployIisAppPath)</_MSDeployIisAppPathIIS6>
<_MSDeployIisAppPathIIS7 Condition="'$(_MSDeployIisAppPathIIS7)'==''">$(DefaultDeployIisAppPath)</_MSDeployIisAppPathIIS7>
<_MSDeployIisAppPathIIS6 Condition="'$(_MSDeployIisAppPathIIS6)'==''">$(DefaultDeployIisAppPath)</_MSDeployIisAppPathIIS6>
</PropertyGroup>
<ItemGroup>
<_MSDeploySourceManifest Include="$(PackageSourceManifest)" />
<_MSDeployParametersFile Include="$(PackageParametersFile)" />
<_MSDeploySampleParametersValue Condition="$(GenerateSampleDeployScript)" Include="$(GenerateSampleParametersValueLocation)" />
<_MSDeployGenerateSampleDeployScriptReadMeLocation Condition="$(GenerateSampleDeployScript)" Include="$(GenerateSampleDeployScriptReadMeLocation)" />
</ItemGroup>
</Target>
<!--********************************************************************-->
<!-- CleanWebsitesPackageCore -->
<!-- ********************************************************************-->
<PropertyGroup>
<CleanWebsitesPackageCoreDependsOn Condition="'$(CleanWebsitesPackageCoreDependsOn)' == ''">
GenerateMsDeployManifestSettings;
</CleanWebsitesPackageCoreDependsOn>
</PropertyGroup>
<Target Name="CleanWebsitesPackageCore" DependsOnTargets="$(CleanWebsitesPackageCoreDependsOn)">
<!--Assertion check-->
<CheckItemsCount Items="@(_MSDeployPackageLocation)" Condition="$(EnablePackageProcessLoggingAndAssert)">
<Output TaskParameter="Count" PropertyName="_InternalItemsCount" />
</CheckItemsCount>
<!--Get Localized string before displaying error-->
<GetPublishingLocalizedString
Condition="$(EnablePackageProcessLoggingAndAssert) AND '$(_InternalItemsCount)' != '1'"
ID="PublishLocalizedString_ErrorInvalidMSBuildItemCollectionCount"
ArgumentCount="3"
Arguments="_MSDeployPackageLocation;$(_InternalItemsCount);1"
LogType="Error" />
<!--<Error Text="@(_MSDeployPackageLocation) should only contain one item"
Condition="$(EnablePackageProcessLoggingAndAssert) AND '$(_InternalItemsCount)' != '1'" />-->
<CheckPathAttributes Path="@(_MSDeployPackageLocation->'%(Identity)')">
<Output TaskParameter="IsExists" PropertyName="_CheckPackageLocationExists" />
<Output TaskParameter="IsFolder" PropertyName="_CheckPackageLocationIsFolder" />
</CheckPathAttributes>
<RemoveDir Directories="@(_MSDeployPackageLocation)"
Condition="$(_CheckPackageLocationExists) AND $(_CheckPackageLocationIsFolder)"
ContinueOnError="True"/>
<Delete Files="@(_MSDeployPackageLocation)"
Condition="$(_CheckPackageLocationExists) AND !$(_CheckPackageLocationIsFolder)"
TreatErrorsAsWarnings="True" />
</Target>
<!--********************************************************************-->
<!-- CleanWebsitesPackage -->
<!-- ********************************************************************-->
<PropertyGroup>
<CleanWebsitesPackageDependsOn Condition="'$(CleanWebsitesPackageDependsOn)' == ''">
GenerateMsDeployManifestSettings;
CleanWebsitesPackageCore;
</CleanWebsitesPackageDependsOn>
</PropertyGroup>
<Target Name="CleanWebsitesPackage" DependsOnTargets="$(CleanWebsitesPackageDependsOn)">
<!--<RemoveDir Condition="Exists($(PackageLogDir))" Directories="$(PackageLogDir)" ContinueOnError="true" />-->
<Delete Files="$(PackageSourceManifest)" Condition="Exists('$(PackageSourceManifest)')" TreatErrorsAsWarnings="True" />
<Delete Files="$(PublishParametersFile)" Condition="Exists('$(PublishParametersFile)')" TreatErrorsAsWarnings="True" />
<Delete Files="$(GenerateSampleDeployScriptLocation)" Condition="Exists('$(GenerateSampleDeployScriptLocation)')" TreatErrorsAsWarnings="True" />
<Delete Files="$(GenerateSampleDeployScriptReadMeLocation)" Condition="Exists('$(GenerateSampleDeployScriptReadMeLocation)')" TreatErrorsAsWarnings="True" />
<Delete Files="$(GenerateSampleParametersValueLocation)" Condition="Exists('$(GenerateSampleParametersValueLocation)')" TreatErrorsAsWarnings="True" />
<Delete Files="$(GenerateSampleParametersValueLocation)" Condition="Exists('$(GenerateSampleParametersValueLocation)')" TreatErrorsAsWarnings="True" />
</Target>
<!--********************************************************************-->
<!-- CleanWebsitesPackageTempDir -->
<!-- ********************************************************************-->
<PropertyGroup>
<CleanWebsitesPackageTempDirDependsOn Condition="'$(CleanWebsitesPackageTempDirDependsOn)' == ''">
</CleanWebsitesPackageTempDirDependsOn>
</PropertyGroup>
<Target Name="CleanWebsitesPackageTempDir" DependsOnTargets="$(CleanWebsitesPackageTempDirDependsOn)">
<!--Assertion check-->
<!--In the case of Clean Packaging/Publish, we simply delete the PackageTempDir-->
<RemoveDir Condition="Exists($(_PackageTempDir))" Directories="$(_PackageTempDir)" ContinueOnError="true" />
</Target>
<!--********************************************************************-->
<!-- CleanWebsitesTransformParametersFiles -->
<!-- ********************************************************************-->
<PropertyGroup>
<CleanWebsitesTransformParametersFilesDependsOn Condition="'$(CleanWebsitesTransformParametersFilesDependsOn)' == ''">
</CleanWebsitesTransformParametersFilesDependsOn>
</PropertyGroup>
<Target Name="CleanWebsitesTransformParametersFiles" DependsOnTargets="$(CleanWebsitesTransformParametersFilesDependsOn)">
<RemoveDir Condition="Exists($(AutoParameterizationWebConfigConnectionStringsLocation))" Directories="$(AutoParameterizationWebConfigConnectionStringsLocation)" ContinueOnError="true" />
<RemoveDir Condition="Exists($(TransformWebConfigIntermediateLocation))" Directories="$(TransformWebConfigIntermediateLocation)" ContinueOnError="true" />
<RemoveDir Condition="Exists($(DatabaseDeployIntermediateOutputPath))" Directories="$(DatabaseDeployIntermediateOutputPath)" ContinueOnError="true" />
<Delete Condition="Exists($(_WebConfigTransformOutputParametersFile))" Files="$(_WebConfigTransformOutputParametersFile)" TreatErrorsAsWarnings="true" />
<Delete Condition="Exists($(_WebConfigsToAutoParmeterizeCsTransformOutputParametersFile))" Files="$(_WebConfigsToAutoParmeterizeCsTransformOutputParametersFile)" TreatErrorsAsWarnings="true" />
</Target>
<!--********************************************************************-->
<!-- CheckAndCleanMSDeployPackageIfNeeded -->
<!-- ********************************************************************-->
<PropertyGroup>
<CheckAndCleanMSDeployPackageIfNeededDependsOn Condition="'$(CheckAndCleanMSDeployPackageIfNeededDependsOn)'==''">
GenerateMsDeployManifestSettings;
</CheckAndCleanMSDeployPackageIfNeededDependsOn>
</PropertyGroup>
<Target Name="CheckAndCleanMSDeployPackageIfNeeded" >
<IsCleanMSDeployPackageNeeded
MSDeployVersionsToTry="$(_MSDeployVersionsToTry)"
PackageLocation="@(_MSDeployPackageLocation->'%(FullPath)')"
PackageAsSingleFile="$(PackageAsSingleFile)"
CurrentSourceManifestPath="@(_MSDeploySourceManifest->'%(FullPath)')" >
<Output TaskParameter="Result"
PropertyName="_IsCleanMSDeployPackageNeeded" />
</IsCleanMSDeployPackageNeeded>
<!--<PropertyGroup>
<_IsCleanMSDeployPackageNeeded>False</_IsCleanMSDeployPackageNeeded>
</PropertyGroup>-->
<!--Only delete the Zip file-->
<CallTarget Condition="$(_IsCleanMSDeployPackageNeeded)"
Targets="CleanWebsitesPackageCore"
RunEachTargetSeparately="false" />
</Target>
<!--********************************************************************-->
<!-- GenerateMsdeployManifestFiles -->
<!-- ********************************************************************-->
<PropertyGroup>
<OnBeforeGenerateMsdeployManifestFiles Condition="'$(OnBeforeGenerateMsdeployManifestFiles)' == ''">
</OnBeforeGenerateMsdeployManifestFiles>
<OnAfterGenerateMsdeployManifestFiles Condition="'$(OnAfterGenerateMsdeployManifestFiles)' == ''">
AddDeclareParametersItems;
CheckAndCleanMSDeployPackageIfNeeded;
</OnAfterGenerateMsdeployManifestFiles>
<GenerateMsdeployManifestFilesDependsOn Condition="'$(GenerateMsdeployManifestFilesDependsOn)' == ''">
PipelinePreDeployCopyAllFilesToOneFolder;
GenerateMsDeployManifestSettings;
</GenerateMsdeployManifestFilesDependsOn>
</PropertyGroup>
<Target Name="GenerateMsdeployManifestFiles" DependsOnTargets="$(GenerateMsdeployManifestFilesDependsOn)">
<!--Get Localized string before displaying message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_GenerateMsdeploySourceManifestFile"
LogType="Message" />
<!--<Message Text="Generate manifest files for packaging ..." />-->
<MakeDir Directories="@(_MSDeploySourceManifest->'%(RootDir)%(Directory)')" Condition="!Exists(@(_MSDeploySourceManifest->'%(RootDir)%(Directory)'))"/>
<MakeDir Directories="@(_MSDeployParametersFile->'%(RootDir)%(Directory)')" Condition="!Exists(@(_MSDeployParametersFile->'%(RootDir)%(Directory)'))"/>
<!--================================================-->
<!--Create the Source Manifest filePath list-->
<!--================================================-->
<CallTarget Targets="WriteItemsToSourceManifest" RunEachTargetSeparately="false" />
<CallTarget Targets="$(OnAfterGenerateMsdeployManifestFiles)" RunEachTargetSeparately="false" />
</Target>
<!--================================================-->
<!--Create skip rules used in sample script generation as well as publish-->
<!--================================================-->
<Target Name="GenerateSkipRuleForAppData" Condition="$(SkipApp_DataFolder)">
<EscapeTextForRegularExpressions Text="$(_PackageTempDir)">
<Output TaskParameter="Result" PropertyName="_Escaped_PackageTempDir" />
</EscapeTextForRegularExpressions>
<ItemGroup>
<MsDeploySkipRules Include="SkipAddDataOnDeploy">
<SkipAction></SkipAction>
<ObjectName>dirPath</ObjectName>
<AbsolutePath>$(_Escaped_PackageTempDir)\\App_Data$</AbsolutePath>
<XPath></XPath>
</MsDeploySkipRules>
</ItemGroup>
</Target>
<!--********************************************************************-->
<!-- PackageUsingManifest Manifest -->
<!-- ********************************************************************-->
<PropertyGroup>
<OnBeforePackageUsingManifest Condition="'$(OnBeforePackageUsingManifest)' == ''">
</OnBeforePackageUsingManifest>
<OnAfterPackageUsingManifest Condition="'$(OnAfterPackageUsingManifest)' == ''">
GenerateSampleDeployScript;
</OnAfterPackageUsingManifest>
<PackageUsingManifestDependsOn Condition="'$(PackageUsingManifestDependsOn)' == ''">
$(OnBeforePackageUsingManifest);
GenerateMsDeployManifestSettings;
GenerateMsdeployManifestFiles;
GenerateSkipRuleForAppData;
</PackageUsingManifestDependsOn>
</PropertyGroup>
<Target Name="PackageUsingManifest" DependsOnTargets="$(PackageUsingManifestDependsOn)">
<PropertyGroup>
<!--Always package from a manifest-->
<PackageSourceType>manifest</PackageSourceType>
<PackageSourceRoot>@(_MSDeploySourceManifest->'%(FullPath)')</PackageSourceRoot>
<!--target is either a single file or archive dir-->
<PackageDestinationType>archiveDir</PackageDestinationType>
<PackageDestinationRoot>@(_MSDeployArchiveDir->'%(FullPath)')</PackageDestinationRoot>
<PackageDestinationType Condition="$(PackageAsSingleFile)">package</PackageDestinationType>
<PackageDestinationRoot Condition="$(PackageAsSingleFile)">@(_MSDeployPackageFile->'%(FullPath)')</PackageDestinationRoot>
<PackageResult>True</PackageResult>
</PropertyGroup>
<!--Get Localized string before displaying message-->
<GetPublishingLocalizedString
Importance="High"
ID="PublishLocalizedString_PackagingIntoLocation"
ArgumentCount="1"
Arguments="$(PackageDestinationRoot)"
LogType="Message" />
<!--<Message Importance="high" Text="Packaging into $(PackageDestinationRoot)" />-->
<ItemGroup>
<MsDeploySourceProviderSetting Remove="@(MsDeploySourceProviderSetting)" />
<MsDeploySourceProviderSetting Include="$(PackageSourceType)">
<Path>$(PackageSourceRoot)</Path>
<EncryptPassword>$(DeployEncryptKey)</EncryptPassword>
<WebServerAppHostConfigDirectory>$(IisServer_WebServerAppHostConfigDirectory)</WebServerAppHostConfigDirectory>
<WebServerManifest>$(IisServer_WebServerManifest)</WebServerManifest>
<WebServerDirectory>$(IisServer_WebServerDirectory)</WebServerDirectory>
</MsDeploySourceProviderSetting>
<MsDeployDestinationProviderSetting Remove="@(MsDeployDestinationProviderSetting)" />
<MsDeployDestinationProviderSetting Include="$(PackageDestinationType)">
<Path>$(PackageDestinationRoot)</Path>
<EncryptPassword>$(DeployEncryptKey)</EncryptPassword>
<IncludeAcls>False</IncludeAcls>
</MsDeployDestinationProviderSetting>
</ItemGroup>
<!--Debugging helper don't need to be localized-->
<Message Text="PackageUsingManifest MsDeploySourceProviderSetting is @(MsDeploySourceProviderSetting)" Condition="$(EnablePackageProcessLoggingAndAssert)" />
<Message Text="PackageUsingManifest MsDeployDestinationProviderSetting is @(MsDeployDestinationProviderSetting)" Condition="$(EnablePackageProcessLoggingAndAssert)"/>
<ExportParametersFile
Condition="!$(UseDeclareParametersXMLInMsDeploy) And $(EnablePackageProcessLoggingAndAssert)"
Parameters="@(MsDeployDeclareParameters)"
DeclareParameterFile="$(PackageLogDir)\PackageUsingManifest.parameters.xml"
GenerateFileEvenIfEmpty="True"
/>
<!--First delete the ParameterFile-->
<Delete Files="$(PackageParametersFile)" Condition="Exists($(PackageParametersFile))" ContinueOnError="true"/>
<ExportParametersFile
Condition="$(UseDeclareParametersXMLInMsDeploy)"
Parameters="@(MsDeployDeclareParameters)"
DeclareParameterFile="$(PackageParametersFile)"
GenerateFileEvenIfEmpty="True"
/>
<PropertyGroup>
<_VsPackageParametersFile></_VsPackageParametersFile>
<_VsPackageParametersFile Condition="$(UseDeclareParametersXMLInMsDeploy)">$(PackageParametersFile)</_VsPackageParametersFile>
</PropertyGroup>
<ItemGroup>
<!--we will include the parameter when $(UseDeclareParametersXMLInMsDeploy) is false-->
<_Package_MsDeployDeclareParameters Include="@(MsDeployDeclareParameters)" Condition="!$(UseDeclareParametersXMLInMsDeploy)" />
</ItemGroup>
<VSMSDeploy Condition="!$(UseMsdeployExe)"
MSDeployVersionsToTry="$(_MSDeployVersionsToTry)"
Source="@(MsDeploySourceProviderSetting)"
Destination="@(MsDeployDestinationProviderSetting)"
DeploymentTraceLevel="$(PackageTraceLevel)"
DisableLink="$(PackageDisableLinks)"
EnableLink="$(PackageEnableLinks)"
DeclareParameterItems="@(_Package_MsDeployDeclareParameters)"
OptimisticParameterDefaultValue="$(EnableOptimisticParameterDefaultValue)"
ImportDeclareParametersItems="$(_VsPackageParametersFile)"
ReplaceRuleItems="@(MsDeployReplaceRules)"
RetryAttempts="$(RetryAttemptsForDeployment)">
<Output TaskParameter="Result" PropertyName="PackageResult" />
</VSMSDeploy>
<!--"msdeploy.exe"
-verb:sync
-source:manifest=obj\Debug\Package\SourceManifest.xml
-Destination:archiveDir=c:\MingTest\archiveDir
-disableLink:"ContentExtension,CertificateExtension"
-replace:-->
<MSdeploy
Condition="$(UseMsdeployExe)"
MSDeployVersionsToTry="$(_MSDeployVersionsToTry)"
Verb="sync"
Source="@(MsDeploySourceProviderSetting)"
Destination="@(MsDeployDestinationProviderSetting)"
DisableLink="$(PackageDisableLinks)"
EnableLink="$(PackageEnableLinks)"
DeclareParameterItems="@(_Package_MsDeployDeclareParameters)"
OptimisticParameterDefaultValue="$(EnableOptimisticParameterDefaultValue)"
ImportDeclareParametersItems="$(_VsPackageParametersFile)"
ReplaceRuleItems="@(MsDeployReplaceRules)"
RetryAttempts="$(RetryAttemptsForDeployment)"
ExePath="$(MSDeployPath)"
/>
<CallTarget Targets="$(OnAfterPackageUsingManifest)" RunEachTargetSeparately="false" />
</Target>
<!--***********************************************************************-->
<!--GenerateSampleDeployScript task-->
<!--***********************************************************************-->
<PropertyGroup>
<GenerateSampleDeployScriptDependsOn Condition="'$(GenerateSampleDeployScriptDependsOn)'==''">
GenerateMsDeployManifestSettings;
GenerateMsdeployManifestFiles;
</GenerateSampleDeployScriptDependsOn>
</PropertyGroup>
<Target Condition="$(GenerateSampleDeployScript)"
Name="GenerateSampleDeployScript"
DependsOnTargets="$(GenerateSampleDeployScriptDependsOn)">
<!--Get Localized string before displaying message-->
<GetPublishingLocalizedString
Importance="Low"
ID="PublishLocalizedString_GenerateSampleMsdeployBatchScript"
LogType="Message" />
<!--<Message Text="GenerateSampleDeployScript the package..." Importance="low"/>-->
<PropertyGroup>
<!--
MSDeployPublishSourceType can be
SingleFilePackage(a single ziped file package)
Manifest(a file with Iis VDir info plus file pathes)
RawIisVDir(Let MSDeploy published all files underneath the phisical path)
ArchiveDir(a folder genearated by package with all files to be transferred)
-->
<!--So far, if we see the single file package, we pick it up; otherwise, we GenerateSampleDeployScript from Iis vdir -->
<GenerateSampleDeployScriptSourceType>manifest</GenerateSampleDeployScriptSourceType>
<GenerateSampleDeployScriptSourceFileName>@(_MSDeploySourceManifest->'%(FileName)%(Extension)')</GenerateSampleDeployScriptSourceFileName>
<GenerateSampleDeployScriptSourceRoot>%25RootPath%25$(GenerateSampleDeployScriptSourceFileName)</GenerateSampleDeployScriptSourceRoot>
<GenerateSampleDeployScriptSourceType Condition="$(_CreatePackage) And $(PackageAsSingleFile)">package</GenerateSampleDeployScriptSourceType>
<GenerateSampleDeployScriptSourceFileName Condition="$(_CreatePackage) And $(PackageAsSingleFile)">@(_MSDeployPackageFile->'%(FileName)%(Extension)')</GenerateSampleDeployScriptSourceFileName>
<GenerateSampleDeployScriptSourceType Condition="$(_CreatePackage) And !$(PackageAsSingleFile)">archiveDir</GenerateSampleDeployScriptSourceType>
<GenerateSampleDeployScriptSourceFileName Condition="$(_CreatePackage) And !$(PackageAsSingleFile)">@(_MSDeployArchiveDir->'%(FileName)%(Extension)')</GenerateSampleDeployScriptSourceFileName>
<GenerateSampleDeployScriptSourceRoot>%25RootPath%25$(GenerateSampleDeployScriptSourceFileName)</GenerateSampleDeployScriptSourceRoot>
<GenerateSampleDeployScriptDestinationType>%25_Destination%25</GenerateSampleDeployScriptDestinationType>
<GenerateSampleDeployScriptDestinationRoot></GenerateSampleDeployScriptDestinationRoot>
<GenerateSampleDeployScriptParameters>@(_MSDeploySampleParametersValue->'%25RootPath%25%(FileName)%(Extension)')</GenerateSampleDeployScriptParameters>
<_ScriptGenerateSampleDeployScriptReadMeLocation>%25RootPath%25$(GenerateSampleDeployScriptReadMeFileName)</_ScriptGenerateSampleDeployScriptReadMeLocation>
<_MSdeployFwdLink>http://go.microsoft.com/?linkid=9278654</_MSdeployFwdLink>
<_SampleDeployCmdFwdLink>http://go.microsoft.com/fwlink/?LinkID=183544</_SampleDeployCmdFwdLink>
</PropertyGroup>
<ItemGroup>
<_MsDeployDeclareParametersNotExclude Include="@(MsDeployDeclareParameters)" Condition="'%(ExcludeFromSetParameter)' != true" />
</ItemGroup>
<SortParametrsByPriority Parameters="@(_MsDeployDeclareParametersNotExclude)"
OptimisticParameterDefaultValue="$(EnableOptimisticParameterDefaultValue)"
OptimisticParameterMetadataName="Value"
>
<Output TaskParameter="Result" ItemName="_SortedMsDeployDeclareParameters"/>
</SortParametrsByPriority>
<RemoveDuplicates Inputs="@(_SortedMsDeployDeclareParameters)">
<Output TaskParameter="Filtered" ItemName="_SampleSetParametersFiltered"/>
</RemoveDuplicates>
<ItemGroup>
<MsDeploySourceProviderSetting Remove="@(MsDeploySourceProviderSetting)" />
<MsDeploySourceProviderSetting Include="$(GenerateSampleDeployScriptSourceType)">
<Path>$(GenerateSampleDeployScriptSourceRoot)</Path>
<EncryptPassword>$(DeployEncryptKey)</EncryptPassword>
</MsDeploySourceProviderSetting>
<MsDeployDestinationProviderSetting Remove="@(MsDeployDestinationProviderSetting)" />
<MsDeployDestinationProviderSetting Include="$(GenerateSampleDeployScriptDestinationType)">
<Path>$(GenerateSampleDeployScriptDestinationRoot)</Path>
<EncryptPassword>$(DeployEncryptKey)</EncryptPassword>
</MsDeployDestinationProviderSetting>
</ItemGroup>
<!--Debug/Diagnostic message is not localized-->
<Message Text="GenerateSampleDeployScript MsDeploySourceProviderSetting is @(MsDeploySourceProviderSetting)" Condition="$(EnablePackageProcessLoggingAndAssert)" />
<Message Text="GenerateSampleDeployScript MsDeployDestinationProviderSetting is @(MsDeployDestinationProviderSetting)" Condition="$(EnablePackageProcessLoggingAndAssert)"/>
<!--Generate the command line script for straight deploy-->
<MSdeploy
PreviewCommandLineOnly="True"
Verb="sync"
Source="@(MsDeploySourceProviderSetting)"
Destination="@(MsDeployDestinationProviderSetting)"
DisableLink="$(PublishDisableLinks)"
EnableLink="$(PublishEnableLinks)"
SkipRuleItems="@(MsDeploySkipRules)"
ExePath="%25MSDeployPath%25">
<Output TaskParameter="CommandLine" PropertyName="_SampleDeployScript" />
</MSdeploy>
<MSdeploy
PreviewCommandLineOnly="True"
Verb="sync"
Source="@(MsDeploySourceProviderSetting)"
Destination="@(MsDeployDestinationProviderSetting)"
DisableLink="$(PublishDisableLinks)"
EnableLink="$(PublishEnableLinks)"
SkipRuleItems="@(MsDeploySkipRules)"
ImportSetParametersItems="$(GenerateSampleDeployScriptParameters)"
ExePath="%25MSDeployPath%25">
<Output TaskParameter="CommandLine" PropertyName="_SampleDeployScriptOnSetParametersFile" />
</MSdeploy>
<!--Generate the command line script for the what-if msdeploy-->
<MSdeploy
PreviewCommandLineOnly="True"
WhatIf="True"
Verb="sync"
Source="@(MsDeploySourceProviderSetting)"
Destination="@(MsDeployDestinationProviderSetting)"
DisableLink="$(PublishDisableLinks)"
EnableLink="$(PublishEnableLinks)"
SkipRuleItems="@(MsDeploySkipRules)"
ImportSetParametersItems="$(GenerateSampleDeployScriptParameters)"
ExePath="%25MSDeployPath%25">
<Output TaskParameter="CommandLine" PropertyName="_SampleDeployScriptOnSetParametersFileWithWhatIf" />
</MSdeploy>
<!--Generate the Set Parameter file-->
<ExportParametersFile
Parameters="@(_SampleSetParametersFiltered)"
OptimisticParameterDefaultValue="$(EnableOptimisticParameterDefaultValue)"
SetParameterFile="$(GenerateSampleParametersValueLocation)"
GenerateFileEvenIfEmpty="True"
/>
<!--Now write the sameple batch file Note this rely on Batch file is in the same location as the package and manifestfiles -->
<!--Note that by default Command line file only support the ANSI. Even if we code it againest utf-8, the cmd.exe won't be able to handle it.
Only the package and setparameters.xml file name matter. You change the deploy parameters into setparameters.xml which support utf-8 properly.-->
<WriteLinesToFile File="$(GenerateSampleDeployScriptLocation)"
Overwrite="True"
Encoding="us-ascii"
Lines="@rem ---------------------------------------------------------------------------------
@rem Copyright 2008 Microsoft Corporation. All rights reserved.
@rem This is provided as sample to deploy the package using msdeploy.exe
@rem For information about IIS Web Deploy technology,
@rem please visit $(_MSdeployFwdLink)
@rem Note: This batch file assumes the package and setparametsrs.xml are in the same folder with this file
@rem ---------------------------------------------------------------------------------
@if %_echo%!==! echo off
setlocal
@rem ---------------------------------------------------------------------------------
@rem Please Make sure you have Web Deploy install in your machine.
@rem Alternatively, you can explicit set the MsDeployPath to the location it is on your machine
@rem set MSDeployPath=&quot;$(MSDeployPath)&quot;
@rem ---------------------------------------------------------------------------------
@rem ---------------------------------------------------------------------------------
@rem if user does not set MsDeployPath environment variable, we will try to retrieve it from registry.
@rem ---------------------------------------------------------------------------------
if &quot;%MSDeployPath%&quot; == &quot;&quot; (
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 (
if /I &quot;%%h&quot; == &quot;InstallPath&quot; (
if /I &quot;%%i&quot; == &quot;REG_SZ&quot; (
if not &quot;%%j&quot; == &quot;&quot; (
if &quot;%%~dpj&quot; == &quot;%%j&quot; (
set MSDeployPath=%%j
))))))
if not exist &quot;%MSDeployPath%\msdeploy.exe&quot; (
echo. msdeploy.exe is not found on this machine. Please install Web Deploy before execute the script.
echo. Please visit $(_MSdeployFwdLink)
goto :usage
)
set RootPath=%~dp0
if /I &quot;%_DeploySetParametersFile%&quot; == &quot;&quot; (
set _DeploySetParametersFile=$(GenerateSampleDeployScriptParameters)
)
set _ArgTestDeploy=
set _ArgDestinationType=auto
set _ArgComputerName=
set _ArgUserName=
set _ArgPassword=
set _ArgEncryptPassword=
set _ArgIncludeAcls=False
set _ArgAuthType=
set _ArgtempAgent=
set _ArgLocalIIS=
set _ArgLocalIISVersion=
@rem ---------------------------------------------------------------------------------
@rem Simple Parse the arguments
@rem ---------------------------------------------------------------------------------
:NextArgument
set _ArgCurrentOriginal=%1
set _ArgCurrent=%~1
if /I &quot;%_ArgCurrent%&quot; == &quot;&quot; goto :GetStarted
if /I &quot;%_ArgCurrent%&quot; == &quot;/T&quot; set _ArgTestDeploy=true&amp;goto :ArgumentOK
if /I &quot;%_ArgCurrent%&quot; == &quot;/Y&quot; set _ArgTestDeploy=false&amp;goto :ArgumentOK
if /I &quot;%_ArgCurrent%&quot; == &quot;/L&quot; set _ArgLocalIIS=true&amp;goto :ArgumentOK
set _ArgFlag=%_ArgCurrent:~0,3%
set _ArgValue=%_ArgCurrent:~3%
if /I &quot;%_ArgFlag%&quot; == &quot;/M:&quot; set _ArgComputerName=%_ArgValue%&amp;goto :ArgumentOK
if /I &quot;%_ArgFlag%&quot; == &quot;/U:&quot; set _ArgUserName=%_ArgValue%&amp;goto :ArgumentOK
if /I &quot;%_ArgFlag%&quot; == &quot;/P:&quot; set _ArgPassword=%_ArgValue%&amp;goto :ArgumentOK
if /I &quot;%_ArgFlag%&quot; == &quot;/E:&quot; set _ArgEncryptPassword=%_ArgValue%&amp;goto :ArgumentOK
if /I &quot;%_ArgFlag%&quot; == &quot;/I:&quot; set _ArgIncludeAcls=%_ArgValue%&amp;goto :ArgumentOK
if /I &quot;%_ArgFlag%&quot; == &quot;/A:&quot; set _ArgAuthType=%_ArgValue%&amp;goto :ArgumentOK
if /I &quot;%_ArgFlag%&quot; == &quot;/G:&quot; set _ArgtempAgent=%_ArgValue%&amp;goto :ArgumentOK
@rem Any addition flags, pass through to the msdeploy
set _ArgMsDeployAdditionalFlags=%_ArgMsDeployAdditionalFlags% %_ArgCurrentOriginal%
:ArgumentOK
shift
goto :NextArgument
:GetStarted
if /I &quot;%_ArgTestDeploy%&quot; == &quot;&quot; goto :usage
if /I &quot;%_ArgDestinationType%&quot; == &quot;&quot; goto :usage
set _Destination=%_ArgDestinationType%
if not &quot;%_ArgComputerName%&quot; == &quot;&quot; set _Destination=%_Destination%,computerName='%_ArgComputerName%'
if not &quot;%_ArgUserName%&quot; == &quot;&quot; set _Destination=%_Destination%,userName='%_ArgUserName%'
if not &quot;%_ArgPassword%&quot; == &quot;&quot; set _Destination=%_Destination%,password='%_ArgPassword%'
if not &quot;%_ArgAuthType%&quot; == &quot;&quot; set _Destination=%_Destination%,authtype='%_ArgAuthType%'
if not &quot;%_ArgEncryptPassword%&quot; == &quot;&quot; set _Destination=%_Destination%,encryptPassword='%_ArgEncryptPassword%'
if not &quot;%_ArgIncludeAcls%&quot; == &quot;&quot; set _Destination=%_Destination%,includeAcls='%_ArgIncludeAcls%'
if not &quot;%_ArgtempAgent%&quot; == &quot;&quot; set _Destination=%_Destination%,tempAgent='%_ArgtempAgent%'
@rem ---------------------------------------------------------------------------------
@rem add -whatif when -T is specified
@rem ---------------------------------------------------------------------------------
if /I &quot;%_ArgTestDeploy%&quot; NEQ &quot;false&quot; (
set _MsDeployAdditionalFlags=%_MsDeployAdditionalFlags% -whatif
)
@rem ---------------------------------------------------------------------------------
@rem add flags for IISExpress when -L is specified
@rem ---------------------------------------------------------------------------------
if /I &quot;%_ArgLocalIIS%&quot; == &quot;true&quot; (
call :SetIISExpressArguments
)
if /I &quot;%_ArgLocalIIS%&quot; == &quot;true&quot; (
if not exist &quot;%IISExpressPath%%IISExpressManifest%&quot; (
echo. IISExpress is not found on this machine. Please install through Web Platform Installer before execute the script.
echo. or remove /L flag
echo. Please visit $(_MSdeployFwdLink)
goto :usage
)
if not exist &quot;%IISExpressUserProfileDirectory%&quot; (
echo. %IISExpressUserProfileDirectory% is not exists
echo. IISExpress is found on the machine. But the user have run IISExpress at least once.
echo. Please visit $(_MSdeployFwdLink) for detail
goto :usage
)
set _MsDeployAdditionalFlags=%_MsDeployAdditionalFlags% -appHostConfigDir:%IISExpressUserProfileDirectory% -WebServerDir:&quot;%IISExpressPath%&quot; -webServerManifest:&quot;%IISExpressManifest%&quot;
)
@rem ---------------------------------------------------------------------------------
@rem pass through the addition msdeploy.exe Flags
@rem ---------------------------------------------------------------------------------
set _MsDeployAdditionalFlags=%_MsDeployAdditionalFlags% %_ArgMsDeployAdditionalFlags%
@rem ---------------------------------------------------------------------------------
@rem check the existence of the package file
@rem ---------------------------------------------------------------------------------
if not exist &quot;$(GenerateSampleDeployScriptSourceRoot)&quot; (
echo &quot;$(GenerateSampleDeployScriptSourceRoot)&quot; does not exist.
echo This batch file relies on this deploy source file^(s^) in the same folder.
goto :usage
)
@rem ---------------------------------------------------------------------------------
@rem Execute msdeploy.exe command line
@rem ---------------------------------------------------------------------------------
call :CheckParameterFile
echo. Start executing msdeploy.exe
echo -------------------------------------------------------
if not exist &quot;%_DeploySetParametersFile%&quot; (
echo. $(_SampleDeployScript) %_MsDeployAdditionalFlags%
$(_SampleDeployScript) %_MsDeployAdditionalFlags%
) else (
echo. $(_SampleDeployScriptOnSetParametersFile) %_MsDeployAdditionalFlags%
$(_SampleDeployScriptOnSetParametersFile) %_MsDeployAdditionalFlags%
)
goto :eof
@rem ---------------------------------------------------------------------------------
@rem Find and set IISExpress argument.
@rem ---------------------------------------------------------------------------------
:SetIISExpressArguments
if &quot;%IISExpressPath%&quot; == &quot;&quot; (
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 (
if /I &quot;%%h&quot; == &quot;InstallPath&quot; (
if /I &quot;%%i&quot; == &quot;REG_SZ&quot; (
if not &quot;%%j&quot; == &quot;&quot; (
if &quot;%%~dpj&quot; == &quot;%%j&quot; (
set IISExpressPath=%%j
))))))
if &quot;%IISExpressPath%&quot; == &quot;&quot; (
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 (
if /I &quot;%%h&quot; == &quot;InstallPath&quot; (
if /I &quot;%%i&quot; == &quot;REG_SZ&quot; (
if not &quot;%%j&quot; == &quot;&quot; (
if &quot;%%~dpj&quot; == &quot;%%j&quot; (
set IISExpressPath=%%j
))))))
if &quot;%PersonalDocumentFolder%&quot; == &quot;&quot; (
for /F &quot;usebackq tokens=2*&quot; %%i in (`reg query &quot;HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders&quot; /v Personal`) do (
set PersonalDocumentFolder=%%j
))
if &quot;%IISExpressManifest%&quot; == &quot;&quot; (
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 (
if /I &quot;%%h&quot; == &quot;Manifest&quot; (
if /I &quot;%%i&quot; == &quot;REG_SZ&quot; (
if not &quot;%%j&quot; == &quot;&quot; (
set IISExpressManifest=%%j
)))))
if &quot;%IISExpressManifest%&quot; == &quot;&quot; (
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 (
if /I &quot;%%h&quot; == &quot;Manifest&quot; (
if /I &quot;%%i&quot; == &quot;REG_SZ&quot; (
if not &quot;%%j&quot; == &quot;&quot; (
set IISExpressManifest=%%j
)))))
set IISExpressUserProfileDirectory=&quot;%PersonalDocumentFolder%\IISExpress\config&quot;
goto :eof
@rem ---------------------------------------------------------------------------------
@rem CheckParameterFile -- check if the package's setparamters.xml exists or not
@rem ---------------------------------------------------------------------------------
:CheckParameterFile
echo =========================================================
if exist &quot;%_DeploySetParametersFile%&quot; (
echo SetParameters from:
echo &quot;%_DeploySetParametersFile%&quot;
echo You can change IIS Application Name, Physical path, connectionString
echo or other deploy parameters in the above file.
) else (
echo SetParamterFiles does not exist in package location.
echo Use package embedded defaultValue to deploy.
)
echo -------------------------------------------------------
goto :eof
@rem ---------------------------------------------------------------------------------
@rem Usage
@rem ---------------------------------------------------------------------------------
:usage
echo =========================================================
if not exist &quot;$(_ScriptGenerateSampleDeployScriptReadMeLocation)&quot; (
echo Usage:%~nx0 [/T^|/Y] [/M:ComputerName] [/U:userName] [/P:password] [/G:tempAgent] [additional msdeploy flags ...]
echo Required flags:
echo /T Calls msdeploy.exe with the &quot;-whatif&quot; flag, which simulates deployment.
echo /Y Calls msdeploy.exe without the &quot;-whatif&quot; flag, which deploys the package to the current machine or destination server
echo Optional flags:
echo. By Default, this script deploy to the current machine where this script is invoked which will use current user credential without tempAgent.
echo. Only pass these arguments when in advance scenario.
echo /M: Msdeploy destination name of remote computer or proxy-URL. Default is local.
echo /U: Msdeploy destination user name.
echo /P: Msdeploy destination password.
echo /G: Msdeploy destination tempAgent. True or False. Default is false.
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.
echo /L: Deploy to Local IISExpress User Instance.
echo.[additional msdeploy flags]: note: &quot; is required for passing = through command line.
echo &quot;-skip:objectName=setAcl&quot; &quot;-skip:objectName=dbFullSql&quot;
echo.Alternative environment variable _MsDeployAdditionalFlags is also honored.
echo.
echo. Please make sure MSDeploy is installed in the box $(_MSdeployFwdLink)
echo.
echo In addition, you can change IIS Application Name, Physical path,
echo connectionString and other deploy parameters in the following file:
echo &quot;%_DeploySetParametersFile%&quot;
echo.
echo For more information about this batch file, visit $(_SampleDeployCmdFwdLink)
) else (
start notepad &quot;$(_ScriptGenerateSampleDeployScriptReadMeLocation)&quot;
)
echo =========================================================
goto :eof
"/>
<!--Generate localized readme.txt for this batch file-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_SampleScriptHelpPrerequisites"
ArgumentCount="3"
Arguments="$(_MSdeployFwdLink);$(GenerateSampleDeployScriptSourceFileName);$(GenerateSampleParametersValueFileName)">
<Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
</GetPublishingLocalizedString>
<GetPublishingLocalizedString
ID="PublishLocalizedString_SampleScriptHelpSection1"
ArgumentCount="1"
Arguments="$(GenerateSampleDeployScriptFileName)">
<Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
</GetPublishingLocalizedString>
<GetPublishingLocalizedString
ID="PublishLocalizedString_SampleScriptHelpRequired">
<Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
</GetPublishingLocalizedString>
<GetPublishingLocalizedString
ID="PublishLocalizedString_SampleScriptHelpRequiredExplainedFlagT">
<Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
</GetPublishingLocalizedString>
<GetPublishingLocalizedString
ID="PublishLocalizedString_SampleScriptHelpRequiredExplainedFlagY">
<Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
</GetPublishingLocalizedString>
<GetPublishingLocalizedString
ID="PublishLocalizedString_SampleScriptHelpOptional">
<Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
</GetPublishingLocalizedString>
<GetPublishingLocalizedString
ID="PublishLocalizedString_SampleScriptHelpOptionalExplainedFlagM">
<Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
</GetPublishingLocalizedString>
<GetPublishingLocalizedString
ID="PublishLocalizedString_SampleScriptHelpOptionalExplainedFlagUP">
<Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
</GetPublishingLocalizedString>
<GetPublishingLocalizedString
ID="PublishLocalizedString_SampleScriptHelpOptionalExplainedFlagG">
<Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
</GetPublishingLocalizedString>
<GetPublishingLocalizedString
ID="PublishLocalizedString_SampleScriptHelpOptionalExplainedFlagA">
<Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
</GetPublishingLocalizedString>
<GetPublishingLocalizedString
ID="PublishLocalizedString_SampleScriptHelpOptionalExplainedFlagL">
<Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
</GetPublishingLocalizedString>
<GetPublishingLocalizedString
ID="PublishLocalizedString_SampleScriptHelpOptionalExplainedAdditionalFlags">
<Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
</GetPublishingLocalizedString>
<GetPublishingLocalizedString
ID="PublishLocalizedString_SampleScriptHelpEnviroment">
<Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
</GetPublishingLocalizedString>
<GetPublishingLocalizedString
ID="PublishLocalizedString_SampleScriptHelpEnviromentExplained"
ArgumentCount="1"
Arguments="$(GenerateSampleParametersValueFileName)">
<Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
</GetPublishingLocalizedString>
<GetPublishingLocalizedString
ID="PublishLocalizedString_SampleScriptHelpMoreInfo"
ArgumentCount="1"
Arguments="$(_SampleDeployCmdFwdLink)">
<Output TaskParameter="Result" ItemName="_PublishLocalizedString_SampleScriptHelpString" />
</GetPublishingLocalizedString>
<WriteLinesToFile File="$(GenerateSampleDeployScriptReadMeLocation)"
Overwrite="True"
Encoding="utf-8"
Lines="@(_PublishLocalizedString_SampleScriptHelpString,'')" />
<!--Get Localized string before displaying message where we generate the batch file-->
<GetPublishingLocalizedString
Importance="High"
ID="PublishLocalizedString_FinishGenerateSampleMsDeployBatchScript"
ArgumentCount="2"
Arguments="$(GenerateSampleDeployScriptLocation);$(GenerateSampleParametersValueLocation)"
LogType="Message" />
<!--<Message Importance="high"
Text="Sample script for deploying this package is generated at the following location:
$(GenerateSampleDeployScriptLocation)
For this sample script, you can change the deploy parameters by changing the following file:
$(GenerateSampleParametersValueLocation)" />-->
</Target>
<!--***********************************************************************-->
<!--TestDeployPackageToLocal task-->
<!--***********************************************************************-->
<PropertyGroup>
<TestDeployPackageToLocalDependsOn Condition="'$(TestDeployPackageToLocalDependsOn)'==''">
GenerateMsDeployManifestSettings;
GenerateMsdeployManifestFiles;
Package;
</TestDeployPackageToLocalDependsOn>
</PropertyGroup>
<Target Name="TestDeployPackageToLocal" DependsOnTargets="$(TestDeployPackageToLocalDependsOn)">
<!--Get Localized string before displaying message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_TestDeployPackageOnCurrentMachine"
LogType="Message" />
<!--<Message Text="TestDeployPackageToLocal the package..."/>-->
<PropertyGroup>
<!--
MSDeployPublishSourceType can be
SingleFilePackage(a single ziped file package)
Manifest(a file with Iis VDir info plus file pathes)
RawIisVDir(Let MSDeploy published all files underneath the phisical path)
ArchiveDir(a folder genearated by package with all files to be transferred)
-->
<!--So far, if we see the single file package, we pick it up; otherwise, we TestDeployPackageToLocal from Iis vdir -->
<TestDeployPackageToLocalSourceType>manifest</TestDeployPackageToLocalSourceType>
<TestDeployPackageToLocalSourceRoot>@(_MSDeploySourceManifest->'%(FullPath)')</TestDeployPackageToLocalSourceRoot>
<TestDeployPackageToLocalSourceType Condition="$(_CreatePackage) And $(PackageAsSingleFile)">package</TestDeployPackageToLocalSourceType>
<TestDeployPackageToLocalSourceRoot Condition="$(_CreatePackage) And $(PackageAsSingleFile)">@(_MSDeployPackageFile->'%(FullPath)')</TestDeployPackageToLocalSourceRoot>
<TestDeployPackageToLocalSourceType Condition="$(_CreatePackage) And !$(PackageAsSingleFile)">archiveDir</TestDeployPackageToLocalSourceType>
<TestDeployPackageToLocalSourceRoot Condition="$(_CreatePackage) And !$(PackageAsSingleFile)">@(_MSDeployArchiveDir->'%(FullPath)')</TestDeployPackageToLocalSourceRoot>
<!--Destination is alway a manifest-->
<TestDeployPackageToLocalDestinationType>auto</TestDeployPackageToLocalDestinationType>
<TestDeployPackageToLocalDestinationRoot></TestDeployPackageToLocalDestinationRoot>
</PropertyGroup>
<ItemGroup>
<MsDeploySourceProviderSetting Remove="@(MsDeploySourceProviderSetting)" />
<MsDeploySourceProviderSetting Include="$(TestDeployPackageToLocalSourceType)">
<Path>$(TestDeployPackageToLocalSourceRoot)</Path>
<EncryptPassword>$(DeployEncryptKey)</EncryptPassword>
</MsDeploySourceProviderSetting>
<MsDeployDestinationProviderSetting Remove="@(MsDeployDestinationProviderSetting)" />
<MsDeployDestinationProviderSetting Include="$(TestDeployPackageToLocalDestinationType)">
<Path>$(TestDeployPackageToLocalDestinationRoot)</Path>
<EncryptPassword>$(DeployEncryptKey)</EncryptPassword>
<IncludeAcls>False</IncludeAcls>
</MsDeployDestinationProviderSetting>
</ItemGroup>
<!--Debug/Diagnostic message is not localized-->
<Message Text="TestDeployPackageToLocal MsDeploySourceProviderSetting is @(MsDeploySourceProviderSetting)" Condition="$(EnablePackageProcessLoggingAndAssert)" />
<Message Text="TestDeployPackageToLocal MsDeployDestinationProviderSetting is @(MsDeployDestinationProviderSetting)" Condition="$(EnablePackageProcessLoggingAndAssert)"/>
<VSMSDeploy
Condition="!$(UseMsdeployExe)"
MSDeployVersionsToTry="$(_MSDeployVersionsToTry)"
Source="@(MsDeploySourceProviderSetting)"
Destination="@(MsDeployDestinationProviderSetting)"
DisableLink="$(PublishDisableLinks)"
EnableLink="$(PublishEnableLinks)">
<Output TaskParameter="Result" PropertyName="_TestDeployPackageToLocalResult" />
</VSMSDeploy>
<MSdeploy
Condition="$(UseMsdeployExe)"
MSDeployVersionsToTry="$(_MSDeployVersionsToTry)"
Verb="sync"
Source="@(MsDeploySourceProviderSetting)"
Destination="@(MsDeployDestinationProviderSetting)"
DisableLink="$(PublishDisableLinks)"
EnableLink="$(PublishEnableLinks)"
ExePath="$(MSDeployPath)" />
</Target>
<!--********************************************************************-->
<!-- Target GenerateGlobalPublishSetting -->
<!--********************************************************************-->
<PropertyGroup>
<NormalizePublishSettings Condition="'$(NormalizePublishSettings)'==''">true</NormalizePublishSettings>
<AuthType Condition="'$(AuthType)'==''" >Basic</AuthType>
<!--Supported value for $(MSDeployPublishMethod): WMSVC, RemoteAgent, InProc-->
<MSDeployPublishMethod Condition="'$(MSDeployPublishMethod)'==''" >WMSVC</MSDeployPublishMethod>
<GenerateGlobalPublishSettingDependsOn Condition="'$(GenerateGlobalPublishSettingDependsOn)'==''">
GetProjectWebProperties;
</GenerateGlobalPublishSettingDependsOn>
</PropertyGroup>
<Target Name="GenerateGlobalPublishSetting"
DependsOnTargets="$(GenerateGlobalPublishSettingDependsOn)">
<PropertyGroup>
<_UseWMSVC>false</_UseWMSVC>
<_UseWMSVC Condition="'$(MSDeployPublishMethod)'=='WMSVC'">true</_UseWMSVC>
<_UseRemoteAgent>false</_UseRemoteAgent>
<_UseRemoteAgent Condition="'$(MSDeployPublishMethod)'=='RemoteAgent'">true</_UseRemoteAgent>
</PropertyGroup>
<!--Get Localized string before displaying message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_ValidatingMsDeployPublishSettings"
LogType="Message" />
<!--<Message Text="Validate publish related properties" />-->
<CreateProperty Value="$(CreatePackageOnPublish)">
<Output TaskParameter="Value" PropertyName="_CreatePackage"/>
</CreateProperty>
<!--Debug/Diagnostic message is not localized-->
<Message Text="_CreatePackage is $(_CreatePackage)" Condition="$(EnablePackageProcessLoggingAndAssert)" />
<!--Get Localized string before displaying error-->
<GetPublishingLocalizedString
Condition="'$(MsDeployServiceUrl)'==''"
ID="PublishLocalizedString_ValidateErrorMsDeployPublishSetting"
ArgumentCount="1"
Arguments="MsDeployServiceUrl"
LogType="Error" />
<!--<Error Condition="$(MsDeployServiceUrl)==''" Text="Missing or Invalid property value for MsDeployServiceUrl" />-->
<!--Warn, setting the physical path is invalid if we don't deploy iis settings-->
<!--Get Localized string before displaying warning-->
<GetPublishingLocalizedString
Condition="!$(IncludeIisSettingsOnPublish) And $(RemoteSitePhysicalPath) != ''"
ID="PublishLocalizedString_WarningOnSettingRemoteSitePhysicalPathWhenIISSettingIsNotInclude"
LogType="Warning" />
<!--<Warning Condition="!$(IncludeIisSettingsOnPublish) And $(RemoteSitePhysicalPath) != ''" Text="Setting value to property of RemoteSitePhysicalPath might not work if IIS setting is not included" />-->
<!--Warn, should not deploy as an IisApp with IIS setting included (IisApp is not a regular IIS application. It is a folder plus marking it as Iis app)-->
<!--Get Localized string before displaying warning-->
<GetPublishingLocalizedString
Condition="$(IncludeIisSettingsOnPublish) and $(DeployAsIisApp)"
ID="PublishLocalizedString_WarningOnSettingBothIncludeIisSettingsOnPublishAndDeployAsIisApp"
LogType="Warning" />
<!--<Warning Condition="$(IncludeIisSettingsOnPublish) and $(DeployAsIisApp)"
Text="Setting both property values of DeployAsIisApp and IncludeIisSettingsOnPublish to true is not recommended, as IncludeIisSettingsOnPublish is a superset of DeployAsIisApp" />-->
<CreateProperty Value="NTLM" Condition="!$(_UseWMSVC) And $(NormalizePublishSettings)">
<Output TaskParameter="Value" PropertyName="AuthType"/>
</CreateProperty>
<!--Debug/Diagnostic message is not localized-->
<Message Text="AuthType is $(AuthType)" Condition="$(EnablePackageProcessLoggingAndAssert)" />
<!--Normalize service url such as convert a server name to foramt like https://<server>:8172/msdeploy.axd-->
<NormalizeServiceUrl ServiceUrl="$(MsDeployServiceUrl)" UseWMSVC="$(_UseWMSVC)" UseRemoteAgent="$(_UseRemoteAgent)"
Condition="$(NormalizePublishSettings)">
<Output TaskParameter="ResultUrl" PropertyName="MsDeployServiceUrl" />
</NormalizeServiceUrl>
<!--Debug/Diagnostic message is not localized-->
<Message Text="MsDeployServiceUrl is $(MsDeployServiceUrl)" Condition="$(EnablePackageProcessLoggingAndAssert)" />
<!--Append the site name at the end of ServiceUrl like site=mysite-->
<ConcatFullServiceUrlWithSiteName ServiceUrl="$(MsDeployServiceUrl)" SiteAppName="$(DeployIisAppPath)"
Condition="$(_UseWMSVC) And $(NormalizePublishSettings)">
<Output TaskParameter="ResultUrl" PropertyName="MsDeployServiceUrl" />
</ConcatFullServiceUrlWithSiteName>
<!--Debug/Diagnostic message is not localized-->
<Message Text="MsDeployServiceUrl is $(MsDeployServiceUrl)" Condition="$(EnablePackageProcessLoggingAndAssert)" />
</Target>
<!--********************************************************************-->
<!-- Target GatherLinkExtensionsToBeExposedInVS -->
<!--********************************************************************-->
<Target Name="GatherLinkExtensionsToBeExposedInVS">
<PropertyGroup>
<LinkExtensionFileName>LinkExtensioninfo.xml</LinkExtensionFileName>
<LinksHiddenFromVS>HttpCertConfigExtension;CertificateExtension;FrameworkConfigExtension</LinksHiddenFromVS>
<LinksDisabledByVS>ContentExtension</LinksDisabledByVS>
</PropertyGroup>
<GatherLinkExtensionsToBeExposedInVS LinksHiddenFromVS="$(LinksHiddenFromVS)"
LinksDisabledByVS="$(LinksDisabledByVS)"
LinkInfoFilePath="$(PackageTempRootDir)\\$(LinkExtensionFileName)" />
</Target>
<!--********************************************************************-->
<!-- Target MSDeployPublish -->
<!--********************************************************************-->
<PropertyGroup>
<CreatePackageOnPublish Condition="'$(CreatePackageOnPublish)'==''">false</CreatePackageOnPublish>
<MSDeployPublishDependsOn Condition="'$(MSDeployPublishDependsOn)'==''">
GenerateGlobalPublishSetting;
ValidateGlobalPackageSetting;
GenerateMsDeployManifestSettings;
GenerateMsdeployManifestFiles;
GenerateSkipRuleForAppData;
Package;
</MSDeployPublishDependsOn>
</PropertyGroup>
<Target Name="MSDeployPublish" DependsOnTargets="$(MSDeployPublishDependsOn)">
<!--Get Localized string before displaying message-->
<GetPublishingLocalizedString
Condition="'$(MsDeployServiceUrl)'!=''"
Importance="High"
ID="PublishLocalizedString_StartMsDeployPublishToRemote"
ArgumentCount="1"
Arguments="$(MsDeployServiceUrl)"
LogType="Message" />
<!--<Message Importance="High"
Text="Start Msdeploy Publish the Application/package to $(MsDeployServiceUrl) ..."/>-->
<PropertyGroup>
<!--
MSDeployPublishSourceType can be
SingleFilePackage(a single ziped file package)
Manifest(a file with Iis VDir info plus file pathes)
RawIisVDir(Let MSDeploy published all files underneath the phisical path)
ArchiveDir(a folder genearated by package with all files to be transferred)
-->
<!--So far, if we see the single file package, we pick it up; otherwise, we transport from Iis vdir -->
<MSDeployPublishSourceType>manifest</MSDeployPublishSourceType>
<MSDeployPublishSourceRoot>@(_MSDeploySourceManifest->'%(FullPath)')</MSDeployPublishSourceRoot>
<MSDeployPublishSourceType Condition="$(CreatePackageOnPublish) And $(PackageAsSingleFile)">package</MSDeployPublishSourceType>
<MSDeployPublishSourceRoot Condition="$(CreatePackageOnPublish) And $(PackageAsSingleFile)">@(_MSDeployPackageFile->'%(FullPath)')</MSDeployPublishSourceRoot>
<MSDeployPublishSourceType Condition="$(CreatePackageOnPublish) And !$(PackageAsSingleFile)">archiveDir</MSDeployPublishSourceType>
<MSDeployPublishSourceRoot Condition="$(CreatePackageOnPublish) And !$(PackageAsSingleFile)">@(_MSDeployArchiveDir->'%(FullPath)')</MSDeployPublishSourceRoot>
<!--Destination is alway a manifest-->
<MSDeployPublishDestinationType>auto</MSDeployPublishDestinationType>
<MSDeployPublishDestinationRoot></MSDeployPublishDestinationRoot>
<!--Property used when we invoke msdeploy process for publish-->
<MsDeployDoNotDeleteRule Condition="$(SkipExtraFilesOnServer)">DoNotDeleteRule</MsDeployDoNotDeleteRule>
</PropertyGroup>
<PropertyGroup >
<_MSDeploySourceWebServerAppHostConfigDirectory>$(IisServer_WebServerAppHostConfigDirectory)</_MSDeploySourceWebServerAppHostConfigDirectory>
<_MSDeploySourceWebServerManifest>$(IisServer_WebServerManifest)</_MSDeploySourceWebServerManifest>
<_MSDeploySourceWebServerDirectory>$(IisServer_WebServerDirectory)</_MSDeploySourceWebServerDirectory>
</PropertyGroup>
<MapUriToIisWebServer Condition="('$(MSDeployPublishMethod)'=='INPROC') And ('$(MsDeployServiceUrl)' != '') "
ProjectIisUrl="$(MsDeployServiceUrl)"
UseIISExpressHintFlag="$(_DeploymentUseIISExpressHint)">
<Output TaskParameter="WebServerAppHostConfigDirectory" PropertyName="_MSDeployDestinationWebServerAppHostConfigDirectory" />
<Output TaskParameter="WebServerDirectory" PropertyName="_MSDeployDestinationWebServerDirectory" />
<Output TaskParameter="WebServerManifest" PropertyName="_MSDeployDestinationWebServerManifest" />
</MapUriToIisWebServer>
<PropertyGroup>
<_PublishMsDeployServiceUrl>$(MsDeployServiceUrl)</_PublishMsDeployServiceUrl>
<_PublishMsDeployServiceUrl Condition="('$(MSDeployPublishMethod)'=='INPROC')"></_PublishMsDeployServiceUrl>
</PropertyGroup>
<ItemGroup>
<MsDeploySourceProviderSetting Remove="@(MsDeploySourceProviderSetting)" />
<MsDeploySourceProviderSetting Include="$(MSDeployPublishSourceType)">
<Path>$(MSDeployPublishSourceRoot)</Path>
<EncryptPassword>$(DeployEncryptKey)</EncryptPassword>
<WebServerAppHostConfigDirectory>$(_MSDeploySourceWebServerAppHostConfigDirectory)</WebServerAppHostConfigDirectory>
<WebServerManifest>$(_MSDeploySourceWebServerManifest)</WebServerManifest>
<WebServerDirectory>$(_MSDeploySourceWebServerDirectory)</WebServerDirectory>
</MsDeploySourceProviderSetting>
<MsDeployDestinationProviderSetting Remove="@(MsDeployDestinationProviderSetting)" />
<MsDeployDestinationProviderSetting Include="$(MSDeployPublishDestinationType)">
<Path>$(MSDeployPublishDestinationRoot)</Path>
<ComputerName>$(_PublishMsDeployServiceUrl)</ComputerName>
<UserName>$(UserName)</UserName>
<Password>$(Password)</Password>
<EncryptPassword>$(DeployEncryptKey)</EncryptPassword>
<IncludeAcls>False</IncludeAcls>
<AuthType>$(AuthType)</AuthType>
<WebServerAppHostConfigDirectory>$(_MSDeployDestinationWebServerAppHostConfigDirectory)</WebServerAppHostConfigDirectory>
<WebServerManifest>$(_MSDeployDestinationWebServerManifest)</WebServerManifest>
<WebServerDirectory>$(_MSDeployDestinationWebServerDirectory)</WebServerDirectory>
</MsDeployDestinationProviderSetting>
</ItemGroup>
<!--Debug/Diagnostic message is not localized-->
<Message Text="MSDeployPublish MsDeploySourceProviderSetting is @(MsDeploySourceProviderSetting)" Condition="$(EnablePackageProcessLoggingAndAssert)" />
<Message Text="MSDeployPublish MsDeployDestinationProviderSetting is @(MsDeployDestinationProviderSetting)" Condition="$(EnablePackageProcessLoggingAndAssert)"/>
<ExportParametersFile
Condition="!$(UseDeclareParametersXMLInMsDeploy) And $(EnablePackageProcessLoggingAndAssert)"
Parameters="@(MsDeployDeclareParameters)"
DeclareSetParameterFile="$(PackageLogDir)\MSDeployPublish.parameters.xml"
GenerateFileEvenIfEmpty="True"
/>
<!--First delete the ParameterFile-->
<Delete Files="$(PublishParametersFile)" Condition="Exists($(PublishParametersFile))" ContinueOnError="true"/>
<!-- Create the Parameterfile if needed-->
<ExportParametersFile
Condition="$(UseDeclareParametersXMLInMsDeploy)"
Parameters="@(MsDeployDeclareParameters)"
DeclareSetParameterFile="$(PublishParametersFile)"
GenerateFileEvenIfEmpty="True"
/>
<PropertyGroup>
<_VsPublishParametersFile></_VsPublishParametersFile>
<_VsPublishParametersFile Condition="$(UseDeclareParametersXMLInMsDeploy) and '$(_VsPublishParametersFile)'==''">$(PublishParametersFile)</_VsPublishParametersFile>
</PropertyGroup>
<ItemGroup>
<!--we will include the parameter when $(UseDeclareParametersXMLInMsDeploy) is false-->
<!--We need to have those Parameters when it is direct publishing from manifest and not use -->
<_VsPublish_MsDeployDeclareParameters Include="@(MsDeployDeclareParameters)" Condition="!$(UseDeclareParametersXMLInMsDeploy) And !$(CreatePackageOnPublish)" />
</ItemGroup>
<VSMSDeploy
Condition="!$(UseMsdeployExe)"
MSDeployVersionsToTry="$(_MSDeployVersionsToTry)"
Source="@(MsDeploySourceProviderSetting)"
Destination="@(MsDeployDestinationProviderSetting)"
DisableLink="$(PublishDisableLinks)"
EnableLink="$(PublishEnableLinks)"
AllowUntrustedCertificate="$(AllowUntrustedCertificate)"
SkipExtraFilesOnServer="$(SkipExtraFilesOnServer)"
SkipRuleItems="@(MsDeploySkipRules)"
SetParameterItems="@(_VsPublish_MsDeployDeclareParameters)"
OptimisticParameterDefaultValue="$(EnableOptimisticParameterDefaultValue)"
ImportSetParametersItems="$(_VsPublishParametersFile)"
RetryAttempts="$(RetryAttemptsForDeployment)"
InvokedByPublish="true"
>
<Output TaskParameter="Result" PropertyName="_PublishResult" />
</VSMSDeploy>
<MSdeploy
Condition="$(UseMsdeployExe)"
MSDeployVersionsToTry="$(_MSDeployVersionsToTry)"
Verb="sync"
Source="@(MsDeploySourceProviderSetting)"
Destination="@(MsDeployDestinationProviderSetting)"
DisableLink="$(PublishDisableLinks)"
EnableLink="$(PublishEnableLinks)"
EnableRule="$(MsDeployDoNotDeleteRule)"
AllowUntrusted="$(AllowUntrustedCertificate)"
SkipRuleItems="@(MsDeploySkipRules)"
SetParameterItems="@(_VsPublish_MsDeployDeclareParameters)"
OptimisticParameterDefaultValue="$(EnableOptimisticParameterDefaultValue)"
ImportSetParametersItems="$(_VsPublishParametersFile)"
RetryAttempts="$(RetryAttemptsForDeployment)"
ExePath="$(MSDeployPath)" />
</Target>
<PropertyGroup>
<WebPublishMethod Condition="'$(WebPublishMethod)'==''">MSDeploy</WebPublishMethod>
<WebPublishDependsOn Condition="'$(WebPublishMethod)'=='MSDeploy'">
MSDeployPublish;
</WebPublishDependsOn>
</PropertyGroup>
<Target Name="WebPublish" DependsOnTargets="$(WebPublishDependsOn)">
</Target>
<!--********************************************************************-->
<!--Target PipelineDeployPhase -->
<!--********************************************************************-->
<PropertyGroup>
<!--Targets get execute before this Target-->
<OnBeforePipelineDeployPhase Condition="'$(OnBeforePipelineDeployPhase)'==''">
</OnBeforePipelineDeployPhase>
<!--Targets get execute after this Target-->
<OnAfterPipelineDeployPhase Condition="'$(OnAfterPipelineDeployPhase)'==''">
</OnAfterPipelineDeployPhase>
<PipelineDeployPhaseDependsOn Condition="'$(PipelineDeployPhaseDependsOn)'==''">
$(OnBeforePipelineDeployPhase);
$(DeployDefaultTarget);
</PipelineDeployPhaseDependsOn>
</PropertyGroup>
<Target Name="PipelineDeployPhase"
DependsOnTargets="$(PipelineDeployPhaseDependsOn)">
<!--This is a phase separation point-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_WebPublishPipelineDeployPhase"
LogType="Message" />
<!--<Message Text="Pipeline Deploy Phase" />-->
<CallTarget Targets="$(OnAfterPipelineDeployPhase)" RunEachTargetSeparately="False" />
</Target>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment