0

I am trying to deploy my code from Azure to my local machine. The steps I followed:

  1. Created deployment group
  2. Run register script on my machine(the folders successfully created in C:\azagent)
  3. Created pipeline.

For pipeline the generated YAML is:

# 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: NuGetCommand@2
  inputs:
    command: 'restore'
    restoreSolution: '**/*.sln'
    feedsToUse: 'select'
    vstsFeed: 'a31f9237-4431-41f2-b1a9-4370c7dc4828/a3a86133-79b3-437a-bc19-9665a420de4e'
- task: VSBuild@1
  inputs:
    solution: '**\*.sln'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'
    restoreNugetPackages: true

- task: CopyFiles@2
  inputs:
    SourceFolder: '$(build.sourcesdirectory)'
    Contents: '**\bin\$(BuildConfiguration)\**'
    TargetFolder: '$(build.artifactstagingdirectory)'
    CleanTargetFolder: true
    OverWrite: true
    
- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'drop'
    publishLocation: 'Container'

When I run the pipeline, it doesn't give any error but in release part I get an error: Error

The solution I am using has multiple projects. I need to deploy three projects on my machine. This is the first time I am using Azure DevOps and I don't have any clue about the error. Online articles are mostly explaining about cloud deployment and I could not find much about on-premise. In short my requirement is to deploy three projects from my repo on my local machine whenever I push any changes to master branch. Is there any step by step guide to achieve the same? What is the step I missed in the setup? Any help is much appreciated.

astm1982
  • 105
  • 10

1 Answers1

0

According to the description of the error message, first you need to check whether the corresponding build pipeline is selected as the release artifact source.

enter image description here

Then you can check whether the download artifacts path is consistent with the file path to the package(Package or Folder) of the IIS web app deploy task.

enter image description here

System.DefaultWorkingDirectory : The directory to which artifacts are downloaded during deployment of a release. The directory is cleared before every deployment if it requires artifacts to be downloaded to the agent. Same as Agent.ReleaseDirectory and System.ArtifactsDirectory. Example: C:\agent\_work\r1\a

For details, please refer to predefined variables document.

my requirement is to deploy three projects from my repo on my local machine whenever I push any changes to master branch.Is there any step by step guide to achieve the same?

To achieve this , in yaml build pipeline ,you need to set CI trigger: Continuous integration (CI) triggers cause a pipeline to run whenever you push an update to the specified branches.

In release pipeline , you need to set build pipeline as release artifact source, and then enable Continuous deployment trigger: This instructs Azure Pipelines to create new releases automatically when it detects new artifacts are available.

Hugh Lin - MSFT
  • 13,157
  • 1
  • 8
  • 18
  • Thanks. The issue was there was nothing generated in the artifacts. Your solution guided me enough to achieve the goal. I am almost there(deploy only the project which was changed, not all the three at once) but will ask here if I need your help. – astm1982 Jul 25 '20 at 13:03