Bug 4490 - Unneeded noise in diff, because MD keeps removing <TargetFramework* tags in project files
Summary: Unneeded noise in diff, because MD keeps removing <TargetFramework* tags in p...
Status: RESOLVED DUPLICATE of bug 7914
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Project Model ()
Version: 2.9.x
Hardware: PC All
: Low normal
Target Milestone: ---
Assignee: Lluis Sanchez
Depends on:
Reported: 2012-04-18 07:04 UTC by Andres G. Aragoneses
Modified: 2013-02-10 20:43 UTC (History)
1 user (show)

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

example of the noise (4.80 KB, patch)
2012-04-18 07:04 UTC, Andres G. Aragoneses

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 Andres G. Aragoneses 2012-04-18 07:04:11 UTC
Created attachment 1695 [details]
example of the noise

When opening a solution that has a lot of .NET 4.0 projects in it, MonoDevelop changes the project files to remove a lot of <TargetFrameworkVersion> and similar tags.

See an example of the noise that a developer may see when going to commit his changes.
Comment 1 Mikayla Hutchinson [MSFT] 2012-04-18 20:12:13 UTC
Although this appears to be a simple problem, it's actually quite complex.

IIRC, VS only sets the TargetFramework element when the user changes the value in the UI. However, new projects in VS are created by copying csproj files verbatim from templates, and these templates often have no explicit TargetFramework value, therefore this property has the default value. This means it's not unusual to have VS-created csproj files with no TargetFramework value.

MD loads projects into an internal model, and serializes them back out when saving them. Properties with the default value are removed/cleared when serializing. This  simplifies csproj files, and IIRC for properties where the value has not been explictly modified in VS, it actually reduces diff noise. Reducing diff noise further would necessitate much more complex handling.
Comment 2 Lluis Sanchez 2012-05-03 09:42:55 UTC
One solution to this would be too keep the TargetFrameworkVersion element if it was already present when the project was loaded, and if the target framework has not changed.
Comment 3 Mikayla Hutchinson [MSFT] 2012-05-03 12:47:40 UTC
Or maybe we could always set the element, unless it was not already there and the project's framework has the default value. That would match VS more closely IMO.
Comment 4 Mikayla Hutchinson [MSFT] 2013-02-10 20:43:02 UTC
Bug 7914 has a patch.

*** This bug has been marked as a duplicate of bug 7914 ***