22

I have developed several (experimental and prototype) iOS apps using Xamarin and the new Visual Studio for Mac OS and the build-times intermittently take about 5-10 minutes on average. When starting a new project, build-times are fine. After a few changes in the source code while working on my apps (no specific changes). For no reason, build times start increasing to 5-10 minutes. I've tried all possible build-options (linking, no linking, SDK versions, new consigning certificate, etc..).

Upon investigation with the Activities-app (Mac OS, Sierra) i find that the "codesign" process is taking up 110% CPU and runs for as long as the build takes to complete.

Does anyone have any experience with this problem?

Léon
  • 286
  • 1
  • 2
  • 7
  • 1
    One trick I use to make building faster is to right click on the solution and choose configuration manager, there you can choose what to build and when , often by default it selects all projects and all platforms , when you need is that to build only iOS when you set iOS as a startup project and to build only Android when you set Android as the startup project . – Ahmad ElMadi Dec 02 '16 at 10:53
  • Builds in iOS are generally slow in xamarin. If you are creating crossplatform app and using forms - I would suggest to use android for quick build/test process. – Danil Kurkin Dec 02 '16 at 16:31
  • 2
    Can you please add a diagnostic build output to your post so we can see where it's bottlenecking? – Jon Douglas Dec 05 '16 at 06:15
  • 1
    The problem is this: code signing process takes forever. So i don't think my build-log has anything to do with it. Running the application with the Simulator as a target, build/deployment times are good. [![Schermafbeelding 2016-12-07 om 14.00.54.png](https://s18.postimg.org/rovd9te49/Schermafbeelding_2016_12_07_om_14_00_54.png)](https://postimg.org/image/4nes42egl/) – Léon Dec 07 '16 at 13:01
  • 1
    `codesign` is invoked by a MSBuild `Task/Target` when you are building. Thus a diagnostic build output would give us insight as to which `Task/Target` and then potentially finding the culprit. – Jon Douglas Dec 07 '16 at 16:36
  • @JonDouglas could you help me get those diagnostics? I would like to provide them. My project on iOS simulator builds fine, however, on the device it's painfully slow. – nmdias Dec 16 '16 at 11:38
  • 2
    @nmdias https://forums.xamarin.com/discussion/27515/how-to-obtain-diagnostic-build-logs (XS) and http://blogs.msdn.com/b/msbuild/archive/2005/09/29/475157.aspx (VS) – Jon Douglas Dec 16 '16 at 16:15

3 Answers3

8

I have the same issue

First Try close Visual Studio then delete bin , obj from your project , finally start visual Build and Run

Second Try make sure you build in real device sometimes emulator cause trouble , how you make sure , if build success but deploy stuck many times

Mina Fawzy
  • 20,852
  • 17
  • 133
  • 156
1

In my case, after wiping my PC and completely re-installing Windows 10, my build speeds increased by 2x.

Clean builds that used to take 2:20 minutes now only take 1:20 minutes, and incremental builds that used to take 40 seconds now only take 17 seconds.

Doing an incremental build + deploying to device used to take around 4 minutes. Now it takes only 55 seconds!

I'm not sure what was leading to this awful experience, but I'm glad it's not so terrible anymore (still slow though).

Andrew Leader
  • 975
  • 6
  • 13
  • I agree it's not the most ideal solution (probably the least ideal solution), however when you're completely out of options even the least ideal solution is useful. I tried changing every single build option, no luck. Turning off Windows Search indexer also seemed to help things. – Andrew Leader Feb 06 '20 at 22:36
  • @LucaZiegler a process that solves the problem is, by definition, a solution. – lockstock Aug 23 '21 at 11:43
1

Go to your *.Android project => "Properties" => "Android Options" and set the following options:

  • Dex compiler: dx
  • Linking: None

This gives me a fast build speed

Luca Ziegler
  • 3,236
  • 1
  • 22
  • 39