Visual Studio Team Services sends "build failed" email when build succeeds - msbuild

We're using Visual Studio Team Services for a project, and because we want to use continuous integration I set it up to build on each check-in, and to notify me when a build fails. Now, every time someone checks in code, I get an email that tells me the build failed:
Summary
Debug | Any CPU
3 error(s), 0 warning(s)
$/Foo/Bar.Foo/Bar.Foo.sln - 3 error(s), 0
warning(s)
C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v14.0\DNX\Microsoft.DNX.targets
(126): The Dnx Runtime package needs to be installed. See output
window for more details.
C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v14.0\DNX\Microsoft.DNX.targets
(126): The Dnx Runtime package needs to be installed. See output
window for more details.
C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v14.0\DNX\Microsoft.DNX.targets
(126): The Dnx Runtime package needs to be installed. See output
window for more details.
Other Errors
1 error(s)
Exception Message:
MSBuild error 1 has ended this build. You can find more specific
information about the cause of this error in above messages. (type
BuildProcessTerminateException) Exception Stack Trace: at
System.Activities.Statements.Throw.Execute(CodeActivityContext
context) at
System.Activities.CodeActivity.InternalExecute(ActivityInstance
instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at
System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor
executor, BookmarkManager bookmarkManager, Location resultLocation)
When I go to visualstudio.com to check out the completed builds, the build in question is listed as "Succeeded". When I check the logs, everything is fine, and when I get a latest version and build locally, it also builds.
If I go to the "alerts" tab on the administration panel, I have one alert specified, with the following filters:
Team Project = [Current project]
AND Status = Failed
What's going on here?

I cannot say if it is safe to delete it since you don't know where it came from. And if you want to edit a XAML build definition, you need to do it from "Visual Studio\Team Explorer\Builds\XAML Build Definitions":
However, before you figure out if the XAML definition can be deleted, you can add one more filter in alert to set the alert to only track the build definition you want:

Related

Using XAML UpgradeTemplate with TFS 2015 \ 2017

I ran into this issue upgrading from TFS 2013 to 2017. If you are still using the UpgradeTemplate.xaml to run old TFS 2005\2008 style MSBuild Team Builds (TFSBuild.proj) you will find that they do not work with the TFS 2015 or 2017 XAML build agent.
You will get this error when running the build due to some breaking changes that were introduced in the core assemblies. XAML builds have been deprecated for some time... and the old MSBuild based Team Builds are waaaayyyyy out of support. So Microsoft (rightfully) doesn't care.
But is there a way to get these builds working in TFS 2015\2017? It would be a big waste of time to convert these over to using XAML builds only to then convert them to the new build engine after upgrading to TFS 2017.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets (957): The following errors were encountered while processing the workflow tree:
'VisualBasicValue<LabelChildOption>': Compiler error(s) encountered processing expression "Microsoft.TeamFoundation.VersionControl.Client.LabelChildOption.Fail".
'LabelChildOption' is ambiguous in the namespace 'Microsoft.TeamFoundation.VersionControl.Client'.
'VisualBasicValue<RecursionType>': Compiler error(s) encountered processing expression "Microsoft.TeamFoundation.VersionControl.Client.RecursionType.Full".
'RecursionType' is ambiguous in the namespace 'Microsoft.TeamFoundation.VersionControl.Client'.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets (957): The "Label" task failed unexpectedly.
System.Activities.InvalidWorkflowException: The following errors were encountered while processing the workflow tree:
'VisualBasicValue<LabelChildOption>': Compiler error(s) encountered processing expression "Microsoft.TeamFoundation.VersionControl.Client.LabelChildOption.Fail".
'LabelChildOption' is ambiguous in the namespace 'Microsoft.TeamFoundation.VersionControl.Client'.
'VisualBasicValue<RecursionType>': Compiler error(s) encountered processing expression "Microsoft.TeamFoundation.VersionControl.Client.RecursionType.Full".
'RecursionType' is ambiguous in the namespace 'Microsoft.TeamFoundation.VersionControl.Client'.
at System.Activities.Hosting.WorkflowInstance.ValidateWorkflow(WorkflowInstanceExtensionManager extensionManager)
at System.Activities.Hosting.WorkflowInstance.RegisterExtensionManager(WorkflowInstanceExtensionManager extensionManager)
at System.Activities.WorkflowApplication.EnsureInitialized()
at System.Activities.WorkflowApplication.RunInstance(WorkflowApplication instance)
at System.Activities.WorkflowApplication.Invoke(Activity activity, IDictionary`2 inputs, WorkflowInstanceExtensionManager extensions, TimeSpan timeout)
at System.Activities.WorkflowInvoker.Invoke(Activity workflow, IDictionary`2 inputs, TimeSpan timeout, WorkflowInstanceExtensionManager extensions)
at Microsoft.TeamFoundation.Build.Tasks.WorkflowTask.ExecuteInternal()
at Microsoft.TeamFoundation.Build.Tasks.Task.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
You can work around this error if you don’t care about labeling your code as part of the build process or updating associated work items. In my case I was still using the UpgradeTemplate as a convenient way of performing a check-in based “Get-Latest” of source code in TFVC to the builds folder on the build machine… not really a “build” at all. So this was A-OK.
Set these two properties to true in your TFSBuild.proj
This will cause MSBuild to skip execution of the CoreLabel and the CoreGetChangesetsAndUpdateWorkItems targets. CoreLabel is the one which loads the task that is failing the build... and CoreGetChangesetsAndUpdateWorkItems needs the label to exist or it will also fail.
I found these properties by digging through the old C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets - which is the team build script that shipped with TFS 2005 \ 2008.
<SkipLabel>true</SkipLabel>
<SkipGetChangesetsAndUpdateWorkItems>true</SkipGetChangesetsAndUpdateWorkItems>

