Bug 25627 - Shared projects fail to build XAML files correctly in 1.3
Summary: Shared projects fail to build XAML files correctly in 1.3
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.3.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-12-27 12:47 UTC by Adam Kemp
Modified: 2015-01-12 17:48 UTC (History)
6 users (show)

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


Attachments
Test project (3.55 MB, application/zip)
2014-12-27 12:47 UTC, Adam Kemp
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 Adam Kemp 2014-12-27 12:47:41 UTC
Created attachment 9193 [details]
Test project

If I try to add a XAML file to a shared project in Xamarin.Forms 1.3 the project fails to build with this error:

MyPage.xaml.cs(11,13): error CS0103: The name `InitializeComponent' does not exist in the current context

It doesn't seem to be doing anything with the XAML file as far as I can tell so the code-behind fails to compile. This works with PCL projects.

See the attached project.
Comment 1 Adam Kemp 2014-12-27 12:49:16 UTC
FYI, I am building in Xamarin Studio, and this issue was discovered via this
forum post:

http://forums.xamarin.com/discussion/comment/94635/#Comment_94635
Comment 2 Andy Hopper 2014-12-27 18:18:39 UTC
It appears to be a bug in the Xamarin Studio iOS build system; command-line builds with xbuild work, building in Visual Studio or using MSBuild via the Build Host infrastructure works as well.
Comment 3 CraigD 2014-12-28 05:58:11 UTC
This is a known issue with using XAML in a Xamarin.Forms project in Xamarin Studio on OS X.

See the yellow box warning in [getting started with XAML]

http://developer.xamarin.com/guides/cross-platform/xamarin-forms/xaml-for-xamarin-forms/getting_started_with_xaml/#Creating_the_Page

The fix is to enable **MSBuild** for the iOS project in Xamarin Studio; explained in the [getting started with XAML] doc:

http://developer.xamarin.com/guides/cross-platform/xamarin-forms/xaml-for-xamarin-forms/getting_started_with_xaml/#experimental_sap_xaml


For various other reasons, we recommend using PCL projects wherever possible for Xamarin.Forms, *especially* if you plan to use XAML or other types of embedded resource.
Comment 4 Sunil Kumar 2014-12-29 05:51:53 UTC
I have tried to reproduce this issue and I am also getting the same issue. I downloaded the attached sample and build it, it shows the same error mentioned in bug description.

Screencast: http://www.screencast.com/t/nClZkcsHw
Build Output: https://gist.github.com/sunil360/92eae8fe7ca2b0e9fbde
IDE log: https://gist.github.com/sunil360/59696110d4d662d61fe2

As per comment 3, this is a known issue, so I am marking this issue as confirmed.

Environment info:
Xamarin.Forms Version 1.3.0.6292

=== Xamarin Studio ===

Version 5.7 (build 660)
Installation UUID: 561c7a69-0a91-4bae-ad7c-f0c79d594337
Runtime:
	Mono 3.12.0 ((detached/a813491)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000068

=== Apple Developer Tools ===

Xcode 5.1.1 (5085)
Build 5B1008

=== Xamarin.iOS ===

Version: 8.6.0.45 (Business Edition)
Hash: 0376f62
Branch: 
Build date: 2014-12-23 17:34:21-0500

=== Xamarin.Android ===

Version: 4.20.0.28 (Business Edition)
Android SDK: /Users/tajinder/Desktop/android-sdk-macosx
	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)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin.Mac ===

Version: 1.11.3.0 (Business Edition)

=== Build Information ===

Release ID: 507000660
Git revision: 6a74f9bdb90d9415b597064d815c9be38b401fee
Build date: 2014-12-18 00:38:00-05
Xamarin addins: 57be0f5e1433cb58b70ea9b52e9dc77ad791be40

=== Operating System ===

Mac OS X 10.8.4
Darwin Tajinders-iMac.local 12.4.2 Darwin Kernel Version 12.4.2
    Mon Jun 17 18:00:12 PDT 2013
    root:xnu-2050.45.8~1/RELEASE_X86_64 x86_64