I have an Azure DevOps Pipeline which includes an Azure App Service Deploy task (AzureRmWebAppDeployment
) for deploying an ASP.NET Core 3.1 project:
- task: AzureRmWebAppDeployment@4
inputs:
ConnectionType: 'AzureRM'
azureSubscription: 'Azure Subscription(01234567-89ab-cdef-0123-456789abcdef)'
appType: 'webApp'
WebAppName: 'MyStagingSite'
packageForLinux: '$(Build.ArtifactStagingDirectory)/**/*.zip'
enableCustomDeployment: true
DeploymentType: 'webDeploy'
enableXmlTransform: false
enableXmlVariableSubstitution: true
RemoveAdditionalFilesFlag: false
The Azure App Service destination, however, contains files in several pre-established folders which are managed independent of the continuous delivery process. We would like to use the Remove additional files at destination flag (RemoveAdditionalFilesFlag
) while leaving those folders intact.
Disclaimer: I don't consider this a best practice and, in the future, we will be moving these files off to a separate storage location. Until then, I'd like to find a solution that will work resolve this.
In Visual Studio 2019, we achieve this by excluding those files from our publishing process using the MsDeploySkipRules
in our csproj
file:
<Project Sdk="Microsoft.NET.Sdk.Web">
…
<ItemGroup>
<MsDeploySkipRules Include="CustomSkipFolder">
<ObjectName>dirPath</ObjectName>
<AbsolutePath>wwwroot\\Uploads</AbsolutePath>
</MsDeploySkipRules>
</ItemGroup>
</Project>
This approach works well for Visual Studio and is honored by its web deployment publishing process. These rules do not appear to be honored by the AzureRmWebAppDeployment
task, however, even when using the "Web Deploy" deployment method (DeploymentType
).
Is there a way to honor the MsDeploySkipRules
when using the AzureRmWebAppDeployment
task? If not, if there a way to provide a list of folders which should be skipped or ignored as part of the deployment process? Or, alternatively, if there another task that will permit one of these options when publishing to an Azure App Service?
Note: I also posted this to the DevOps Beta, but as the site hasn't reached critical mass yet, I'm cross-posting it here.
Is there a way to honor the MsDeploySkipRules when using the AzureRmWebAppDeployment task?
Not sure if there's a way to apply MsDeploySkipRules but there's exising way to skip specidic files during the deplyment process.
For detailed information, please check Exclude/Skip files in VSTS Build and release .
As suggested in the above thread, add additional arguments
to your task to skip the specific files.
Fill your filepath in the skip argument. More information at Azure App Service Deploy task (press Ctrl+ F to search for additional arguments
) and Web Deploy Operation Settings for the syntax.
Please have a try and hope this could help.