-1

We have a C++ application using MFC. We also use the manifest that is auto-generated and we actually do use it. The environment is windows server 2012 it has TFS 2018 installed on it and a build agent configured. Visual studio 2017 pro 15.6.2 is also installed with all the needed packages for our project.

The weird thing is when I compile the project within visual studio everything is build just fine BUT when I build with the build agent on the same machine there is an error:

Generating code All 26621 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.Finished generating code C:\_TFS(0,0): Error c1010070: Failed to load and parse the manifest. The system cannot find the file specified. C:\_TFS : general error c1010070: Failed to load and parse the manifest. The system cannot find the file specified. [C:\_TFS Build Agents\DEUSRV52\_work\1\s\test\App\HC100\HC100.vcxproj] LINK(0,0): Error LNK1327: failure during running mt.exe LINK : fatal error LNK1327: failure during running mt.exe [C:\_TFS Build Agents\DEUSRV52\_work\1\s\test\App\HC100\HC100.vcxproj] Done Building Project "C:\_TFS Build Agents\DEUSRV52\_work\1\s\test\App\HC100\HC100.vcxproj" (default targets) -- FAILED. Done Building Project "C:\_TFS Build Agents\DEUSRV52\_work\1\s\test\App\HC100.sln" (default targets) -- FAILED. Build FAILED. "C:\_TFS Build Agents\DEUSRV52\_work\1\s\test\App\HC100.sln" (default target) (1) -> "C:\_TFS Build Agents\DEUSRV52\_work\1\s\test\App\HC100\HC100.vcxproj" (default target) (4) ->(Link target) -> C:\_TFS : general error c1010070: Failed to load and parse the manifest. The system cannot find the file specified. [C:\_TFS Build Agents\DEUSRV52\_work\1\s\test\App\HC100\HC100.vcxproj] LINK : fatal error LNK1327: failure during running mt.exe [C:\_TFS Build Agents\DEUSRV52\_work\1\s\test\App\HC100\HC100.vcxproj] 0 Warning(s) 2 Error(s) Time Elapsed 00:02:11.68 Process 'msbuild.exe' exited with code '1'.

Now it says that a certain file cannot be found except that the file is actually there. My guess is that something else might be wrong here.

So I went to the folder where the sources are being placed via the get sources task which is in the agent's folder structure and I then opened the solution with visual studio and build it there and again within visual studio the build is successful.

I've been looking on the internet and I found a couple of solutions such as:

  1. disable manifest creation in the linker options menu... (this is not a solution for us since we need it)
  2. mt.exe can't cope with spaces in the file path (strange since when opening the same files in visual studio it does build or is there something different when opening it from VS or building it with an agent?)
  3. Digital Guardian might restrict execution (we don't have that nor can I see it in procmon)
  4. A virus scanner might block execution (nothing is installed on the environment)
  5. when using the Visual studio build step instead of msbuild build step in the TFS build system the build fails with exactly the same error.

I'm pretty sure that it has nothing to do with points 3 and 4 (virus scanners/ security restrictions) since I can build it successfully within the visual studio itself.

I just started to use TFS build for the first time so there is a big chance that I'm missing something here. Hopefully, someone can help me out.

I have asked this question on MSDN forums as well (https://social.msdn.microsoft.com/Forums/en-US/587b1c42-8ac6-4deb-95aa-4d74c91fd55f/msbuild-issue-on-windows-server-2012-link1327-mtexe-error-c1010070?forum=Offtopic) where I got the suggestion to ask the question here as well.

Joy
  • 1,171
  • 9
  • 15
  • What's the result if you manually remote to the build agent and run the build either through VS or MSBuild command on the build agent directly? This will narrow down if the issue related to environment or TFS side. – PatrickLu-MSFT Mar 29 '18 at 04:00
  • It is a very basic "file not found" error. mt.exe is a cranky program, it does tell you which file it could not find, it assumes that you know. This is pretty good practice, you'll have to learn how to diagnose build failures, it is going to happen a lot more in the future. Key is that you can see more and that requires telling msbuild to produce more output. Google "tfs increase msbuild verbosity" for relevant hits. – Hans Passant Mar 29 '18 at 06:41

1 Answers1

0

The issue is found and we have a workaround implemented.

When an Agent is defined in a path that has spaces in it mt.exe will not be able to find a file within that path. But this gets stranger because when you have a path that contains spaces and you run msbuild.exe via the command line mt.exe will find the path and the build is successful. after some testing we found out that if you combine the execution on an agent (which is located in a path that has spaces) the execution of mt.exe by the agent will have this error that mt.exe is not able to find the file. Now to completely test this and to make 100% sure that this has something to do with the agents path I created a build definition with specific execution paths. So I disabled the get sources step, removed all the sources then placed all the sources in a space free path and then ran the msbuild commands on an agent that contains spaces in its path and then it failed again.

So what we settled for is to locate our agents in a path that does not contain any spaces and now it builds just fine.