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.
Related
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
I am attempting to set up a DevOps build definition to build a VS2017 solution on an on-site agent.
After adding the standard Visual Studio Build step to the build pipeline, the build agent reports the error:
"Error MSB3030: Could not copy the file "d:\agent_work..."
This seems to be happening for any LINKED item.
These items were added to the project from other solutions ("add existing item->Add As Link")
The solution/project builds fine locally on developers PCs, but not on agent.
All that is really required is for the build step to copy these files to an output directory to be included in the build artifacts.
Properties for all linked items are set to "content & copy always".
Error MSB3030: Could not copy the file "d:\agent_work..." because it was not found.
Am I missing something basic here?
This is a workspace mapping issue. You have files that aren't part of your build workspace. You will need to update your build to have a workspace that is mapped in a fashion equivalent to your developers' workspaces.
If your developers are referencing files outside their workspaces, this is a problem that you will have to rectify, then update the build accordingly.
Solved the build error : "Error MSB3030: Could not copy the file "d:\agent_work..." because it was not found." by adjusting the mappings in preceding "get sources" step. After looking at the logs of the build it appeared that the agent was looking in "d:\agent" for some items and "d:\agent\s" for other items (and not finding them). Don't know why it was looking in the "s" sub-directoy. But anyway, the work-around was to include the "s" in the local path mappings for "Local path under $(build.sourcesDirectory)" (ie: s/MyLocalPath)
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
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.
I'm trying to set up automatic build + deploy for a rather large solution. The single solution produces 2 zip folders in the "$(Build.ArtifactStagingDirectory)" location, and these contain all the right files. For the purposes of testing/troubleshooting I am only looking at one of these zip files, but eventually both sites will have to be deployed this way.
However, to get to the actual files, you have to pass through 14 unnecessary subfolders. To further complicate matters, about 8 of these are variable, based on certain elements of the build configuration (some are due to folder structure in the git repo).
I don't want any of these subfolders. The other problem is that I don't actually want a 100% flat file; I need 2 folders with subfolders to be contained within the finally-extracted directory. (The final directory is a physical path for an IIS site.) Is there any way to do this?
I have tried:
Taking the generated zip file, extracting it to a temp directory, and repackaging it, all on the build machine.
To get this to work, I had to manually specify the 14 subdirectories. Also, I was unable to use "Publish Artifact" to upload the resulting zip to VSTS, so I'm not sure how to get it onto the server box.
Downloading the published zip file from VSTS, extracting it locally on the release machine, and then copying the contents to the correct directory.
This works only when I manually specify the 14 folders contained in the directory. I made an attempt to hide the 14 folders with wildcards but only succeeded in copying the excessive nesting structure - I'm guessing the "Source Folder" parameter doesn't support wildcards (I had to actually do it in the "Contents" section or the task failed).
Using the "Flatten Folders" advanced option in the copy dialog.
This removes ALL folder structure, which is not what I want. I need to end up with 2 folders containing subfolders in the final directory.
If it's not possible to only partially flatten the zip generated by the build step, I'd appreciate some help figuring out how much of this terribly convoluted path I can pull out using variables.
There is a very simple way to move the contents of only the contents and subdirectories the PackageTmp folder to the build artifacts folder while shedding the unnecessary folder structure above it, and without using the "Flatten Folders" option (since you likely want to keep the folder structure under PackageTmp intact):
First, in your Build Solution task, set the MS Build Arguments similar to the following:
/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=false /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.binariesdirectory)"
Notice that /p:PackageAsSingleFile=false is set to false; you don't want to zip the package up just yet. Also note the setting /p:PackageLocation="$(build.binariesdirectory). You don't want the output to go directly to the artifact staging directory, as is configured by default.
Next, add a Powershell task, and add this inline script:
$folder = Get-ChildItem -Directory -Path '.\*' -Include 'PackageTmp' -Recurse
Write-Host "##vso[task.setvariable variable=PathToPackageTmpFolder]$($folder.FullName)"
This will store the fully qualified path to the PackageTmp folder in a variable named PathToPackageTmpFolder. Under Advanced options, set the Working Directory to $(build.binariesdirectory)
Now add a Copy Files task to move only the contents of PackageTmp and its subfolders to the artifact staging directory. Set Source Folder to $(PathToPackageTmpFolder), Contents to **, and Target Folder to $(build.artifactstagingdirectory). You're all set!
That is the MSBuild deploy/publish to package action and the folder structure won’t be remain after deploying to the server.
You can specify /p:PackageTempRootDir="" msbuild argument to ignore the folder structure of project path.
Another way is that, you can publish project through FileSystem method, then archive files through Archive files task.