Bug 8425 - Modifying a resource file cause the project dependencies to be built
Summary: Modifying a resource file cause the project dependencies to be built
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 4.3.x
Hardware: PC Mac OS
: High major
Target Milestone: ---
Assignee: dean.ellis
Depends on:
Reported: 2012-11-15 11:33 UTC by Lluis Sanchez
Modified: 2017-06-28 14:21 UTC (History)
6 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 Lluis Sanchez 2012-11-15 11:33:37 UTC
When a file is modified in the Resources directory, the Android project runs an msbuild target to regenerate the Resources.designer.cs file. This target causes a build of the projects on which it depends. This should not happen, a file save should not cause any project to build.
Comment 1 Mikayla Hutchinson [MSFT] 2012-11-15 14:57:31 UTC
This is a regression in the M4A targets.
Comment 2 dean.ellis 2012-11-20 14:37:42 UTC
This only appears to be an issue within MonoDevelop. Visual Studio does not exhibit the same behavour.
Comment 3 dean.ellis 2012-11-22 05:34:04 UTC
Fixed in master/e4e8e14e98

The fix stops dependent assemblies being re-built if we are
re-generating the Resource.Designer.cs file in MonoDevelop.
Comment 4 Lluis Sanchez 2012-12-03 05:07:54 UTC
The fix was reverted because it caused some regressions.
Comment 5 Lluis Sanchez 2013-03-27 05:11:26 UTC
Any update on this?
Comment 6 Stephen Shaw 2013-04-09 03:28:25 UTC
It would be great to get this fix as it can be a real annoyance on a large project. If you change things and save twice its easier to force close XS and relaunch it.
Comment 9 Mikayla Hutchinson [MSFT] 2013-06-20 14:14:44 UTC
The fix for bug 10078 makes builds slower and much more verbose too, and exposes other MSBuild issues. See bug 11846 and bug 12532.

We need to figure out how to update resources without forcing a full recursive Build of all referenced projects.
Comment 10 Jonathan Pryor 2014-07-30 11:06:36 UTC
Is this still a problem? Do we have a concrete test to demonstrate any problem?

Background: Library projects may contain Android resources which are "merged" with the Application project. This is in part why dependent projects were rebuilt: so that if they added/removed resources, the referencing project would get a proper "up to date" view of the resources provided by the referenced project.

The problem with the original approach was that the <MSBuild/> task was used to build the referenced projects, causing all manner of pain (see above bugs, along with many others). We have since removed explicit <MSBuild/> invocations from Xamarin.Android.Common.targets, which should be the behavior in Xamarin.Android 4.14, which means that referenced projects should only need to be rebuilt if they've actually changed (which will hopefully speed things up).

Does the removal of explicit <MSBuild/> task invocation help you? Is there something more that can be done?

Unfortunately, at a high level as long as Library projects can provide resources to the application project, and Library projects can be changed by the user, I see no way to remove the need for the Application project's resource update target to implicitly invoke/update the referenced library projects. How else do you ensure that things are kept in sync?
Comment 11 Lluis Sanchez 2017-03-03 10:03:12 UTC
I'm not sure if this is still a problem. Reassigning.
Comment 12 Chris Hardy [MSFT] 2017-06-28 14:21:43 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Android. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.