How to generate deployment files Azure DevOps - TFVC - azure-devops

I have hosted ASP.NET Core and .NET Windows application to DevOps Services - TFVC (Cloud)
Now, I am stuck with how to generate deployment files, like debug folder of .NET Windows app or cloud hosting files of ASP.NET Core.
I have created a pipeline to generate deployment files, but how can I execute from the local machine so that developer can get the necessary files to host or install?
Thanks.

Since you have created a pipeline to generate deployment files, you could add a archive task and a Publish build artifacts task to publish the target files.
Archive files: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/archive-files?view=azure-devops
Publish build artifacts: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/publish-build-artifacts?view=azure-devops
So the developers could download the .zip files from the pipeline summary page to host and use.

Related

Azure DevOps deploy Angular app to IIS with Octopus

I'm trying to deploy a Angular application to my IIS server using Octopus and Azure DevOps
My application has multiple environments, each environment with it's own settings (config.prod.json)
What I want to do
Basically Octopus should take the release from Azure DevOps, and copy the release to multiple folders, with different config.prod.json files.
Each folder corresponds to a specific IIS website.
Azure DevOps pipeline setup
Use Node 14.x
npm install
ng build --prod
Archive dis/angular-app ; Archive type: zip
Publish Artifact; Path $(Build.ArtifactStagingDirectory)
Triggers : Enable continuous integration
Azure DevOps Releases setup
1. Package Application for Octopus
2. Push Package(s) to Octopus
3. Create Octopus Release
Octopus setup
One step DEPLOY TO IIS
1. Package details
2. Custom Installation Directory
[![enter image description here][5]][5]
3. IIS Web Site and Application Pool
Errors
In IIS while I click Binding, Basic settings, I get this error: There was an error while performing this operation. The parameter is incorrect
Also, the folder mapped in iis for the website that I'm targeting. Contains a folder drop with the zip file 27.zip (27 is the release id)
How do I unzip the zip file?
How do I replicate the zip file to the other environments?
Is my configuration ok so far? What am I doing wrong?
Just a few of the links that I've checked:
https://octopus.com/docs/guides/deploy-aspnetcore-app/to-iis/using-octopus-onprem-azure-devops-builtin
https://www.youtube.com/watch?v=NFqrWsUPCAM&t=345s
https://www.youtube.com/watch?v=oeNYtYuhZQ4&t=2s

ClickOnce deployment on Azure DevOps release pipeline

I am trying to create ClickOnce deployment on Azure DevOps release pipeline
I create signature, manifest, application, deploy files with certificate
But how can I create the exe and setup file (via Azure DevOps release pipeline)
But how can I create the exe and setup file (via Azure DevOps release
pipeline)
Check document Build ClickOnce applications from the command line: Msbuild has Publish target to build and publish the ClickOnce application. It will generate the setup.exe you want. See similar hint here.
And all above is about doing that in local machine, to do similar job 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.
In addition:
If you meet error like Unable to find manifest signing certificate in the certificate store, please check the suggestions in this issue.

How do I deploy azure funtion app packaged as .nugpk using azure devops?

I have a build pipeline that generates .nupkg for azure function, when I try to release it the content gets deployed (I can see when I download the app content) but I cannot see the function.
Is it the case that azure artifact has to be .zip for azure function? I am able to deploy the angular and .net core app using .nupkg without any problem!
Is it the case that azure artifact has to be .zip for azure function?
You re right.
Currently, only .zip package files are supported.
That because:
Zip deployment is a feature of Azure App Service that lets you deploy
your function app project to the wwwroot directory. The project is
packaged as a .zip deployment file. The same APIs can be used to
deploy your package to the d:\home\data\SitePackages folder. With
the WEBSITE_RUN_FROM_PACKAGE app setting value of 1, the zip
deployment APIs copy your package to the d:\home\data\SitePackages
folder instead of extracting the files to d:\home\site\wwwroot.
You could check the document Run your Azure Functions from a package file for some details.
And there is state about that:
Hope this helps.

