Bug 16429 - Resource generation
Summary: Resource generation
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 4.10.1
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: dean.ellis
Depends on:
Reported: 2013-11-24 22:18 UTC by cheansiong
Modified: 2017-07-07 14:27 UTC (History)
6 users (show)

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

AndroidSolution (339.73 KB, application/zip)
2013-11-28 10:26 UTC, Saurabh

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 Developer Community or GitHub 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 cheansiong 2013-11-24 22:18:01 UTC
Description of Problem:
Resource generation of android is generally very very slow when it involves multiple UI projects.

Steps to reproduce the problem:
1. Create multiple UI projects and make sure each UI project has images, layout, ids (10-20)
2. Add references from one to another.
3. Continue adding references.
4. Resources generation is slowing down the build process.

This problem has been quite some times and doesn't get solve since the first day, I cannot stay with this issue anymore.

Actual Results:
My current project build requires about 5-10 mins when some changes involved especially when UI project is changed, Eg: adding a new ids, layout, image. Normally a rebuild is required.

Expected Results:
The build process should be smart enough to insert the resources only when some changes occurred.

How often does this happen? 

Additional Information:
Comment 1 narayanp 2013-11-27 02:20:53 UTC
@Cheansiong, Could you provide Test project so that I can reproduce this issue?
Comment 2 narayanp 2013-11-27 03:25:03 UTC
I have checked this issue with following builds I am not able to reproduce this issue:

All Mac
X.S 4.2.1(build 1)
Mono 3.2.5
X.Android 4.10.1-68

I have added 3-4 projects in one solutions and then I have added some widgets and Images in layout designer for every project. After adding references form one project to another when I build the project, Build performances looks fine for me. I have attached my project.
Build Output: https://gist.github.com/saurabh360/5913252758a44030a376
Comment 3 narayanp 2013-11-27 03:42:59 UTC
This is dropbox link for my attached project: https://www.dropbox.com/s/8obubmi4iyb6utm/AndroidSolution.zip
Comment 4 cheansiong 2013-11-28 09:41:09 UTC
Thank you for your help on this issue but I couldn't download your drop box as the zip file complained that it contains error during unzipping.

Would you upload again? Thanks
Comment 5 Saurabh 2013-11-28 10:26:46 UTC
Created attachment 5562 [details]

I am able to download and extract the project from the link shared in comment 3.

Now, I have attached same project with the issue. You can also download and use the project from here.
Comment 6 cheansiong 2013-11-28 21:20:24 UTC

I was able to download the attachment from Comment 5 now and found that the setup and result was a bit different from what I got.

I was modifying the solutions to make it look closer to what I had here now, however, it might take me some times to do that. I would explain it briefly here at the moment. My setup was:

1. Application
Reference to:
- Base UI project
- Plugin project 1
- Plugin project 2

2. Base UI project
Reference to:
- Probably nothing

3. Plugin project 1
Reference to:
- Base UI project
- Plugin project 1
- Plugin project XXX due to dependency

4. Plugin project 2
Reference to:
- Base UI project

(Other plugin projects)

The Resource.designer class that I had in *Application* project will consist of all drawable, layout, animation, string, etc from all plugin(s). And the slowness is at the generation of Resource class (mostly) for each project.

Each project reasonably has at least 100 resources and should not contains the same name across projects. (it is not a lot if you consider it on a real world project with strings, image, animation, view id)

*Application* project is at a long list of 8000 lines.
*Base UI* project has 2500 generated lines.
*Plugin 1* project contains > 2500 generated lines (Base UI + its own resources).
*Plugin 2* project contains > 2500 generated lines (Base UI + its own resources).

I hopes this clarifies the problem better now.
Thank you.
Comment 8 cheansiong 2013-12-07 00:57:17 UTC
Sorry for late reply as my PC has some issue recently.

One thing that I notice from your project setting and mine are the following setting.

I noticed that the project that you created has those new flag while my old project doesn't have, maybe you could help to give more information?

Thank you.
Comment 9 Przemysław Raciborski 2015-10-09 05:54:13 UTC
Xamarin are you going to fix that?
Comment 10 cheansiong 2016-01-28 06:46:05 UTC
The resource generation generally improved before my updates to Xamarin 4. I believe Xamarin has improved the resource generation, however, not after Xamarin 4 came out.
Comment 11 Prashant [MSFT] 2017-07-06 07:03:44 UTC
Do you still see this issue? The test project builds under 10seconds on VS for Mac with the latest stable builds

Please reopen the bug if you continue to see this issue, and attach the diagnostic build outputs
Comment 12 cheansiong 2017-07-07 14:27:29 UTC
Not anymore.