Bug 167 - MonoDevelop add-in screws up resource casing.
Summary: MonoDevelop add-in screws up resource casing.
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Android Add-in ()
Version: 2.6 Beta 3
Hardware: PC Mac OS
: High normal
Target Milestone: ---
Assignee: shana@xamarin.com
URL:
Depends on:
Blocks:
 
Reported: 2011-08-03 17:23 UTC by Jonathan Pryor
Modified: 2012-02-15 17:01 UTC (History)
4 users (show)

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


Attachments
Sample Project. (13.25 KB, application/zip)
2011-08-03 17:25 UTC, Jonathan Pryor
Details


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:
Status:
RESOLVED FIXED

Description Jonathan Pryor 2011-08-03 17:23:18 UTC
To reproduce (in MonoDevelop 2.6b3 with the Mono for Android add-in 2.6.5 on Lion):

 1. Create a new Project.
 2. In the Solution panel, open the Project \ Resources \ Drawable folder.
 3. Select Icon.png.
 4. Press Command+R (and/or Right-click Icon.png -> Rename)
 5. Type "MyIcon.png", Enter.
 6. Open Activity1.cs
 7. Change the [Activity] attribute to:
    [Activity (Label = "KillMe", MainLauncher = true, Icon="@drawable/MyIcon")]
 8. Build.

Actual results:

Build failure: The Resource.Layout.Main resource doesn't exist.

If you open Resources\Resource.designer.cs, you'll see that there's a Resource.Layout.main member, but not Resource.Layout.Main. Ditto Resource.Drawable.myicon, as opposed to Resource.Drawable.MyIcon.

Expected results: No error.

Further info:

`xbuild` does the right thing:

    $ cd path/to/project
    $ touch *.csproj
    $ xbuild

Viewing Resources\Resource.designer.cs shows the properly cased values, e.g. Resource.Layout.Main and Resource.Designer.MyIcon.
Comment 1 Jonathan Pryor 2011-08-03 17:25:02 UTC
Created attachment 60 [details]
Sample Project.

This project has been modified in the manner described in steps 1-6.

Building with xbuild results in no errors; building with MonoDevelop results in compilation errors.
Comment 2 Jonathan Pryor 2011-08-03 17:39:28 UTC
Mono for Android build log output:


Target _UpdateAndroidResgen needs to be built as input file '/Volumes/Macintosh HD/Users/jon/Development/Projects/ScratchHW/ScratchHW/obj/Debug/res/layout/main.axml' is newer than output file 'obj/Debug/R.cs.flag'
	
	Target _UpdateAndroidResgen:
	Target _UpdateAndroidResgen needs to be built as input file '/Volumes/Macintosh HD/Users/jon/Development/Projects/ScratchHW/ScratchHW/obj/Debug/res/layout/main.axml' is newer than output file 'obj/Debug/R.cs.flag'
	Task "AndroidResgen"
		Using task AndroidResgen from Novell.MonoDroid.Build.Tasks.AndroidResgen, Novell.MonoDroid.Build.Tasks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
		AndroidResgen Task
		  ResourceDirectory: /Users/jon/Development/Projects/ScratchHW/ScratchHW/obj/Debug/res/
		  ResgenOutputFile: Resources/Resource.designer.cs
		  Namespace: ScratchHW
		  Class: Resource
		  JavaSdkDirectory: /usr/
		  AndroidSdkDirectory: /opt/android/sdk/
		  AndroidSdkPlatform: 7
		  MonoAndroidToolsDirectory: /Developer/MonoAndroid/usr/lib/mandroid/
		  ExtraArgs: 
		Tool /Developer/MonoAndroid/usr/lib/mandroid/aresgen.exe execution started with arguments: -o="Resources/Resource.designer.cs" --package="ScratchHW.ScratchHW" --sdk-dir="/opt/android/sdk/" --java-sdk-dir="/usr/" --sdk-platform="7" --namespace="ScratchHW" --type="Resource" -v -S "/Users/jon/Development/Projects/ScratchHW/ScratchHW/obj/Debug/res/" 
		Environment variables being passed to the tool:
			path=/usr/bin:/Volumes/Macintosh HD/Applications/MonoDevelop.app/Contents/MacOS/bin:/Library/Frameworks/Mono.framework/Versions/Current/bin:/usr/bin:/bin:/usr/sbin:/sbin
		Creating directory: /var/folders/9s/m6r4lyb53m56jsrmc3rhd2r00000gn/T/j41ei4v2.67p
		Running command: /opt/android/sdk/platform-tools/aapt "package" "-M" "/var/folders/9s/m6r4lyb53m56jsrmc3rhd2r00000gn/T/j41ei4v2.67p/AndroidManifest.xml" "-J" "/var/folders/9s/m6r4lyb53m56jsrmc3rhd2r00000gn/T/j41ei4v2.67p" "-F" "/var/folders/9s/m6r4lyb53m56jsrmc3rhd2r00000gn/T/j41ei4v2.67p/resources.apk" "-S" "/Users/jon/Development/Projects/ScratchHW/ScratchHW/obj/Debug/res/" "-I" "/opt/android/sdk/platforms/android-7/android.jar"
			Process executed in: 00:00:00.5160510
		Removing directory: /var/folders/9s/m6r4lyb53m56jsrmc3rhd2r00000gn/T/j41ei4v2.67p
		Tool /Developer/MonoAndroid/usr/lib/mandroid/aresgen.exe execution finished.
	Done executing task "AndroidResgen"
