Adding files to build package artifacts - azure-devops

I'm following a learning course on plural-sight and he shows an artifact with cfg folder and json file within that folder(outside of the packge.zip file) but I cant figure out how he managed to configure his build process to get that file there.
How do I achieve this and where should i go to learn more about package files how they are made?

Everything in the "drop" folder gets included in the default "Publish Build Artifacts" Task, just add your files in the drop folder (or subfolders there).
The variable with the path is called: $(Build.ArtifactStagingDirectory)
This images shows a newly created "Publish Build Artifacts" task:
Something similar is probably creating your artifact, check for it in your build definition.

Related

Azure devops build pipeline

I have created a sample Website project with a single page having HellowWord.aspx and HellowWord.aspx.cs. I am trying to create an Azure DevOps build pipeline for this project. The following are the tasks I have added to my build package.
But the publish artifacts always contains the aspx and aspx.cs file. Not sure which tasks I am supposed to add to make the proper publish package. Which will create proper dlls for .aspx file instead of aspx.cs.
Publish build artifacts task has an argument Path to publish, which defines the folder or file path to publish. This can be a fully-qualified path or a path relative to the root of the repository. Wildcards are not supported. Variables are supported. Example: $(Build.ArtifactStagingDirectory). By default, this argument uses variable $(Build.ArtifactStagingDirectory).
So you need to check your Copy files task, to see what you have copied to $(Build.ArtifactStagingDirectory), and copy the correct files in this task.
https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/copy-files?view=azure-devops&tabs=yaml

What does "Package or folder" refer to in the File transform task in a release pipeline?

I'm completely new to Azure DevOps Pipelines so if I'm doing something incorrectly I'd appreciate a nod in the right direction... I setup a build pipeline and that seems to be working, now I'm trying to setup a release pipeline in order to run tests, it's mostly based on Microsoft's documentation:
https://learn.microsoft.com/en-us/azure/devops/test/run-automated-tests-from-test-hub?view=azure-devops
Before running tests I need to transform a config file to replace some variables like access keys, usernames, etc. What I setup is what I have below but for the life of me I can't figure out what text box Package or folder refers to. The documentation is super helpful as you can imagine:
File path to the package or a folder
but what package or what folder is this referring to??? I've tried several different things but everything errors with
##[error]Error: Nopackagefoundwithspecifiedpattern D:\a\r1\a\**\*.zip
or pretty much whatever I specify for a value.
The File Transform task supports the .zip files.
Test with the default File Transform task settings, I could reproduce this issue.
In Release pipeline, the file path could has one more node for the build artifacts .zip file.
The format example:
$(System.DefaultWorkingDirectory)\{Source alias name}\{Artifacts name}\*.zip
So you could try to set the $(System.DefaultWorkingDirectory)/**/**/*.zip in Package Or folder field
For example:
On the other hand, you can check the specific path in the Release log -> Download Artifacts Step.
$(System.DefaultWorkingDirectory): D:\a\r1\a
You could aslo use this specific path in the task.
Update:
If your file is Project Folder, you refer to the following sample:
File structure:
Task Settings:
Note:You only need to assign to the folder node.
You could also select the folder path via ... option.

How to get Web.config file in the root of a create-react-app project to copy to the build folder so it gets archived and deployed

I have a file copy task in my build to copy the Web.config in the root of my create-react-app project folder, and it shows that it is copying it to the build file after the yarn build task completes.
But it is never in the archived folder. How do I modify this build or copy files task to get this Web.config file into my build folder so that it can get archived and dropped for release?
I copy it from the $/repo dir/app folder to build (yarn build step creates the build folder)....but the Create release package that archives the build folder does not contain it in the produced zip.
Here's a screenshot of my folder structure in my repo (what's in the $/repo dir/app folder):
In the Copy task you need to specify full path of the build folder, for example:
$(Build.SourcesDirectory)/build
Because you have coded all the paths, I can’t analyze this issue according to your specific situation.
You can specify the Web.config file from ... to see if it can be successfully copied to the build folder.
It would be much easier for people to investigate further and reply if you could attach detailed file path and logs.
Include the web.config file in the public folder
Now the file gets included in the build and dropped for release

Archive source folder contents not the folder in azure build pipeline

i am using azure-pipelines to create a build of my react app and then to deploy it to azure app-service now when i build the app all the required contents go it "/build" folder which then i archive and publish to build artifacts with the corresponding tasks. but the issue is in the archive the structure is "/build/{required files}" but i need the structure as "/{required files}" is there any way to achieve it on azure-pipelines.
i have already looked in azure documentation there they show a variable named "includeRootFolder" but even in the link it does not have a description and in the Archive task i am not able to see any option which will set this variable to false.
There is an option "Prepend root folder name to archive paths" on the task "Archive files" and is enabled per default which causes the behaviour you encounter. Just uncheck this option and this should fix your structure

VSTS. Copy File task is not creating folder

I have continuous integration setup for the web app project in VSTS. Thing is I need to copy some folder, let's call it "Libs"from NuGet package location to the bin folder of the web app. I employed VSTS "Copy Files" task for it. After couple of failings I've figured out how to properly(at least I think so) setup the task, but, alas, folder is not appearing in artifact zip file and I don't understand why.
"Copy File" task runs successfully. But when I click "Artifacts" button on successful build and look inside "drop" container web app zip file does not contain "Libs" folder under bin directory, as I expected it to be.
What am I doing wrong?
Here is line from my "Copy File" task during the build:
2018-05-22T19:24:37.5090638Z Copying
D:\a\1\s\WebApp\packages\ImportantPackage.1.0.0.0\lib\net461\Libs\SomeLib.dll
to D:\a\1\a\bin\Libs\SomeLib.dll
Here is how I actually setup "Copy File" task:
Here is how Publish task looks like:
There is a typo in your Source Folder: ...\ImortantPackage.1.0.0.0\... is probably supposed to be ...\ImportantPackage.1.0.0.0\....
Try selecting the source folder from the explorer by clicking the three dots next to the folder path and selecting the correct folder.