How to emulate the Publish action of Visual Studio in Azure pipeline on Linux self hosted Agent

94 Views Asked by At

We have a project in c# we want to deploy using Azure Pipelines.

When I publish the project in Visual Studio 2019, I get the following structure:

bin\Release\net5.0\publish
 -> FolderA
    -> files
 -> runtimes
    -> files
 files

When I use the DotNetCoreCLI@2 task with , I get a different structure of files:

publishFolder
 -> runtimes
    -> files
 files

"Folder A" is missing, so launching the service fails.

this is my task in the pipeline:

    - task: DotNetCoreCLI@2
      displayName: Publish API
      inputs:
        command: 'publish'
        publishWebProjects: false
        projects: AzureDevOps.Api/AzureDevOps.Api.csproj
        arguments: '--output  $(Build.ArtifactStagingDirectory)/API  --configuration Release --self-contained true -r linux-x64'
        zipAfterPublish: false
        modifyOutputPath: true

we are building on a self-hosted Linux (Kubuntu) agent.

Any suggestions?

1

There are 1 best solutions below

1
Kareem Adel On

include FolderA and have the subfolders present, set self-contained to true in your Azure Pipelines YAML task

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
  <OutputPath>bin\Release\net5.0\publish\FolderA</OutputPath>
</PropertyGroup>

&

arguments: '--output $(Build.ArtifactStagingDirectory)/API/FolderA --configuration Release --self-contained true -r linux-x64'