Can't build using TF Service, builds locally fine - msbuild

I'm trying to get a project to work with a continuous integration build. Currently, it consists of a library dll, .net 4.5 app, and WP8 app. I use team foundation service with GIT as my source control.
I was able to set up a build configuration but it fails with the following message:
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)
This is the ONLY exception in the entire solution, although there are 10 warnings. Additionally, I've run the build with the verbosity to diagnostic and here is the output of that.
Again I don't see any issues with that build, just the cryptic "Done building project.... --FAILED" message. Locally, the project can be built and rebuilt without any issues. Anyone have any idea what might be causing this issue?
Edit:
Through trial and error I've narrowed the issue down to having a windows phone 8 application in my solution. If I exclude that project, the solution builds fine. If it's included, I get the problem. Should I perhaps be using a separate build definition for each project and not for the solution itself? Windows phone 8 projects by themselves build fine...

The error you're getting is occurring within the build template that your build definition is using. Build templates are Windows Workflow files that guide TFS Build through the process of executing a given build. The reason why your project is building locally is that Visual Studio isn't using this build template, as build templates only run on the server under TFS Build.
I dare say someone has customised the build template that your build is using, and that customisation is failing. Based on the error, it seems to be happening during the execution of a CodeActivity, which is now obsolete (though being obsolete isn't actually the issue). The custom code in that CodeActivity is probably failing though.
Assuming your build process doesn't need any specific customisations provided by the failing build template, I'd just select a different one or create a new one. You can do this from the Process tab when editing the build definition.
Hope this helps!

Related

ASP.NET Core 6 cannot find compilation library location for runtimepack.Microsoft.Windows.SDK.NET.Ref

I have been migrating a .NET Framework 4.8 website over to .NET6 so far it's working, I have two branches for this in my Git repository one for the old one for the new.
This is where the problem seems to happen. If I switch back to the .NET Framework 4.8 branch, it of course overwrites the files with that branch and when I am done move back to the .NET6 branch and after that if I rebuild and run my site I get this exception on run:
System.InvalidOperationException: 'Cannot find compilation library
location for package 'runtimepack.Microsoft.Windows.SDK.NET.Ref''
One of the libraries that the web project references uses Windows calls so the TFM is set to net6.0-windows10.0.17763.0 right now. When the site runs inside VS after this branch switch that exception above happens. If I find the host app in the compiled folder and run it manually it runs fine with no exceptions.
When I run it from the build folder manually, I can also attach the VS debugger to it fine and it still works without throwing the InvalidOperationException exception...
What would cause this exception to happen if I launched from inside of VS using a Kestrel host vs running it manually by executing the host app executable then attaching the debugger?
Even odder, I previously fixed this and I'm not sure how I deleted temp files, cleared OBJ and BIN folders and it worked... tried that again this time and nothing

asp mvc IIS deployment issue: Compilation Error

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: The compiler failed with error code -2146232576.
Clean and Rebuild your solution (under Build menu). If it gives you any compilation errors, correct them and build it again. That worked for me.
Edit 3/12/18
It seems like you have read, or possibly write, locks on one or more files. Close the studio and verify that the source code repository don't have orphaned read/write locks. Also verify that any directories used for compilations don't have read locks. There used to be a weird Temporary ASP.NET-folder that was prone to locking files in the good old days.
Previous response
These are a few things that come to mind in my experience. I am assuming the deployment machine is a Windows Server of sorts.
Check the expected .NET version by checking project properties in Visual Studio (or the Project-files if another editor is used).
Compare with the installed version of .NET of the deployment machine. Framework on the deployment machine should equal to or greater than .
Verify the chosen app pool is running the expected version (or change it) and recycle it.
Make sure all the necessary assembly files (.DLLs) have been included on the deployment machine. A quick look into the BIN or DEBUG folder usually tells the story, but will generally also contains a whole lot more stuff. Sometimes too many assembly files removed during optimisation of the build.
A little bit of information about deployment OS and .NET versions would help.

VbMyResourcesResXFileCodeGenerator generates System.OutOfMemoryException

Recently my VB.Net project failed while building, raising a dialog that said (approximately):
External Tool: VbMyResourcesResXFileCodeGenerator failed due to a System.OutOfMemoryException
I'm posting this question and answer as a public service for future searchers with the same problem - in particular because it wasn't easy to figure out.
Searching for a clue to resolve the issue lead me to this question: Visual Studio 2010 - (OutOfMemoryException) & (Memory increase in Ideal State) - and a suggestion to try the Solution Load Manager to reduce memory use. With only the failing project loaded, immediately after starting VS2010, I could successfully execute 'run custom tool' on the resx file from the solution explorer context menu and then build the application.
However, shortly afterwards the build began to silently fail, much like this poster's situation: Visual studio 2010 IDE build fails mysteriously with no errors or warnings In the comments to his question I found my salvation:
You will have to go to Visual Studio Options dialog and navigate to Projects and Solutions | Build and Run. Change MSBuild project build output verbosity to Detailed or Diagnostic and then analyze the output. That should give you hint on what is the root cause.
Once I did so, I was able to see that, again, the resource.resx file couldn't be built.
The ultimate issue turned out to be a forgotten file resource. I had previously embedded a file as a resource, and subsequently increased that file's size significantly by adding several screenshots. Although I was no longer using the file in my code, I hadn't deleted it as a project resource. It was the size of this file that eventually caused the System.OutOfMemoryException and build failures I was seeing. Once I removed the file from the resources, the solution could be built as expected.

TFS build Xap packaging failed because it is being used by another process

I am responsible over managing our automated builds and recently we have moved two silverlight based web applications into the same solution. Now about half the time when we build through the build server the build fails randomly with one of the two xap files with the following error message.
Xap packaging failed. The process cannot access the file
'G:\Builds\2\Application Suite\Main\Binaries\silverlight app1.xap'
because it is being used by another process.
The structure is as follows:
web app1 BUILDS silverlight app1
web app2 BUILDS silverlight app2
Can some one help me solve this issue it is causing me quite a headache?
For TFS 2013, where MSBuild Multi-Proc parameter is no longer present, try to set MSBuild Arguments to /m:1
See:
http://msdn.microsoft.com/en-us/library/bb651793.aspx
http://social.msdn.microsoft.com/Forums/vstudio/en-US/0b856b65-37de-4256-8a09-e233911985f1/tfs2013-msbuild-problems-with-parallel-build?forum=tfsbuild
It turns out that I had to change the tfs build settings for msbuild to build each of the projects one at a time.
Here are the steps to take:
Goto builds -> Edit Build Definition -> Process Tab -> Edit "MSBuild Multi-Proc" to False
Not the best solution as it slows the total build process down because the projects cannot build in parallel but it worked

Unable to compile workflow-project

I have a build-server running CC.Net. So far I never had any problems compiling projects on the build server (which has no VS installed, just use the .Net Framework).
But now I have a new projects and I get this message:
C:\Program Files\MSBuild\Microsoft\Windows Workflow Foundation\v3.5\Workflow.Targets(127,5): error : Compilation failed. Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Has anyone any hint's on what's causing this problem?
What might be of some interest is the fact, that this is a SharePoint project wich includes a SharePoint workflow. But this shouldn't stop the project from being able to be compiled.
The problem with LoaderExceptions described here sounds like what you are seeing. Maybe targeting 3.0 instead of 3.5 does fix your issue too.