How to build Visual Studio Installer Project in Azure Pipelines in Self-Hosted Windows Agent - azure-devops-self-hosted-agent

The image above shows my Hello World project structure. I am trying to build the Setup-HelloWorld-x86.vdproj in Azure Pipeline in Self-Hosted Windows Agent (which is nothing but my local machine) by using the command line script task like shown in below image.
But I get the following error.
Kindly help me to build this Setup-HelloWorld-x86.vdproj

If you want to run the project via cmd devenv, you can refer to this doc.
As a workaround, you can install the extension Build VS Installer and use the task DutchWorkz - Build VS Installer(s) to build Visual Studio Installer Project in Azure Pipelines.
You can specify to build .sln or .vdproj to generate .msi file(s) in Task-mode option.
Update1
Thanks Tharunavignesh J for sharing.
The solution was to run the azure agent under proper account. Earlier my azure agent was running under some Network Service account, then I change it to the local account, then this cmd worked properly.

This other stack overflow link helped me get my visual studio installer project compiled with Azure DevOps pipelines. It is using yaml configuration instead of classic, but same steps / commands apply to both:
YAML Script for building Visual Studio Installer Projects using Azure DevOps
Basically the steps are:
Setup your variables to point to the tools
Download Nuget packages for your solution
Disable Out Of Process Builds command executed
Script task with the command line arguments to build your solution

Related

Does anyone know how to use the Doxygen Tool in Azure DevOps?

Specifically I need the yaml for the build definition. I already have Doxygen and Latex installed on the agent machine. Also, I can create Doxygen documentation for the C# Restful API manually using the tool.
Does anyone know how to use the Doxygen Tool in Azure DevOps?
To use the Doxygen Tool in Azure DevOps, we need to install required softwares on agent machine:
Doxygen tool should be installed on the Build agent machine
(download)
PdfLatex tool should be installed on the Build agent machine.
Then add the task Documentation (Doxygen) in the build pipeline to generate the documentation from source code in your repository. On successful generation, the task uploads the file as Build artifact so that it can be downloaded at later time:
Note: This extension doesn't works with Hosted build agent as of now. So, please use a locally configured build agent.
Besides, if you want to generate YAML documentation, you could try to use the extension YAML Documentation Generator.
Hope this helps.

Integration of BackstopJS into a VSTS build pipeline

At the moment I am trying to integrate the npm backstopjs into my VSTS build pipeline. To do this, I have to run it on an npm live server to get a screenshot of the actual build of the app and compare it to the reference screenshot. I tried to start this live server with a PowerShell script. This script cannot find the path to the npm root path so I cannot run the tests.
My question is: Is there a way to run BackstopJS tests with VSTS?
Edit
For the better understanding, here are some screenshots of my project:
Since Hosted VS2017 agent is the build machine provided by VSTS server, you should build VSTS with the privarte agent which located in the same machine of your live-server, so that the the build project can be searched.
And more details about deploying a private agent, you can refer the document Deploy an agent on Windows.

VSTS build agent can't download VSTS private packages

I am trying to add a build definition for a project that has private nuget packages hosted in VSTS. The local build works just fine but when I try to build it with an on premise build agent I get the following error:
The agent runs behind a proxy and in the build definition i have the following settings:
This is driving me mad please HELP !
The issue should related to your network environment on your build agent, such as firewall, proxy. You could also give a try with using the same Nuget task on an agent which has Visual Studio installed and in the same network environment, this will narrow down the error related to the proxy or not.
Workaround:
1) Copy nuget.exe to c:\nuget folder then added the folder to the PATH environment variable.
2) Copy nuget.exe to C:\B\1_tool\NuGet\4.0.0\x64 folder.
3) Create a dummy file called x64.complete in the {agent work folder}_tool\NuGet\4.0.0 folder and copy the nuget.exe file in the {agent work folder}_tool\NuGet\4.0.0\x64 folder.

DACPAC Deployment in VSTS

I want to create a dacpac file using VSTS. If I create a dacpac file and commit in VSTS to execute the scripts using Execute Azure SQL Tak:Dacpactask Azure database, we are unable to maintain the history of the changes. So I want to make the changes in SQL Project and move the project to VSTS. Do we have any task/way to generate a DACPAC file using sql project that we have in VSTS?. Finally I want to call that dacpac file using Execute Azure SQL Tak:Dacpactask to execute the scripts in Azure database
Refer to these steps below:
Refer to Grant’s answer to add project (not dacpac file) to source control and track changes
Create a new build definition
Add NuGet Tool Installer task (Version of NuGet.exe to install: 4.3.0)
Add NuGet task (Version:2.*; Command: restore; Path to solution, packages.config, or project.json: **/*sln)
Add Visual Studio Build task (Solution: [click … to select solution file]; Visual Studio Version: Visual Studio 2015; MSBuild Arguments: /p:OutDir=$(Build.ArtifactStagingDirectory))
Add Azure SQL Database Deployment task: (DACPAC File: $(build.artifactstagingdirectory)\**\SQLDatabase.dacpac)
In order to track changes you just have to connect your database project to whatever source control system you're using. It's a fundamental part of Visual Studio. You can just do that. Once it's connected to source control, you can then automate builds from the source control system using all the other Visual Studio tools. Here's an example that seems fairly complete. The next step is to integrate through the deployment processes in VSTS to automate the whole thing.

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
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.
To build and deploy the way as you used in VSTS, you can use below steps:
Create a repository (Git or TFVC) and push your solution in the repository.
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.
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.