Comment 3 Jonathan Pryor 2011-08-03 17:40:18 UTC
xbuild output:

	Target _UpdateAndroidResgen:
		AndroidResgen Task
		  ResourceDirectory: /Volumes/Macintosh HD/Users/jon/Development/Projects/ScratchHW/ScratchHW/obj/Debug/res/
		  ResgenOutputFile: Resources/Resource.designer.cs
		  Namespace: ScratchHW
		  Class: Resource
		  JavaSdkDirectory: /usr/
		  AndroidSdkDirectory: /opt/android/sdk/
		  AndroidSdkPlatform: 7
		  MonoAndroidToolsDirectory: /Developer/MonoAndroid/usr/lib/mandroid/
		  ExtraArgs: 
		Tool /Developer/MonoAndroid/usr/lib/mandroid/aresgen.exe execution started with arguments: -o="Resources/Resource.designer.cs" --package="ScratchHW.ScratchHW" --sdk-dir="/opt/android/sdk/" --java-sdk-dir="/usr/" --sdk-platform="7" --namespace="ScratchHW" --type="Resource" --resource:layout/main.axml,layout/Main.axml --resource:values/strings.xml,values/Strings.xml --resource:drawable/icon.png,drawable/Icon.png -v -S "/Volumes/Macintosh HD/Users/jon/Development/Projects/ScratchHW/ScratchHW/obj/Debug/res/" 
		Creating directory: /var/folders/9s/m6r4lyb53m56jsrmc3rhd2r00000gn/T/q9chr5b1.7v7
		Running command: /opt/android/sdk/platform-tools/aapt "package" "-M" "/var/folders/9s/m6r4lyb53m56jsrmc3rhd2r00000gn/T/q9chr5b1.7v7/AndroidManifest.xml" "-J" "/var/folders/9s/m6r4lyb53m56jsrmc3rhd2r00000gn/T/q9chr5b1.7v7" "-F" "/var/folders/9s/m6r4lyb53m56jsrmc3rhd2r00000gn/T/q9chr5b1.7v7/resources.apk" "-S" "/Volumes/Macintosh HD/Users/jon/Development/Projects/ScratchHW/ScratchHW/obj/Debug/res/" "-I" "/opt/android/sdk/platforms/android-7/android.jar"
			Process executed in: 00:00:00.5122860
		Removing directory: /var/folders/9s/m6r4lyb53m56jsrmc3rhd2r00000gn/T/q9chr5b1.7v7
		Deleting file '/Volumes/Macintosh HD/Users/jon/Development/Projects/ScratchHW/ScratchHW/obj/Debug/R.cs.flag'
Comment 4 Jonathan Pryor 2011-08-03 17:40:43 UTC
Aside: Worse is that you can actually skip steps 2-7: the default project doesn't build!
Comment 5 Jonathan Pryor 2011-08-03 17:41:55 UTC
When comparing Comment #2 to Comment #3, the primary cause for the change is that xbuild (Comment #3) contains --resource: flags, while MonoDevelop does not. --resource is used to rename the members.

Why doesn't MonoDevelop's build include the --resource flags to aresgen.exe?
Comment 7 Jonathan Pryor 2011-08-11 22:05:57 UTC
...and now i'm not able to easily reproduce. It's...inconsistent.

If it does happen, close the solution within MonoDevelop. Open Terminal:

    $ cd path/to/project
    $ touch *.csproj Resources/*/*.axml
    $ open *.sln # or the .csproj...

At this point, MonoDevelop usually builds w/o error, and I can see --resource in the build output.
Comment 8 Jeffrey Stedfast 2012-02-15 17:01:25 UTC
This seems to be fixed in 2.8.6.4?