I'm trying to build aspnetcore artifact for a solution with multiple web projects inside. Default netcore publish task has checkbox "Publish Web Projects" that finds all projects containing web.config or wwwroot folders, but my WebApi projects doesn't need them at all. You can disable this checkbox and provide paths to projects you want to publish. Each project must be provided in separate line.
So, if I edit this setting in task properties window, everything is ok, cause there is multiline editor that behaves as expected. But I want to move list of projects to variables, were all other configuration is stored. However variable's editor is singleline.
I've decided to put project names in variable with ";" delimiter and write powershell task that properly constructs paths for publish task:
$projects = '$(PublishProjects)'
$result = ( $projects.Split(@(';'), [System.StringSplitOptions]::RemoveEmptyEntries) | %{ ('**\' + $_.Trim() + '.csproj') } ) -join "`n"
Write-Host "##vso[task.setvariable variable=PublishProjectsPath]$result"
Unfortunately this results in setting PublishProjectsPath`s value to only first project, cause all project paths except first one are printed on their own line without ##vso... and so azure ignores them effectively.
Is there any way to set pipeline variable from script correctly? I cannot use azure-pipelines.yml cause azure doesn't support gitlab :(