Error in Gated Check In Build Definition Visual Studio 2013 - visual-studio-2013

Could any one solve this problem?
I have the same error, running Build Definition "Gated Check-in" in Visual Studio 2013.
I created a Build Definition, selected the Gated Ckeck-In trigger. I have disabled almost everything, Automated tests, Clean Workspace, and I keep seeing the following error message:
Other Errors and Warnings
1 error(s), 0 warning(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)
Has anyone already solved it?
Cheers!

I found what it is, at least in my case.
When I make my build fail intentionally (missing a ; for instance) it throws this first error (missing ; at line #) and the general error: MSBuild error 1 has ended this build. You can find more specific information about the cause of this error in above messages.
I didn't put much attention in that message. So if an error is found in my build, automatically it throws that MSBuild error, otherwise it succeed perfectly well.

Related

error MSB6006: "lc.exe" exited with code -1

I can't build my application anymore,
every time I try to compile the following error arises.
error MSB6006: "lc.exe" exited with code -1
I've never changed anything within the Microsoft.Common.CurrentVersion.targets file (or any other file which is related to MSBuild).
Full path to the file:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets
Rows where the error seems to be/arise:
<LC
Sources="#(_LicxFile)"
LicenseTarget="$(TargetFileName)"
OutputDirectory="$(IntermediateOutputPath)"
OutputLicense="$(IntermediateOutputPath)$(TargetFileName).licenses"
ReferencedAssemblies="#(ReferencePathWithRefAssemblies);#(ReferenceDependencyPaths)"
NoLogo="$(NoLogo)"
ToolPath="$(LCToolPath)"
SdkToolsPath="$(TargetFrameworkSDKToolsDirectory)"
EnvironmentVariables="$(LCEnvironment)"
MSBuildArchitecture="$(LCMSBuildArchitecture)"
TargetFrameworkVersion="$(TargetFrameworkVersion)"
>
The main problem here is that I can compile every other application, but not my most important one which is written in C# WPF with the .NET Framework 4.7.2.
Does anyone have a clue why I might can't compile the solution?
error MSB6006: “lc.exe” exited with code -1
This error means that your project has something wrong rather than Microsoft.Common.CurrentVersion.targets file
In fact, to see the specific error, you should set your Build Output log to Diagnostic/Detailed by Tools-->Options-->Projects and Solutions-->Build and Run-->set MSBuild project build output verbosity to Diagnostic/Detailed. Then when you build again, you can see the detailed info about it.
And you can try to follow these syggestions:
Please check whether you have any warnings on your nuget packages. If so, please reinstall them or just use update-Package -reinstall under Package Manage Console.
If you have any post(pre)-build event(Right-click on your project-->Properties-->Build Event), please check whether the command has some errors.
If you have licenses.licx files, you should exclude them from your project.
you can try to create a new WPF project and then add the same as the previous project to test if it is the issue of your project.
do a repair in VS Installer in case there are something with your VS Environment or update your VS to the latest version.
In addition, if possible, please share the xxxxx.csproj file of your WPF project with us to troubleshoot your issue quickly. Also, there is a similar issue about this error.

unexpected error detected. Check the Tests Output Pane for details (Resharper stops build)

If I suspend Resharper my build works.
However with Resharper on I get the following message when I build.
unexpected error detected. Check the Tests Output Pane for details
The Tests Output Pane shows
2/07/2018 10:53:31 AM Informational] ------ Discover test started ------
[2/07/2018 10:53:32 AM Informational] ========== Discover test finished: 18 found (0:00:01.692) ==========
[2/07/2018 10:54:24 AM Error] System.MissingMethodException: Method not found: 'Microsoft.VisualStudio.TestWindow.Extensibility.ITestContainer Microsoft.VisualStudio.TestWindow.Controller.ITestContainerProvider.FindTestContainer(System.String, System.Uri)'.
at JetBrains.ReSharper.UnitTestProvider.MSTest11.New.JetDiscoveryOperation.<GetTestContainersFor>d__21.MoveNext()
at System.Linq.Enumerable.<SelectManyIterator>d__17`2.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at System.Collections.Generic.HashSet`1.UnionWith(IEnumerable`1 other)
at System.Collections.Generic.HashSet`1..ctor(IEnumerable`1 collection, IEqualityComparer`1 comparer)
at System.Collections.Generic.HashSet`1..ctor(IEnumerable`1 collection)
at System.Linq.EnumerableExJet.ToSet[TSource](IEnumerable`1 source)
at JetBrains.ReSharper.UnitTestProvider.MSTest11.New.JetDiscoveryOperation.GetTestContainers(IEnumerable`1 sources)
at JetBrains.ReSharper.UnitTestProvider.MSTest11.New.JetDiscoveryOperation.GeTestContainersAndRetry(IEnumerable`1 sources)
at JetBrains.ReSharper.UnitTestProvider.MSTest11.New.JetDiscoveryOperation.ExecuteInternalCore()
at JetBrains.ReSharper.UnitTestProvider.MSTest11.New.JetDiscoveryOperation.<ExecuteInternal>b__6()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.TestWindow.Controller.Operation.<ExecuteWithEvents>d__40.MoveNext()
[2/07/2018 10:54:24 AM Informational] ------ Discover test started ------
[2/07/2018 10:54:25 AM Informational] ========== Discover test finished: 18 found (0:00:00.595) ==========
t
The same issue was fixed in ReSharper 2018.1 build.
If your version of resharper is not able to update to 2018.1 then another option is to simply suspend Resharper to allow compilation to succeed. After everything is built you can then re-enable resharper and run your unit tests without issue.
You can disable resharper by going to the Tools menu and choosing Options. Scroll down and select Resharper -> General. Click the 'Suspend Now' button. Once the build succeeds you can click the Resume button.
This happened to me in Visual Studio 2017 with Resharper 2019.1.3. Restarting Visual Studio resolves the issue so you can at least continue working.
In my case I have to install the following 2 package to my Test project. (I already had xunit package installed)
Microsoft.NET.Test.Sdk
xunit.runner.visualstudio

Visual Studio online build failing with 0 warnings and 0 errors

I am just setting up a basic build with a very bare bones WebApi App, and I am getting a failed build, but without any errors or warnings... how can i figure out what is going wrong?
Project "d:\a\1\s\My.Project.Api.sln" (1) is building "d:\a\1\s\My.Project.Api\My.Project.Api.csproj" (2) on node 1 (default targets).
_CleanRecordFileWrites:
Creating directory "obj\Release\".
Done Building Project "d:\a\1\s\My.Project.Api\My.Project.Api.csproj" (default targets) -- FAILED.
Done Building Project "d:\a\1\s\My.Project.Api.sln" (default targets) -- FAILED.
Build FAILED.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:00.15
##[error]Process 'msbuild.exe' exited with code '1'.
Even any way I can get a useful log or error message would be great!
Edit:
I added /v:diag for the build arguments for verbose logging, but it really isn't seeming to help.
Before Visual Studio build task, you should use nuget restore to download packages your project is referring.
So please add a Nuget task before Visual Studio build task. Detail setting for NuGet task as below:
Command: restore
Path to solution, packages.config, or project.json: **/*.sln or select relative path for My.Project.Api.sln
Feeds to use: Feeds in my NuGet.config
In your build definition, there is a variable called system.debug which is set to false. Change this to true at the template or at the time of triggering and you will get the debug lines written by the build tasks. Inspect the debug lines and you might find the issue.

Checking in Renamed SLN to TFS

I renamed the solution file through TFS and tried checking the code in. I keep getting this error. My best guess is that the build does not recognize that the name of the solution changed, and keeps looking for the old name.
Exception Message: The file (oldName).sln could not be found. (type FileNotFoundException)
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)
How do I get the build to accept the new sln file? Any assistance in the resolution of this issue would be greatly appreciated.
Edit the build definition, go to the process tab, and in the solutions to build property update the name of your solution.

How do I parse the output of msdeploy and fail a TeamCity build if there are errors?

I'm using msdeploy.exe run from TeamCity for deploying ASP.Net projects to staging servers but if suffers severely from always returning a 0 status on exit, even when it raises several errors. This means that a bad deploy does not fail and all looks OK.
So I need to parse the output and have that raise an error, is there an easy way to do this? Alternatively, is there a hard way to do this?
You can see from the TeamCity build log below what is going on (errors, but carries on due to 0 exit status).
[17:32:31]: Skip copying Global.asax to obj\Debug\Package\PackageTmp\Global.asax, File obj\Debug\Package\PackageTmp\Global.asax is up to date
[17:32:31]: C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(1845,5): error : Copying file Web.Debug.config to obj\Debug\Package\PackageTmp\Web.Debug.config failed. Could not find file 'Web.Debug.config'. [C:\BuildAgent\work\f3548ee02a6397b9\webapp\WebApp.csproj]
[17:32:31]: Done Building Project "C:\BuildAgent\work\f3548ee02a6397b9\webapp\WebApp.csproj" (Package target(s)) -- FAILED.
[17:32:31]: Build FAILED.
[17:32:31]: "C:\BuildAgent\work\f3548ee02a6397b9\webapp\WebApp.csproj" (Package target) (1) ->
[17:32:31]: (ValidateGlobalPackageSetting target) ->
[17:32:31]: C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(817,5): error : '..\Package\WebApp.zip' exists as a file. You can't package as an archive directory to be the same path as an existing file. Please delete the file before packaging. Alternative,you can call msbuild with /t:CleanWebsitesPackage target to remove it. [C:\BuildAgent\work\f3548ee02a6397b9\webapp\WebApp.csproj]
[17:32:31]: "C:\BuildAgent\work\f3548ee02a6397b9\webapp\WebApp.csproj" (Package target) (1) ->
[17:32:31]: (CopyAllFilesToSingleFolderForPackage target) ->
[17:32:31]: C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(1845,5): error : Copying file Web.Debug.config to obj\Debug\Package\PackageTmp\Web.Debug.config failed. Could not find file 'Web.Debug.config'. [C:\BuildAgent\work\f3548ee02a6397b9\webapp\WebApp.csproj]
[17:32:31]: 0 Warning(s)
[17:32:31]: 2 Error(s)
[17:32:31]: Time Elapsed 00:00:00.87
[17:32:31]: C:\BuildAgent\work\f3548ee02a6397b9>"C:\Program Files\IIS\Microsoft Web Deploy"\msdeploy.exe -verb:sync -source:Package=Package\WebApp.zip -dest:auto -setParam:"IIS Web Application Name"=MyWebName
[17:32:32]: Info: Updating setAcl (MyWebName).
[17:32:32]: Info: Updating setAcl (MyWebName).
[17:32:32]: Info: Updating setAcl (MyWebName/App_Data).
[17:32:32]: Total changes: 3 (0 added, 0 deleted, 3 updated, 0 parameters changed, 0 bytes copied)
[17:32:32]: Process exited with code 0
[17:32:32]: Build finished
TeamCity 7 has a Build Failures feature:
Edit Settings on your build configuration
Go to the Build Failure Conditions tab (number 4)
Click 'Add build failure condition'
Select the 'Fail build on specific text in build log' type
I used the string "EXEC : error count:" to catch MSDeploy errors, it works well
The Test button opens a handy dialog where you can test your failure condition on a previous build log that you know should have failed
Save
In my configuration I'm invoking msdeploy.exe directly from MSBuild, I think that's why my error text is different to yours.
Pretty cool, loving JetBrains for this.
Here is an approach I used to catpure build failures from MSDeploy when I ran a Nant script for deployment remotely. It is not an identical scenerio but should give you a concept to go from. Basically you can run this from a shell you need a scripting language like powershell to capture the output and than post processes the plain text coming back from msdeploy. I rasied this issue with the MSDeploy team and let them know this was a pain to deal with.
http://www.lostechies.com/blogs/hex/archive/2009/12/29/update-on-using-msdeploy-for-remote-deployments.aspx
In TeamCity 9 go to the build configuration and click on the Failure Conditions. Check the checkbox "an error message is logged by build runner". This will fail your build if an error happens during deployment.

Resources