dotnet core 2.0 webjob deployment - VSTS

I want to deploy my webjob ( dotnet core 2.0 commandline application ) through 'release' defination. My drop folder contains webjob named 'MyWebjob.zip'. I want to copy this to my webapps below directory where all tasks exists
D:\home\site\wwwroot\App_Data\jobs\continuous>
Below is snap of of my existing release defination
Can anyone tell which copy job is suitable to copy contents from drop folder to 'wwwroot\App_Data\jobs\continuous' direcotry?
Or is there any easy way to deploy webjob ( dotnet core 2.0 ) using VSTS?
Note: I can't use FTP for some reason as 'Continuous Integration' is enabled for our project.
You can’t use these tasks to deploy webjob.
If you remain the folder structure (App_Data\jobs\continuous) in MyWebjob.zip file, you can deploy it to azure web app through Azure App Service Deploy task (App type: Web App; App Service name:[your app service]; Package or folder:[that zip file]; Check Publish using Web Deploy option).
Otherwise, I recommend that you can do it through Extract files and Copy files to organize the folder structure, then deploy through Azure App Service Deploy task (Package or folder:[App_Data parent folder]; Uncheck Publish using Web Deploy option).
You also can upload files through Kudu API (Extract zip file through Extract files task first)
There are some threads that can help you to call Kudu API in VSTS.
Remove files and foldes on Azure before a new deploy from VSTS
How to access Kudu in Azure using power shell script
You can add a custom target to your worker .csproj file.
<Target Name="UpdateWebJobsPublishDir" BeforeTargets="ComputeFilesToPublish">
<PropertyGroup>
<PublishDir>$(PublishDir)App_Data/jobs/continuous/$(ProjectName)/</PublishDir>
</PropertyGroup>
</Target>
The above vill update the output dir before it is publised. In VSTS/Azure DevOps you just deploy you project as normal webapp it will be put in the right folder.

VSTS: Release Management Deploying Artifacts to IIS on Premise

I am using VSTS Release management to deploy artifacts to IIS websites. I have several Web applications and web services to be deployed. So, i am trying to figure out what sort of tasks that best fits my situation.
I have created a build definition with Visual Studio Build Task for projects as this one:
which works fine but i need to add a task for copying the artifacts Under IIS Website Directory.
The other approach is to use IIS web deployment as a task in Release definition, so I created the build definition as:
However, it expects a Publish Profile (the build fails because it can't find it). I don't need to create a publish profile for each project in the application because this would be too much work.
Is there is a workaround for that or what is preferred approach for this?
You can update your build definition to generate a web deployment package and upload it to artifacts. And then in Release Management, add a task to run "projectname.deploy.cmd" in the deployment package to deploy it to your IIS server. Refer to this link for details: How to: Install a Deployment Package Using the deploy.cmd File Created by Visual Studio.
And you can also enable FTP Publishing on your IIS server and add a task in your release to publish the artifacts via FTP. You may need this task:
FTP Uploader.
My Continuous Delivery with TFS / VSTS – Server Configuration and Application Deployment with Release Management blog post (with reference to some previous posts) has all the details you need for deploying your artefacts to target nodes using Windows Machine File Copy tasks then use PowerShell on Target Machines tasks to get them in to correct locations and to do token replacement and anything else that's required.
I would recommend using PowerShell DSC so that IIS is properly configured before deployment but that's not required. Where possible for web apps I favour keeping things very simple by creating artefacts that contain all the web files that are needed for a particular folder and then just using plain xcopy for the deployment.
If you need more control you can also use my MSDeploy VSTS extension to deploy a MSDeploy package
https://marketplace.visualstudio.com/items?itemName=rschiefer.MSDeployAllTheThings
https://dotnetcatch.com/2016/04/20/msdeployallthethings-vststfs-extension-is-public/