8

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

riQQ
  • 9,878
  • 7
  • 49
  • 66
Sujit Singh
  • 752
  • 1
  • 9
  • 23

2 Answers2

4

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.

dayneo
  • 482
  • 5
  • 12
  • Hey Dayneo, thanks for the reply. I just edited my question to make it more clearer. I don't use ClickOnce, I use Windows setup and deployment. Can you go through my edited question and tell me how to proceed? Thanks. – Sujit Singh Sep 12 '17 at 08:01
  • 1
    The build system needs to have NSIS and SIGNTOOL installed. For this reason, I think you should setup an onpremise agent to do the build. VSTS will orchestrate the build, but the build will happen on your build server (this is how I do builds for things like Oracle DB). You should then use powershell tasks in your build sequence to run the custom steps that you need to package your app. I would say that the output artifact should be the signed EXE. Your deploy step will then be a simple copy of the EXE to the webserver. – dayneo Sep 12 '17 at 13:37
  • Looks like I am getting closer all because of your help. 1) setup an onpremise agent : Does it mean I can use my local machine for this or it has to be on cloud only? Is there any setup for on Premise Agent that I can run on my local machine and VSTS will know about it? Thanks. – Sujit Singh Sep 12 '17 at 17:44
  • VSTS Supports having an on-premise agent. That agent will run from any machine you deploy it to. It will need outbound internet access though. In VSTS you go to the settings and look for "Agent Pools". That will give you a way to download and install an Agent that will run on-premise and will communicate with VSTS in the cloud. And here is the manual: https://learn.microsoft.com/en-us/vsts/build-release/actions/agents/v2-windows – dayneo Sep 15 '17 at 11:30
4

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.

Marina Liu
  • 36,876
  • 5
  • 61
  • 74
  • Thanks, I installed "Build VS Installer" from the marketplace link provided by you. I also added it to my build task list, see image url https://1drv.ms/i/s!Ase2Dy0lrWBLl6Mdtbi8r9BDc-4XiA Now when I run the build it's giving devenv error, I tried changing few things but it's not working for me. I am using VS 2017 . See image url above – Sujit Singh Sep 13 '17 at 10:51
  • Can you add the Build VS Installer task fully build log (set `system.debug` = `true` in variables Tab) in your question? Since the log in screen shot is not enough. – Marina Liu Sep 14 '17 at 07:28
  • I was able to build it by adding a registry entry by following directions from this link http://www.kunal-chowdhury.com/2016/07/visual-studio-error-code-8000000A.html#zwIRz1vFHCAPrCU0.97 . Now I am able to create MSI. I will try next steps as suggested by you for NSIS, etc and let you know. Thanks. – Sujit Singh Sep 14 '17 at 11:05