TFS 2015 upgrade: Build definition parameters parsing issue - tfs

We just upgraded to TFS2015 and now most of our builds wont work. The error looks like this:
Exception Message: The build controller cannot deserialize the process
parameters of the build. Make sure the process parameters are
compatible with the assemblies on the build machine. Details: Set
property 'Microsoft.TeamFoundation.Build.Common.BuildParameter.Json'
threw an exception. (type Exception)
[...]
Exception Message: TF401070: Could not deserialize the JSON string
provided. Details:
Error parsing comment. Expected: *, got p. Path 'MSBuildArguments', line 1, position 991. (type
BuildParameterSerializationException)
Exception Stack Trace: at Microsoft.TeamFoundation.Build.Common.BuildParameter.set_Json(String
value)
I get I have to change the MSBuild arguments so they can be parsed, but it won't let me update the Process tab of the build definition (prompts an error and all the fields are all empty) so I can't edit the parameters.
Is there a solution for this problem? Can I edit the MSBuild arguments in some other way?

In case you install "Microsoft Visual Studio Team Foundation Server 2015 Power Tools" and use the command "tfpt.exe builddefinition", make sure to fix the following error message:
1) The way to fix the above error message is to copy the missing dll ("Newtonsoft.Json.dll") to the folder "C:\Program Files (x86)\Microsoft Team Foundation Server 2015 Power Tools".
a) Make sure to open an elevated command prompt
b) Copy the file "%CommonProgramFiles%\Microsoft Shared\Team Foundation Server\14.0\Newtonsoft.Json.dll" to the folder "C:\Program Files (x86)\Microsoft Team Foundation Server 2015 Power Tools"
c) Close the "elevated command prompt" and open a regular e.g "MS VS 2015 Command Prompt"
d) Confirm that the above error message is gone.

First, make sure your build machines should match the version of your server.
The next step is to recompile any custom activity assemblies that this build machine uses, if you have.

Solved the problem.
Reinstalled TFS2013 in another server, re-pointed Visual Studio to that TFS server and then I could get the build parameters.
The error wen I opened the Build Definition process tab cleared all the fields of the build definition. So I basically inserted all the old values one by one until it failed.
The error was a TFS path that I was passing as a MSBuild argument, TFS2015 doesn't like the '$' at the beginning of the path (I guess it automatically thinks it's a TFS variable, didn't happen with 2013) so I changed it for the ASCII code '%24'. Worked just fine.

Had similar problem - but the exception only occurred when a build process had "MSBuild Arguments" present ("/maxcpucount"). Further investigation led me to discover build process information was missing from the dump files that were created. The solution specified by user7982840 corrected both problems:
Process details missing from the dump files
"Set property
'Microsoft.TeamFoundation.Build.Common.BuildParameter.Json'
threw an exception."

Related

TFS 2018 - Error MSB1008 (build using VS)

