0
votes

How do I get azure devops to publish my .net core webapi folders to my hosted site?

My yaml pipeline file is as follows

    # ASP.NET Core (.NET Framework)
    # Build and test ASP.NET Core projects targeting the full .NET Framework.
    # Add steps that publish symbols, save build artifacts, and more:
    # https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core

    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: DotNetCoreCLI@2
      inputs:
        command: 'build'
        #projects: '**/*.csproj'
        projects: 'StockPoint.csproj'
        arguments: '--configuration $(BuildConfiguration) --output $(build.artifactstagingdirectory)'

    - task: DotNetCoreCLI@2
  inputs:
    command: 'publish'
    publishWebProjects: false
    projects: '**/xxxx.csproj'
    arguments: '--configuration $(BuildConfiguration) --output $(build.artifactstagingdirectory) --self-contained -r win-x64'
    zipAfterPublish: false
    modifyOutputPath: false


    - task: DotNetCoreCLI@2
      inputs:
        command: test
        projects: '**/*Tests/*.csproj'
        arguments: '--configuration $(buildConfiguration)'

    - task: PublishBuildArtifacts@1
      inputs:
        PathtoPublish: '$(Build.ArtifactStagingDirectory)'
        ArtifactName: 'drop'
        publishLocation: 'Container'


    - task: FtpUpload@2
      inputs:
        credentialsOption: 'inputs'
        serverUrl: 'ftps://187.4.47.6'
        username: 'calasagoolsa'
        password: 'rdfx@m79M9aaax'
        rootDirectory: '$(build.artifactstagingdirectory)'
        filePatterns: '**'
        remoteDirectory: '/service.xxxxxxx.com/'
        clean: false
        cleanContents: false
        preservePaths: false
        trustSSL: true

This all publishes and deploys. However the site does not work afterwards and I noticed that when I deploy from Visual Studio it uploads around 600files which include folders like cs,de,es etc. These folders exist in the publish location on devops but the ftp upload only uploads 400 files and none of those folders are there.

I have a feeling it is something to do with the rootDirectory path but all the examples I have seen use the same path.

1

1 Answers

0
votes

It is probably wrong configuration FtpUpload@2 task. Please change preservePaths to true.