I am trying to cerate Azure DevOps Build pipeline for WinForms desktop app and the problem is I can't publish the app and also can't cerate the build artifact.
I have created one WinForms desktop application and trying to create continuous integration (CI) pipeline in Azure DevOps.
I have selected the .NET Desktop template to configure the continuous integration (CI) pipeline. It is restoring NuGet and build solution successfully.
Now I want to publish the WinForms .NET Desktop application and generate the build artifact. I have tried it with the following task (as mention in https://developercommunity.visualstudio.com/content/problem/337714/can-build-code-but-release-pipeline-says-no-artifa.html)
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
Following is my complete yml code:
trigger:
- master
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)'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: CopyFiles@2
inputs:
SourceFolder: '$(System.DefaultWorkingDirectory)\DesktopApp\bin\'
Contents: '**'
TargetFolder: '$(System.ArtifactsDirectory)'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
It cannot generate artifact which I can download or use to release pipeline.
Needs help I cannot find how to publish the WinForms .NET Desktop application and generate the build artifact.
The main goal is to save publish app with setup and release folder of the desktop application at any location on my machine.
Can anyone help me out please?
I want to publish the WinForms desktop application and want that publish as artifact which I can download and save published app with setup of the desktop application at any location on my machine by the release pipeline
If you want to publish the WinForms desktop application, so that you can download and save published app with setup of the desktop application at any location, you need to publish the output of publish, not the build.
So, to resolve this issue, you need provide the "/target:Publish" argument to MSBuild when it builds your project. Here is what this looks like in Azure Devops:
If the build fails with an error relating to an expired certificate or pfx file, see the other blog post on importing the required certificate on the build server at build-time, which involves adding one more “Import-PfxCertificate.ps1” build step before the MSBuild step.
Here is a great document show how to Continuously Deploy Your ClickOnce Application From Your Build Server.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With