I have an Installed instance of TFS 2015 where I had configured a build using VS.
Everything is working.
In this instance I have configured the build like this:
I installed TFS 2018 in another machine and I am trying to create the some build.
I configured TFS 2018 like this:
I don't know why but even though I kept the same build config (as in TFS 2015) I am getting some error:
MSBUILD : error MSB1008: Only one project can be specified.
Switch: TFS2018\Agent1\_work\3\a
For switch syntax, type "MSBuild /help"
Process 'msbuild.exe' exited with code '1'.
Screenshot:
Can you help me with this?
How can I fix this error?
EDIT: Here goes my Nuget Restore config.
This error MSBUILD : error MSB1008: Only one project can be specified usually caused because of the space in arguments, but not quoted.
Since the path contains spaces (between Agents and TFS2018, see your error logs), the TFS2018 part is considered a new argument and MSBuild doesn't know what to do with it.
So modify your MSBuild Arguments, put the path directory to your file in quotation marks (") to indicate the directory is one argument, then try again.
/p:OutDir="$(build.stagingDirectory)" /p:UesWPP_CopyWebApplication=true /p:PipelineDependsOnBuild=false

MSBuild issue on windows server 2012-2 LINK1327 mt.exe error c1010070

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:
disable manifest creation in the linker options menu... (this is not a solution for us since we need it)
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?)
Digital Guardian might restrict execution (we don't have that nor can I see it in procmon)
A virus scanner might block execution (nothing is installed on the environment)
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.
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.

MSBuild builds solution but fails to build the project

I have F# project which I want to build with command line (to use that later in FAKE config).
The problem is that MSBuild fails to resolve assembly dependencies when I use it on the project file directly. While it goes fine when I use solution file with this single project included.
I really have run out of ideas. The solution file seems to not contain any critical information.
Another weird thing is that VSCode also fails to resolve one of those assemblies. I hope that when I fix MSBuild config I may be will able to see what's wrong with VSCode.
Command line:
"C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe" FSharpWeb1\FSharpWeb1.fsproj /t:rebuild
Error message:
C:\work\MNP\testMSBuild1\FSharpWebApi\FSharpWeb1\FSharpWeb1.fsproj(173,5): error MSB4062: The "MSBuild.ExtensionPack.FileSystem.File" task could not be loaded from the assembly C:\work\MNP\testMSBuild1\FSharpWebApi\FSharpWeb1\*Undefined*\packages\MSBuild.Extension.Pack.1.3.0\tools\net40\MSBuild.ExtensionPack.dll. Could not load file or assembly 'file:///C:\work\MNP\testMSBuild1\FSharpWebApi\FSharpWeb1\*Undefined*\packages\MSBuild.Extension.Pack.1.3.0\tools\net40\MSBuild.ExtensionPack.dll' or one of its dependencies. The filename, directory name, or volume label syntax is incorrect. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.Done Building Project "C:\work\MNP\testMSBuild1\FSharpWebApi\FSharpWeb1\FSharpWeb1.fsproj" (rebuild target(s)) -- FAILED.
I've pushed the minimal demo to github: https://github.com/alehro/testMSBuild.git
It's actually easy to reproduce independently. In VS 2015 Community edition create new project from F# Web Template named "Web Api 2.2" and then try to build it with MSBuild.
Another disturbing thing is that the minimal demo produces different errors from those I've seen yesterday. Also vscode complains on different items. If yesterday it could not resolve a couple of calls, now it complains on all of:
open System.Net.Http
open System.Web
open System.Web.Http
open System.Web.Routing
telling that neither of them is defined.
Reformatting my comments to a response now that it's verified it works:
Your FSharpWeb1.fsproj references MSBuild.ExtensionPack.FileSystem.File task from MSBuild.Extension.Pack, but the path specified in the <UsingTask> tag contains $(SolutionDir) property which is not defined when you run MSBuild outside of Visual Studio.
The error message you're getting shows that in the highlighted part of the path:
The "MSBuild.ExtensionPack.FileSystem.File" task could not be loaded from the assembly C:\work\MNP\testMSBuild1\FSharpWebApi\FSharpWeb1\*Undefined*\packages\MSBuild.Extension.Pack.1.3.0\tools\net40\MSBuild.ExtensionPack.dll.
This can be remedied by conditionally setting the relative path when the property is not set by VS:
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
(original response for this solution: https://stackoverflow.com/a/33782131/1659828)
One more thing I mentioned in the comments is that this solution assumes you already have the necessary dependencies downloaded in the packages folder. Visual Studio does that automatically by restoring NuGet packages before build, but when you build in another context, you have to make sure the packages are restored, otherwise the build will keep failing.

VS2015 build with TFS2013

I'm trying to do a teambuild for a VS2015 solution with TFS2013.
On the buildserver VS2015 is installed and I changed the buildtemplate so msbuild has an argument \tv:14.0, but when a start a build I get the following error:
C:\Program Files
(x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets (96):
Invalid static method invocation syntax:
"[Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformSDKDisplayName($(TargetPlatformIdentifier),
$(TargetPlatformVersion))". Method
'Microsoft.Build.Utilities.ToolLocationHelper.GetPlatformSDKDisplayName'
not found. Static method invocation should be of the form:
$([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(a,
b)).
The buildserver has been restarted but I still get the error.
I also checked this thread: Build failed in TFS but no real answer was given there. Is there anyone that knows how to solve this.
I was experiencing the exact same error. I determined that TFS2013 was the RTM version so we installed TFS2013 Update 5. Now if I run using the *.12.xaml process template with the /tv:14.0 /p:VisualStudioVersion=14.0 parameters the build succeeds. I have also made a copy of the *.12.xaml build process and named it *.14.xaml and changed the Run MSBuild steps ToolVersion property to "14.0" and this build works as well, without the parameters.
You need to customize the build process template by finding all the Run MSBuild for Project MSBuild activity, then set the ToolVersion to "14.0" and set ToolPath to target to MSBuild14 (by default: "C:\Program Files (x86)\MSBuild\14.0\Bin"). After that, check in the build process template and re-queue the build.
Check the solutions here:TFS 2013 building .NET 4.6 / C# 6.0

MSTest crash during a build in TFS 2008 SP1

I've never managed to make MsTest works during the build of my solution on TFS. When I look the build log, I see this that TFS want to execute MsTest :
"C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\MSTest.exe" /nologo /searchpathroot:"C:\BinaryRoot\TFSBuild" /resultsfileroot:"C:\TestResults\" /testmetadata:"C:\Build\MySolution\Full.vsmdi" /testlist:"WorkingTest" ...
But the build don't create any test result file.
I tried to launch this line manually on the build server but MsTest crash after this :
Loading C:\Build\MySolution\Full.vsmdi...
Search path(s) for tests:
C:\Build\MySolution\Binaries\TFSBuild
C:\Build\MySolution
Search path(s) for default run configuration:
C:\Build\MySolution
I don't see any problem with the path, my file testrunconfig is under C:\Build\MySolution.
My tests can run on my machine (VS 2008 vsts).
I've got the same problem with another build machine.
The event viewer, shows me two errors :
NET Runtime version 2.0.50727.3082 -
Fatal Execution Engine Error
(7A035FC0) (80131506)
and
Faulting application mstest.exe, version 9.0.30729.1, stamp 488f21a6, faulting module mscorwks.dll, version 2.0.50727.3082, stamp 492b82c1, debug? 0, fault address 0x001c5fc0.
Does someone has an idea about this issue, or should I just switch to another test framework/CI server ? :(
I have the exact same problem with Hudson CI, so I don't think this is related to your CI server.
Still searching for a solution though...
There is a hotfix for the same error signature, different conditions but it could be the same underlying cause - give this a try.

Resources