how to make azure devops release pipeline click once - azure

I have a simple executable, that I have build and unittested in a build pipeline.
now I want to install it on some test machines and run some tests on the app, before releasing it to production. (eventually I hope to automate the tests with specflow, but that is the next step)
So basically I have an helloworld.exe build, that I want to be installed from a pipeline to at test agent computer.
I think clickonce is the optimal option, but am unsure how to set it up on azure devops. (we use a server on premises)

Msbuild has Publish target to build and publish the ClickOnce application. It will generate the setup.exe you want. Please check document: Create and build a basic ClickOnce application with MSBuild. In release pipeline you can use msbuild task or Visual Studio Task with Publish target(/t:Publish as argument).
Then you'll get one app.publish folder where the files you want exist there:
This folder can be used for your further deployment.
Here is a ticket you can refer to .
In addition, azure devops Marketplace provides some extension: ClickOnce Packager, ClickOnceMore DevOps Pipeline Task.

Related

How to build and deploy dacpac in azure devops

I am new to Azure devops. Here I have a requirement to do dacpac file build and deployment in Azure devops.can anyone help me to share me the step to step procedure.
I am using visual studio 2017.
Thanks
How to build and deploy dacpac in azure devops
You can use build pipeline to build that and then deploy it using release pipeline.
1.If you developed the sql server project by VS, you can publish it to Azure Devops Repos following this document.
2.Then create a build pepeline following this, you can use classic UI editor without YAML to configure your pipeline.
1) Select the Azure Devops Git as source. And choose the sql server project published from VS.
2) Choose the agent you want to use in Agent Job, Hosted agent or Private agent.
3) Click the + in Agent Job to add a task. You can choose the Visual Studio build task, this task will call msbuild.exe to build your sql server project.
3.To deploy the output of sql server project, there're many choices. One is to use Windows Machine File Copy task to deploy the files in current agent to destination folder in remote machine. You can use this task in Release or even Build Pipeline to do that.
Hope it helps and if I misunderstand anything, feel free to contact me.

Azure Pipeline : How to release Project binary file into Azure machine

Azure DevOps Pipeline : How to release Project binary file into Azure.
How can I deploy project binary files into server using Azure Pipeline, don't want to release project full source code?
You would do something like this.
create a deployment group
create a build, configure it
create a release, configure it (get artifacts from build, deploy to deployment group)
These are the steps you need to perform. link has more information on this matter

VSTS: Deploying to Azure based VM

I'm setting up a test pipeline using VSTS and now I have my builds working using an Azure VM as a build agent, I want to also deploy to that machine.
I've tried using the Windows File Copy and IIS deploy tasks but understand this isn't a very good solution for security reasons, so wondered what the best task to use would be to get the build/release agent on the machine to copy the artefacts to the Azure based VM and deploy locally to its IIS install?
I'd suggest that you strongly reconsider not deploying your application to your build agent. This will make it extremely difficult to find issues due to missing DLLs or files because the build server has everything. I suggest either creating another VM to deploy to or leverage Azure's PaaS for web applications.
With all of that said, because you are working locally on the same VM, you can simply leverage the Copy Files task to move the files to where they need to be. To "deploy" the application, you can simply copy the output of the website to the IIS directory.
Another option would be to create a PowerShell script that would setup, configure and deploy the application to the local machine. In which case, you could simply leverage the PowerShell task.
The source (Get sources section in build definition) will be download to build agent automatically during the build, so you don’t need to copy the files to that machine through Windows File Copy task, the simple workflow is that:
Add NuGet task to restore packages
Add Visual Studio Build task (MSBuild Arguments: /p:SkipInvalidConfigurations=true /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageLocation="$(build.artifactstagingdirectory)\\web.zip" /P:PackageTempRootDir="")
Add WinRM-IIS Web App Deployment task: (Web Deploy package: $(Build.ArtifactStagingDirectory)\web.zip)
As virusstorm said that you can copy files to other path on that machine through Copy Files task.
On the other hand, by default the artifact will be downloaded to the target machine if you are using release and you can consider Deployment groups if the deployment machine is different with the build agent machine.

