Deploying ASP .NET app to FTP with Azure DevOps CI/CD pipeline
Introduction
In this post, I will show how to configure the Azure DevOps pipeline - to easily publish an ASP .NET app to FTP server. The core part of the pipeline is VSBuild and FTPUpload task.
How does the azure pipeline work?
Full azure-pipelines.yml YAML code
# ASP.NET
# Build and test ASP.NET projects.
# Add steps that publish symbols, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:DeployDefaultTarget=WebPublish /p:WebPublishMethod=FileSystem /p:SkipInvalidConfigurations=true /p:publishUrl=$(build.artifactstagingdirectory)\website'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: FtpUpload@2
inputs:
credentialsOption: 'inputs'
serverUrl: 'ftp://127.0.0.1'
username: 'ftp-user-name'
password: 'P@ssword'
rootDirectory: '$(build.artifactStagingDirectory)/website'
filePatterns: '**'
remoteDirectory: '/wwwroot' # '/wwwroot/$(Build.BuildId)/'
clean: false
cleanContents: false
preservePaths: true
trustSSL: false
To download the source code for this post, please visit GitHub
Comments
Leave a Comment