firstfloorsoftware / xcc

XAML Conditional Compilation
Microsoft Public License
58 stars 16 forks source link

Does not work with PCL version of Xamarin? #13

Closed wouterroos closed 8 years ago

wouterroos commented 8 years ago

Hello,

I'm trying to get this gem to work with a Xamarin.Forms PCL project but the conditional xaml is not showing up when building the application. Are PCL projects supported?

kozw commented 8 years ago

I guess it should. You are using xcc on a windows box?

wouterroos commented 8 years ago

Yes, I'm currently using Xamarin.Forms 2.3.2.127. When I add the required namespaces and some conditional XAML (e.g. <android:Label/>), build the project for a specific platform and then look at the file in obj\Debug\preprocessedxaml\Views, the conditional code is always removed regardless of the platform used. One thing to mention is that I do use <XccRemoveIgnorableContent>True</XccRemoveIgnorableContent> to enable the use of the xmlns:d="http://schemas.microsoft.com/expression/blend/2008" namespace in order to get intellisense using d:DataContext. Could this have anything to do with the issues I'm having?

kozw commented 8 years ago

It's not XccRemoveIgnorableContent, it's the PCL project. The Android conditional compilation is never true for the standalone PCL project. PCL is platform independent. XCC works best with a shared project where the same XAML file is compiled in the various platform projects (with their corresponding conditional compilation symbols).

XCC in a PCL is probably only useful for debug and release builds.

So yes, this behavior is expected and correct.