Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSTS CI CD for desktop apps

How can I achieve CD (Continuous Delivery) for winform applications in VSTS (Visual Studio Team Services)? Currently this is what I have in my Visual Studio Solution file

1) A winform project

2) A Windows setup and Deployment project

So every time I build a winform project, I do the following steps (and I need CI / CD for exactly these)

1) Build Setup and Deployment project, which takes Build output of Winform project and creates and EXE / MSI

2) I take this MSI file and use NSIS to embed it inside EXE

3) I run SIGNTOOL from command prompt and digital sign the EXE

4) I upload this signed EXE to my website

Now how can I use CI / CD pipeline to automate the above or is it not possible for my case? I am confused. I can't find any material for winforms, all are for web apps.

Thanks

like image 936
Sujit Singh Avatar asked Sep 11 '17 11:09

Sujit Singh


2 Answers

You will obviously need some sort of desktop deployment strategy. The easiest is to be using xcopy. Other alternatives include frameworks like ClickOnce, Windows Installer or Squirrel to name a few. I have a number of corporate apps that use Clickonce that I have deployed using vsts.

Now I am unable to understand how will VSTS help me with this?

Use VSTS to build the software first and include additional tasks to package your app. In my case, I use devenv.exe to generate ClickOnce packages, but you can include custom tasks by using powershell. The artifact of the build should now be the "packaged app". Then use the VSTS deployment to copy the "package" to some kind of hosting server from where your users can download the package. That could be either a web server or a fileserver or any location appropriate for your deployment strategy.

In this context, VSTS is an orchestration tool. It helps to trigger actions for you.

See Deploy an agent on Windows to see how to setup an on-premise agent.

like image 66
dayneo Avatar answered Nov 17 '22 00:11

dayneo


To build and deploy the way as you used in VSTS, you can use below steps:

  1. Create a repository (Git or TFVC) and push your solution in the repository.
  2. Add build/release definitions.

    With CI build, enable the Continuous Integration in Triggers Tab. With CD deploy, enable Continuous deployment trigger in Pipeline Tab. The process for CI build and CD deploy, you can refer CI/CD.

  3. Add related tasks in your build/release definition.

    • Build VS Installer task: build setup project with msi file.
    • Nsis Build Task: embedded msi file in exe.
    • Command Line task: to execute the signtool command. Since Hosted agent has not signtool.exe, so you should use private agent which has the signtool.exe on the machine.
    • Copy files task, Copy Files Over SSH task or Windows Machine File copy task: upload the file exe to your web server.
like image 4
Marina Liu Avatar answered Nov 16 '22 23:11

Marina Liu