Bug 10078 - More complicated Resource designer update is required for dependencies
Summary: More complicated Resource designer update is required for dependencies
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 4.6.x
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Atsushi Eno
Depends on:
Reported: 2013-02-06 08:51 UTC by Atsushi Eno
Modified: 2013-02-26 19:49 UTC (History)
2 users (show)

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

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 Atsushi Eno 2013-02-06 08:51:36 UTC
Say, there are two projects in a solution, L is a managed android library and A is an app that references L, and L contains a Resources/drawable/x.png.
By our msbuild resource designer merger, Resource.Drawable.x is generated in A's Resource.designer.cs.
When x.png is renamed to y.png, Both A and L have to reflect the name change to Resource.designer.cs. But only L does that. And then the app build fails because its Resource.designer.cs is out of sync and won't get updated unless it is re-generated "appropriately" (I will explain what this means later).

It is because 1) our MD addin only runs "update resource" build target on the project itself, not to any other depending projects in the solution.
But even if we still try to handle them, it won't work because 2) resource merger expects updates only in resources, not referenced projects' resources. It needs to retrieve resources from the deps again before it runs the "update resource" build target.
Current resource retriever parses the dependency dlls and unpacks library resource archives. Here is another problem: to achieve this, 3) "resource updater" task has to be done *after* those deps are built. But what actually happens is, the "resource updater" task runs before the actual dll build (and it is the dll build which triggers those deps' builds, like ordinal .NET dll projects).

To describe in diagrams:

0) current build

resource changes
-- (triggers) -> L resource updater runs and generates L_Resource.designer.cs
-> builds L.dll
-> builds A.dll

1) and 2) are implemented:
resource changes
-- (triggers) -> L resource updater runs and generates L_Resource.designer.cs
-- (triggers) -> A resource updater runs and generates A_Resource.designer.cs (contains both A and old L)
-> builds L.dll
-> builds A.dll

all 1), 2) and 3) are implemented:

resource changes
-- (triggers) -> L resource updater runs and generates L_Resource.designer.cs
-- (triggers) -> A resource updater runs
   -> builds L.dll
   -> generates A_Resource.designer.cs (contains A and updated L)
Comment 2 Atsushi Eno 2013-02-07 05:08:35 UTC
I made some fix (but does not include the fix I mentioned in my private comment). Yet the fix is not perfect, it still causes build error when you rename resources.

But after this "fix", it became possible to build the app project without touching any app resources (which indicates msbuild to rebuild app's Resource.designer.cs). There still seems something that fails to update app's Resource.designer.cs, but it does not happen after "Rebuild All".
Comment 3 Atsushi Eno 2013-02-20 00:03:08 UTC
And the "fix" is still not in the next release.
Comment 4 Patrick 2013-02-24 22:34:21 UTC
I'm having a similar issue as well.

When I add in new resources to the library, the application project sometimes is unable to update it's resource.designer.cs to reflect that additional file.

Doing Clean/Rebuild All doesn't help at all.

Sometimes it takes many tries to get it working.

Is there any steps that I can take to manually update the resource.designer.cs so that the build will succeed?

I'm using:

Xamarin Studio
Version 4.0 (build 2003)
Installation UUID: 6be61b73-6777-453a-b5a3-c3b61bfd0794
	Microsoft .NET 4.0.30319.17929
	GTK 2.24.13
	GTK# (

Version: 4.6.0 (Enterprise Edition)
Android SDK: C:\Program Files (x86)\Android\android-sdk
	Supported Android versions:
		2.1 (API level 7)
		2.2 (API level 8)
		2.3 (API level 10)
		3.1 (API level 12)
		4.0 (API level 14)
		4.1 (API level 16)
Comment 5 Patrick 2013-02-24 22:53:07 UTC
My actual issue is that I have multiple library projects, each with their own resources and the resource.designer.cs is only updating the resources from a few of the libraries and not all.
Comment 6 Atsushi Eno 2013-02-25 02:58:46 UTC
Have you tried "touching" resources in the relevant projects and rebuild it? For example, renaming resources would trigger resource designer updates.
Comment 7 Atsushi Eno 2013-02-26 11:51:50 UTC
Hopefully it is entirely fixed.

[master 3c3c235]
Comment 8 Patrick 2013-02-26 19:49:10 UTC
Hi Atsushi,

I haven't tried "touching" the resources when I tried to rebuild the project.

Right now I have reverted to the older version of MonoDevelop because I had to complete my tasks.

I'll try this out later this week.