My .sln consists of several projects (.cspoj) with a mix of targeting frameworks including .netcore and a selection of .net frameworks.
Some of these projects are web projects which need to be built and include other non-web projects in their packages.
This is essentially a teamcity to azure devops migration - I figured using vsbuild and then dotnetcorecli 'publish' would give me the required packages (publish command does find the correct webapps).
My issue is that after VSBuild I have oneproject.zip in my "artifact staging dir", the dotnet publish command afterwards, which is set to output into "artifact staging dir/publish", simply erases all content from "oneproject.zip" and then complains it cannot find "oneproject", please see the error output below the pipeline.
Here is my annotated and condensed pipeline
pool: selfhosted
using a self hosted agent, with msbuildtools/vs studio/node/npm
variables:
solution: '**/mainsolution.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Debug'
global variables
stages:
- stage: build_main
displayName: 'Build Main'
jobs:
using stages, to prevent overwriting source files by grouping tasks
- job: multijob
steps:
- task: NuGetToolInstaller@1
displayName: 'install nuget'
- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
command: 'restore'
restoreSolution: '$(solution)'
feedsToUse: 'select'
vstsFeed: 'myvstsfeed'
installing nuget, and restoring from an azure artifacts feed
- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
inputs:
command: 'restore'
projects: '**/mainsolution.sln'
feedsToUse: 'select'
vstsFeed: 'myvstsfeed'
VSBuild - Building the main .sln which references all .csproj's, and a separate MSBuild for another odd project.*
- task: VSBuild@1
displayName: 'Build Solution'
inputs:
solution: '$(solution)'
msbuildArgs: '
/p:DeployOnBuild=true
/p:WebPublishMethod=Package
/p:PackageAsSingleFile=true
/p:SkipInvalidConfigurations=true
/p:PackageLocation="$(Build.ArtifactStagingDirectory)"'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
- task: VSBuild@1
displayName: 'Build oddproject'
inputs:
solution: '**/oddproject/oddproject.csproj'
msbuildArgs: '
/p:DeployOnBuild=true
/p:WebPublishMethod=Package
/p:PackageAsSingleFile=true
/p:SkipInvalidConfigurations=true
/p:PackageLocation="$(Build.ArtifactStagingDirectory)"'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
This is the problem, my publish step
- task: DotNetCoreCLI@2
inputs:
command: 'publish'
publishWebProjects: true
arguments: '--configuration $(BuildConfiguration) -o published'
##[debug]Zip arguments: Source: published\oneproject , target: published\oneproject.zip
##[error]Error: ENOENT: no such file or directory, open 'A:\agent_work\2\s\published\oneproject.zip'
- why is it looking for a source directory in my output folder and not a .zip from VSBuild's output?
- why does it delete the zip files contents?
- I was unable to specify vsbuild to output into the filesystem without zipping.
- trying an extract command failed, as the zip is extracted excluding the project name (straight to content). Also using a ramdisk for my _work, so would prefer a more memory managed approach.
I really appreciate any inputs or critique on this. Let me know if there's anything useful I can provide as well. <3