Bug 43912 - Extremely slow build on iOS app
Summary: Extremely slow build on iOS app
Alias: None
Product: Tools
Classification: Mono
Component: xbuild ()
Version: 4.4.2 (C7SR1)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-08-31 18:21 UTC by Gabor Nemeth
Modified: 2018-03-15 10:40 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

build log (274.31 KB, application/x-gzip)
2016-08-31 18:21 UTC, Gabor Nemeth
Build log of XLabs.Sample.iOS project (210.49 KB, application/x-gzip)
2016-09-07 20:48 UTC, Gabor Nemeth

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Gabor Nemeth 2016-08-31 18:21:24 UTC
Created attachment 17280 [details]
build log

I experience very slow build on some of my iOS apps/projects - not all.
I have attached a build log with diagnostic verbosity.
It seems that MSBuild and GetCopyToOutputDirectoryItems tasks are the slow ones. I don't have a clue why this is happening.
I haven't experienced this with Xamarin Studio 5.x, but of course I have updated other components (Xamarin.iOS) as well.
Comment 1 Jeffrey Stedfast 2016-09-06 14:02:54 UTC
It looks like GetCopyToOutputDirectoryItems calls MSBuild. The MSBuild task is for building project references.

It looks like your biggest source of time is actually nuget restore. That takes up an order of magnitude more time than anything else.
Comment 2 Gabor Nemeth 2016-09-06 14:59:40 UTC
I mainly experience this problem when using some projects of a large solution - https://github.com/XLabs/Xamarin-Forms-Labs - in another solution. Building just XLabs is far quicker. All Nuget packages are present, there should be no need to restore them. As a workaround I'm currently using XLabs as Nuget package and not source.
Additionally on my Windows machine building for Android in the same configuration is working fine without performance problems.
Comment 3 Gabor Nemeth 2016-09-07 20:45:37 UTC
Now it seems the same problem occurs when only building Xamarin-Forms-Labs on my Mac. I don't have a clue how it's getting worse day by day. Or better for reproducing this issue easier :)
Open XLabs.sln and try to build samples/XLabs.Samples.iOS project! I don't see any message regarding package restore. It seems the build time is increasing from project to project as the whole build is going forward.
One more notice: Building from VS2015 connected to Mac build host this whole issue does not arise (others do however :)), and simply building from command line on the Mac with msbuild or xbuild is very fast.
Comment 4 Gabor Nemeth 2016-09-07 20:48:18 UTC
Created attachment 17367 [details]
Build log of XLabs.Sample.iOS project
Comment 5 Gabor Nemeth 2016-09-15 22:06:21 UTC
New info: It seems using https://www.nuget.org/packages/NuSpec.ReferenceGenerator/2.0.0-beta-bld14 package slows down the iOS build on Mac. Android build on Windows using XS is not affected. VS2015 build is not affected also, but debugging from VS is - it stands a couple of minutes on "Start debugging Android application..." before can debugger attaches.
I still experience quite a slow build on one iOS project, but this is not as serious as this was.
Comment 6 Marek Safar 2018-03-15 10:40:00 UTC
We deprecated xbuild and recommend using msbuild instead. Switching to msbuild will also most likely resolve the issue you reported.