TFS 2017 build Copy files from - tfs

In a build, we have Copy files from the task. The problem we have is the source folder itself is copied to the destination. We'd want the contents of the source folder to be copied to the destination folder, not the folder itself. Is there any way to do that?
I tried a wildcard but that doesn't work. It seems it needs a path itself. An issue of this could be that the source is named 'X' but the destination is named 'Y' (it was setup before this build and IIS is pointing to this folder). Can we have the source folder be renamed in the build maybe?

That would be name_of_sourcefolder\**\* for all files and subfolders of just name_of_sourcefolder\* for all files.
This has to be set in the Contents part of the task.

Related

Jenkins and MSBuild Error

I am having an issue with building a sln on Jenkins. I know what the problem is I just have no idea how to fix said problem. So the sln imports a project that is not located in the same folder as the sln. This is not an issue with other sln files that we do the same thing with. As you can see below instead of .. to get back to parent directory it is a looking for a .. directory which obviously doesn't exist.
D:\Path\To\sln\OurSolution.sln.metaproj : error MSB3202: The project file
"D:\Path\To\sln\..\..\PathTo\SharedProject\Shared.csproj" was not found
[D:\Path\To\sln\OurSolution.sln]
Edit your .sln file and have it point to the .csproj file that does exist.
Also, double check your working directory to make sure it's the directory where the solution exists.
Paths in the .sln file need to be relative to the location of the .sln file so that when Jenkins can checks out the entire solution into its workspace from source control the paths resolve.
Check that the paths in the solution file are indeed relative to the solution file.
Check that all the project files defined in the solution file (and all their files in turn) are indeed being checked out to the Jenkins job workspace folder.
Where is the shared project in source control in relation to your solution file? Is it in the same repository? If it isn't then my bet is your Jenkins job isn't checking it out from source control into its workspace and therefore not finding it when the solution tries to compile.
Paths your sln and csproj files are relative. .sln and .csproj files paths are relative from where the sit on the file system.
Usually you would expect csproj files to exist in immediate subdirectories of the directory where the .sln file sits.

Repository mapping to fixed path

As part of my build, I want to map a sub folder to a fixed folder on the c:\ drive.
The problem is when I try and map it, I get this :
How can I change the local path on 1 item to not be prefixed with $(build.sourceDirectory)?
A file path input (has ...) defaults to relative paths.(In Mappings, it is Server Path) A relative path is relative to the root of the repo in build and root of artifact downloaded in RM. Build sources directory happens to point to the root of the repo.
So the Local Path is prefixed with $(build.sourceDirectory). It's by designed. You can't change the local path on 1 item to not be prefixed with it.
In your situation, the fixed path clearly should be out of the path on the build agent where your source code files are downloaded. So suggest you to use the copy files Task to achieve what you need. However, you may have to set the fixed path as an UNC shared path.
Update
After go through the extension info, seems the copy task is the only solution for now. And you could add a powershell script, after the first copy , compare the sub folder in TFS server with the fixed path. Then you just need to copy the new add things in the sub folder to the fixed path.

Jenkins: Copying Artifact (directory) from one Job to another

in Jenkins, I have a job downloadAgents that is responsible of creating a folder and populating it with some files. Then the folder is saved as an artifact with the following folder structure
dev\downloadAgents\target\dependency\ios
Then I need to copy the contents of the ios folder into the workspace of another job (into a specific folder).
I have added the Copy artifacts from another project step. And it does copy the artifacts, but it copies the full path
\dev\downloadIosAgents\target\dependency\ios
How can I tell jenkins to copy only one folder ios and everything that is inside it and, do not copy all folders that are before ios.
Also if there are already files in the destination folder, will it merge the 2 folders?
You can use regex for your copy (under "Artifacts to copy")-
dev\downloadAgents\target\dependency\ios***.*
** - all folders under ios
*.* - all file types
You can also specify the target directory, and you also have a flag for "Flatten directories". This will move all the files without the hierarchy of the folders (flat to your target directory)
Feel free to look at the plugin's home page:
https://wiki.jenkins-ci.org/display/JENKINS/Copy+Artifact+Plugin
In CopyArtifacts plugin specify the pattern: \dev\downloadIosAgents\target\dependency\ios\*.* or \dev\downloadIosAgents\target\dependency\ios\** - I don't remember exactly.
That should do the job.

TFS Build single folder not being copied

when building my app on a TFS server, a single folder (with 2 .xml files) aren't copied to the output folder, but all others are.
These files are: a normal xml file and it's tranform version,
This is on the corporate TFS build server and it works for all other files / transformations. So it must be one of my settings in this project / File.
I've checked the files, it's set the same as a .css file that is getting copied (so set to content)
anyone has an idea where I could have a look to find why this is happening?
or even better has a solution for me.
Found that WIX was removing this file

Teamcity is not copying all the folders

I've now setup a MSBuild script to create the folders and files I need in the right structure for my MVC project. I'm then setting Teamcity up to look at the folder with only the files I want to have and copy that to the artifacts folder. So far, so good!
However, There is a few folders in the structure that are empty, and Teamcity does not copy these folder, even if I've set it up to copy the mainfolder and everything in it.
Is there a way to force Teamcity to copy everything - and by that I mean EVERYTHING in my folder, or does it simply not work?
Teamcity Artifact path settings:
Website => Release
You may find your answer in this post : How do I exclude the contents of a directory but not the directory itself in MSBuild
It's not Teamcity but still MsBuild. The problem is that msbuild's include does not include empty directories...
We manage to work around this and skip the empty folders. Therefore this was no longer an issue. However, still don't know how to copy empty folders. My understanding from doing research for a long while now is that it simply doesn't work.

Resources