According to MSDocs here, there is a task to publish .NET Core with arguments.
dotnet publish --output $(Build.ArtifactStagingDirectory)
But I have a .NET Framework application, not .NET Core, which means i use MSBuild task not dotnetcore task to build .NET. so i checked out the .NET Framework page and there's literally no information about publishing .NET Framework app...
Does this mean that the same dotnetcore tasks apply/can be used for .NET Framework app then??
steps:
- task: DotNetCoreCLI@2
inputs:
command: publish
publishWebProjects: True
arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)'
zipAfterPublish: True
# this code takes all the files in $(Build.ArtifactStagingDirectory) and uploads them as an artifact of your build.
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'myWebsiteName'
The following build works on the ubuntu build agent:
The yaml definition:
steps:
- task: NuGetToolInstaller@1
displayName: 'Use NuGet '
- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
restoreSolution: '<my_path>.sln'
- task: MSBuild@1
displayName: 'Build solution <my_path>.sln'
inputs:
solution: '<my_path>.sln'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
- task: CopyFiles@2
displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
inputs:
SourceFolder: '$(system.defaultworkingdirectory)'
Contents: '**/bin/**'
TargetFolder: '$(build.artifactstagingdirectory)'
condition: succeededOrFailed()
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
condition: succeededOrFailed()