How to deploy Azure WebJob as part of automatic VSTS deployment

Is there a way of having my Azure WebJob automatically deploy without needing to right click and select "Publish as Azure WebJob" every time? i.e. when I check-in my solution it is automatically deploy to the Azure Portal webjob section
While I tried to accomplish this, I found out that there is no tooling support for dotnet core projects as of now. The proposed webjobs.props/ msbuild solutions are all dotnet framework specific.
However I also found out that a webjob can be anything that's executable on the local machine (could be node.js or just a batch command).
The key is to understand how WebJobs are recognized by the host:
A WebJob on a Windows host is (by what I gathered from experimenting with it) just a run.cmd file that contains instructions on how to start the webJob. For dotnet core that would be dotnet MyDll.dll %* (%* to pass arguments for output redirection etc. down from the host).
Now depending on wether the job is continuous or triggered the run.cmd file needs to be located either at app_data/jobs/continuous/[NameOfJob] or app_data/jobs/triggered/[NameOfJob]. For the triggered job you could also add a schedule using a settings.job file like described here.
If there is a run.cmd at the proper location it will be recognized as a WebJob
Now to deploy a webjob using VSTS regardless of the runtime framework follow these steps:
Build/Publish your WebJob if necessary to get the executables
Add a run.cmd file next to your webjob executables that contains the proper startup instructions. You could also add settings.job here if needed.
Create the folder hierarchy app_data/jobs/[triggered/continuous]/[nameOfJob] and copy your executables into the lowest folder. Make sure run.cmd is directly under the [nameOfJob]/ directory
Zip the app_data folder so that the zip-package contains the entire hierarchy
Publish your zip file using the normal Azure App Service Deployment task (just like deploying the web app)
And that's it.
Yes you can.
Brady Gaster has written about this on a blog post (haven't tried it myself).
From what I gather, the TL;DR; summary is the following:
add a file named webjobs.props to the properties folder of the Web Application Project or Console Application you’re publishing
After that, edit the file so the ManagementCertificate, SubscriptionId and PublishSettingsPath are filled with correct data.
Now you should be able to publish the files using the command
msbuild WebJobDemo.Web.csproj /p:DeployOnBuild=true /p:PublishProfile=WebJobDemo /p:VisualStudioVersion=12.0 /p:Password=asdfasdf
(Note, post is written for VS2013)
Afterwards you should see something like this.
You could of course automate this in VSTS (or any other build/deployment tool for that matter) whenever something is checked in to your repository.
A (rather complete) answer on how to do this in VSTS via the command-line can be found in this answer: https://stackoverflow.com/a/45703975/352640
You can do it through Continuous Integration Build (trigger the build once check in).
Regarding deploy WebJob, you can generate a package through Visual Studio Build task with /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.stagingDirectory)" argument.
Then deploy it through Azure App Deployment task.
More information: Deploying and Schedule Azure WebJobs from VSTS to Azure Web App
In Visual Studio in order to enable automatic WebJobs deployment together with a Web project right-click the Web project in Solution Explorer, and then click: Add > Existing Project as Azure WebJob and create your WebJob.
More details can be found in an article by MS - webjobs-dotnet-deploy-vs

Azure App Service Continuous Deployment with VSTS

I have set up Azure continuous deployment from a branch in my Visual Studio Team Services GIT Repository. Everything is working fine however I would like to run a few gulp tasks before the actual deployment takes place. Is there a way how I can do this?
Azure provides continuous deployment out of the box through the use of several sources of your code. What you will need will be more in the side of continuous integration, running tasks and flows to build the code.
There are many ways and tools of doing continuous integration, nevertheless the most compatible to do this in Azure would be within the build and release parts of Visual Studio Team Services.
Within your Azure subscription you can setup this following the next steps(it seems you have already setup your code in Visual Studio team services, then you can skip to step 3):
Creating a VSTS project
Putting your code in a Git Repo inside VSTS
Creating a Build definition
Adding your tasks from the Catalog
Adding and configuring your Gulp Tasks
Deploying the build to Azure

Resources