Bug 11697 - Libraries no longer compile
Summary: Libraries no longer compile
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 4.6.x
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2013-04-10 04:52 UTC by Dave Wright
Modified: 2013-05-07 10:50 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 Dave Wright 2013-04-10 04:52:20 UTC
This morning I opened up Xamarin Studio and it automatically updated Android to 4.6.2.  After doing so the code I had that compiled fine yesterday no longer compiled, as it couldn't find a resource in a library.

So, I created a blank solution called LibraryTest with two projects - LibraryTest (an Android Application) and LibraryTestLibrary (an Android Library).  I added a reference to LibraryTestLibrary to LibraryTest and chose "Rebuild all".  Without typing even a single line of code it failed to compile, giving me the error:

'Library.Resource.String' does not contain a definition for 'library_name'

on the following line in Resource.designer.cs

LibraryTestLibrary.Resource.String.library_name = LibraryTest.Resource.String.library_name;

I'm using Windows 7 64-bit.  Below is a copy of the About dialog from Xamarin Studio:
=== Xamarin Studio ===
Version 4.0.3 (build 13)
Installation UUID: c1db51a3-86d8-4052-bb98-70043a95ae41
	Microsoft .NET 4.0.30319.18034
	GTK 2.24.13
	GTK# (
=== Xamarin.Android ===
Version: 4.6.2 (Starter Edition)
Android SDK: C:\Users\David.Wright\AppData\Local\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.0.3 (API level 15)
Java SDK: C:\Program Files (x86)\Java\jdk1.6.0_39
=== Build Information ===
Release ID: 400030013
Build date: 2013-03-21 15:53:00Z
Xamarin addins: 906a1edff23bcfd0ab7518463620a8ee506eaea2
=== Operating System ===
Windows 6.1.7601.65536 (64-bit)
Comment 1 Dave Wright 2013-04-10 05:30:13 UTC
For now, I've managed to make it work by creating a separate C# file in the Resources folder called ResourceHack.cs which looks like this:

public partial class Resource
	public partial class String
		public const int library_name = 2130968578;

Obviously this is only a temporary workaround though.
Comment 2 t9mike 2013-04-11 22:03:31 UTC
Seeing same issue on Mac for me. Others are seeing this per http://forums.xamarin.com/discussion/3066/app-resource-string-does-not-contain-a-definition-for-library_name.
Comment 3 Atsushi Eno 2013-04-12 04:52:49 UTC
Could you try 4.7.x in the alpha channel? It reportedly fixes such resource issues.
Comment 6 Dave Wright 2013-04-12 06:20:31 UTC
4.7.2 seems to have fixed it.  Thanks!
Comment 8 Jonathan Pryor 2013-04-13 22:28:12 UTC
Fixed in monodroid/bs1/f9e70f3f.

This should be fixed in the 4.6.4 stable release.