0
votes

I have an Azure build pipeline, and a Publish task:

- task: DotNetCoreCLI@2
  displayName: 'dotnet publish'
  inputs:
    command: 'publish'
    projects: '**/MyProj.csproj'
    arguments: '--configuration $(buildConfiguration) --output $(build.artifactstagingdirectory)\webjob\App_Data\jobs\triggered\MyProjWebJob /p:AssemblyVersion=$(GitVersion.AssemblySemVer)'
    zipAfterPublish: false
    publishWebProjects: false

As you can see I am specifying an output directory - it is for a webjob and I have to have this format. The problem is, that the publish adds another directory with the name of the project:

$(build.artifactstagingdirectory)\webjob\App_Data\jobs\triggered\MyProjWebJob\my.proj.webjob

and it puts all the artifacts in there, but I do not want this additional directory - when I deploy it can't be there or the webjob isn't accessible. How do I publish without creating this directory?

1

1 Answers

0
votes

As usual, these things are always very simple when you know how:

you simply need this additional section in the inputs section

modifyOutputPath: false

The default is true, so without it, a directory will be created - usually you would want this but for this scenario I didn't.