MSBuild: 'error MSB6006: "cmd.exe" exited with code 1.'

When attempting to build TensorFlow with CMake and MSBuild on Windows 10, I get the following error when running MSBuild:
"C:\work\tensorflow\tensorflow\contrib\cmake\build\tf_tutorials_example_trainer.vcxproj" (default target) (1) ->
"C:\work\tensorflow\tensorflow\contrib\cmake\build\tf_core_gpu_kernels.vcxproj" (default target) (90) ->
(CustomBuild target) ->
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code 1. [C:\work\tensorflow\tensorflow\contrib\cmake\build\tf_core_gpu_kernels.vcxproj]
351 Warning(s)
1 Error(s)
So I only get one error message, and that just tells me that cmd.exe was closed with an error code indicating that there was a problem, but not what the problem was. So how can I find out what caused this problem so I can solve it?
This error commonly happens because the default cmake install location requires admin privileges (normally C:/Program Files/).
There are two simple ways around this:
Run visual studio as Administrator
Override the CMAKE_INSTALL_PREFIX variable to point somewhere not requiring admin privileges
Personally, I'd recommend the second option (When configuring cmake, the command would be something like: cmake . -DCMAKE_INSTALL_PREFIX=D:/Some/Path)

Failed to locate the code coverage command line tool , MSBuild with SonarQube

Getting the following error's once build is triggered from the build definition.
3:46:16 AM Failed to locate the code coverage command line tool Post-processing failed. Exit code: 1
Exception Message: TF270015: 'MSBuild.SonarQube.Runner.exe' returned an unexpected exit code. Expected '0'; actual '1'. See the build logs for more details. (type UnexpectedExitCodeException)
Exception Stack Trace:
at System.Activities.Statements.Throw.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
I am using SonarQube 5.3, installed in the build server. I have .net framework installed in build server not the visual studio .
BuildDefinition where I am referencing SonarQube.
Please help me here !!!!
The code coverage tools are installed with Visual Studio not the .Net Framework, so if you want code coverage you'll need to install VS on the build agent.
Depending on the version of Visual Studio you are using, you may not need an additional license for build agent. See the discussion Is a separate Visual Studio license required for a build machine? get more detail.

TFS 2015 - Waiting for an agent to be requested

So after coming back from vacation my build server don't want to run any builds anymore. It's just stuck on Waiting for an available agent / Waiting for an agent to be requested and if I cancel it I feel it get's stuck on Build Cancelling... since nothing more is happening after I cancel the build. The waiting message is still there but the build is not in the build queue though.
All the agents are green in the Agent Pool and the background service is running.
I am getting the following error in the event log:
Detailed Message: There was an error during job agent execution. The operation will be retried. Similar errors in the next five minutes may not be logged.
Exception Message: A previous call to WebApiConfiguration.Initialize failed. See inner exception for details. (type WebApiInitializationPreviouslyFailedException)
And after 14 Inner Exceptions with the same message on the 15th Inner Exception it says:
Exception Message: Could not load file or assembly 'System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. (type FileNotFoundException)
I have installed the standalone installer for MVC 4 from http://www.asp.net/mvc/mvc4 but that did not help. Also think it's wierd that it's suddenly missing this assembly. I have also tried reconfiguring the agent.
Finnaly got this working again \o/
What I think fixed it was installing the ASP.NET MVC Security Update MS14-059 from this site: https://www.microsoft.com/en-us/download/details.aspx?id=44533
It's still no System.Web.Mvc assembly reference in the %windir%\assembly folder but after innstalling the fix and restarting the server the job agent queued the job right away. And I had restarted the server multiple times before that so it was definitely not because of the restart.

SonarQube MSBuild Runner and TFS 2013 in VisualStudio Remote server returns unauthorized

I have edited a build definition from TFS 2013 inside of Visual Studio following the steps from Setup of the MSBuild SonarQube Runner on the Build Agent Machine and Install the SonarQube Scanner for MSBuild. I am getting the exact same errors as the question from this post as well as one that reads:
Exception Message: TF270015: 'MSBuild.SonarQube.Runner.exe' returned an unexpected exit code. Expected '0'; actual '255'. See the build logs for more details. (type UnexpectedExitCodeException)
Exception Stack Trace: at System.Activities.Statements.Throw.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
I've updated the SonarQube.Analysis.xml file with the correct information and followed the steps of the aforementioned post, updating the Global Permissions for Execute Analysis inside of SonarQube. I have tried updating IIS AppPool info for the service I am trying to build as well as updating Network Service access permissions, but to no avail. Anyone's advice is greatly appreciated!