I have TFS2018 server and a separate build server. When I try to build I get the following error during the get sources step:
Exit code 100 returned from process: file name 'tf', arguments 'vc workspace /new /location:local /permission:Public ws_1_1 /collection:https://mydevtfs/tfs/DefaultCollection/ /loginType:OAuth /login:.,****** /noprompt'.
The root mapping looks like this. But all subfolders inside MyProjectFolder are empty. Any idea how to specify the path so the files will be included within the subfolders as well?
Here is a screenshot of the last part of the log
The issue may related to the workspace mapping, doulce check the source mapping of your build definition. You could give a try with solution Error When Setting Clean = True on Windows
Looks like scorch is failing when the root sources folder (e.g.
_work\1\s) is not mapped - i.e. workspace does not contain a root mapping.
One not great workaround is to set a variable build.clean to all.
Another workaround is create a mapping for the root such as $/projectroot/*and keep the Local path field blank. This will only download single level folders as empty below the project root.
update
Related
I'm setting up some TFS build definitions. I see that once I run a build, the work is done within a subfolder of a subdirectory of /Agent/_work. It appears that the subfolder is the same between different executions of the same build definition, but I see no way to know in advance where I should expect TFS to set its working directory, nor do I see any way of specifying the name of the directory manually.
How does TFS determine what directory to use for the output from a build?
Refer to the documentation on build variables. The base folder can be accessed via the $(Agent.BuildDirectory) variable. The source folder is $(Build.SourcesDirectory).
You can't set this. It's determined by the agent's configuration.
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.
I have a TFS build in a Git team project that uses the default template. It builds a .proj file containing a single target that executes a .PS1 file in Powershell.exe.
The .PS1 generates its own log file. I have been trying to figure out how to get this file to copy to the drop directory \logs folder. From what I can tell, TFS only copies specific files to this output directory:
ActivityLog.AgentScope.[id].xml
ActivityLog.xml
build.log
Anyone tried getting custom logging info to this directory? I tried writing to build.log but that failed with errors.
I like #MrHinsh's answer better than mine, but I found that you can write to a file at this location: $(TF_BUILD_DROPLOCATION)\logs during build.
I assumed that since the path doesn't exist until the log files are copied it would not work. But it does... the TFS/MSBuild log files are simply merged in. And it even seemed to work with a name conflict. For example, if your file is named build.log, MSBuild's will be renamed to build.01.log.
In your PowerShell you can easily execute Host-Write to write to the Build log. All of the standers output methods are captured, although you need to use the "-verbose" tag to get the text to always write.
My build cannot pick up some of the projects in my application.
They are stored in their own projects in TFS source control.
I group them together in the Edit Build workspace;
These are the mappings:
The Build Agent folder does not let me simply put $(SourceDir). What is the impact of appending a folder name at the end as above?
How do I get the Build Agent to pick up the projects from the correct folder locations?
Currently I get these error messages;
8 error(s), 3 warning(s)
$/STAS/Timesheet/Timesheet/Timesheet.sln - 8 error(s), 3 warning(s), View Log File
C:\Builds\4\STAS\Timesheet\Sources\Timesheet\Timesheet.sln.metaproj: The project file "C:\Builds\4\STAS\Timesheet\Sources\Timesheet\..\..\..\..\StandardClassLibrary\StandardClassLibrary\StandardClassLibrary.csproj" was not found.
C:\Builds\4\STAS\Timesheet\Sources\Timesheet\Timesheet.sln.metaproj: The project file "C:\Builds\4\STAS\Timesheet\Sources\Timesheet\..\..\..\EmailMessageRecord\EmailMessageRecord\EmailMessageRecord.csproj" was not found.
This is exactly how the feature is meant to be used. The $(Sourcedir) macro is replaced by the Build Agent path (as configured on the Build Agent):
Whichever path is configured here is placed into $(Sourcedir) and whatever you additionally configure in the mapping is used to create the final destination.
So what happens is that these solutions will all be downloaded to their own sub directory under the build working directory. The only think you'll need to look out for is that relative paths between folders in source control or in your local mapping need to match up with the destination folder structure you choose int he build definition's workspace mapping.
I am trying to call TF get command via Team Build script. I am getting the following error
Unable to determine the workspace.
Folks over the internet tell that this error is because Team Build cannot find the workspace because it is being called from a directory which is not part of the workspace.
The solution presented is to specify the working directory. I do so. The mappings are ok in Build Definition path as well as in the workspace. But now i get the following error:
Could not find cmd.exe in the current
directory . The directory name is
invalid.
Kindly help.
Thanks
Solved the problem. I added one more binding in my build Definition Workspace Section and referenced files to get/checkin/checkout with the help of variable $(MSBuildSourceDirectory). Meanwhile I ensured that $(SourceDir) is used to specify mapping in the workspace section of my Build Definiton dialog.
(source: geekswithblogs.net)
At the same time i encountered 260-character path limit, so i modified the output directory in build path as described here
(source: geekswithblogs.net)