Reputation: 401
I am trying to build a solution using CI pipeline. It is an old ASP.NET Web Forms Site. The yaml file is as follows
trigger:
- main
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
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: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(build.artifactStagingDirectory)'
ArtifactName: 'PublishBuildArtifacts'
After build nothing is copied to artifact 'PublishBuildArtifacts' and I see a message "Directory 'D:\a\1\a' is empty. Nothing will be added to build artifact 'PublishBuildArtifacts'." My understanding is that via PackageLocation property the package would be in artifactstagingdirectory folder which should be published in the next step. What am I missing here? Do I need to use copyfile task? If so what would be the source and target folders? Thanks
Upvotes: 0
Views: 566
Reputation: 19361
You may add CopyFiles task before PublishBuildArtifacts
task :
- task: CopyFiles@2
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
inputs:
SourceFolder: '$(agent.builddirectory)'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(build.artifactStagingDirectory)'
ArtifactName: 'PublishBuildArtifacts'
Upvotes: 2