Xcc.targets 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <!--
  2. ***********************************************************************************************
  3. Xcc.targets
  4. WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
  5. created a backup copy.
  6. Copyright (C) First Floor Software. All rights reserved.
  7. ***********************************************************************************************
  8. -->
  9. <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  10. <UsingTask TaskName="PreprocessXaml" AssemblyFile="$(MSBuildThisFileDirectory)..\tools\Xcc.dll" />
  11. <Target Name="GenerateXaml" BeforeTargets="MarkupCompilePass1" AfterTargets="_PreXamlG">
  12. <!-- create collection for embedded xaml resources -->
  13. <CreateItem Include="@(EmbeddedResource)" Condition="'%(Extension)' == '.xaml'">
  14. <Output TaskParameter="Include" ItemName="EmbeddedXamlResource"/>
  15. </CreateItem>
  16. <PropertyGroup Label="Globals">
  17. <!-- support for .NET projects (used by default) -->
  18. <PreprocessorDefinitions>$(DefineConstants)</PreprocessorDefinitions>
  19. <!--Ensure atleast one constant is defined. If none are defined, the $(DefineConstants) property is empty.
  20. This can happen in Release builds without Trace defined for WPF projects and will error the build on the PreprocessXaml task.-->
  21. <PreprocessorDefinitions Condition="'$(PreprocessorDefinitions)' == ''">XCC</PreprocessorDefinitions>
  22. <PreprocessorDefinitions Condition="'$(PreprocessorDefinitions)' != ''">$(PreprocessorDefinitions);XCC</PreprocessorDefinitions>
  23. <!-- support for Visual C++ projects (will override the definition above as 'DefineConstants' and 'ClCompile.PreprocessorDefinitions' cannot be co-existant) -->
  24. <PreprocessorDefinitions Condition="%(ClCompile.PreprocessorDefinitions) != ''">%(ClCompile.PreprocessorDefinitions)</PreprocessorDefinitions>
  25. </PropertyGroup>
  26. <!-- ensure __ANDROID__ symbol is defined when targetting Android platform with .NET -->
  27. <PropertyGroup Condition="'$(DefineConstants)' != '' and '$(TargetFrameworkIdentifier)' == 'MonoAndroid'">
  28. <PreprocessorDefinitions Condition="'$(PreprocessorDefinitions)' == ''">__ANDROID__;$(DefineConstants)</PreprocessorDefinitions>
  29. <!-- Make sure changes to 'PreprocessorDefinitions' are preserved (could make future updates easier) -->
  30. <PreprocessorDefinitions Condition="'$(PreprocessorDefinitions)' != ''">__ANDROID__;$(PreprocessorDefinitions)</PreprocessorDefinitions>
  31. </PropertyGroup>
  32. <!-- preprocess xaml pages -->
  33. <PreprocessXaml ApplicationDefinitions="@(ApplicationDefinition)"
  34. Pages="@(Page)"
  35. EmbeddedXamlResources="@(EmbeddedXamlResource)"
  36. DefinedSymbols="$(PreprocessorDefinitions)"
  37. OutputPath="$(IntermediateOutputPath)preprocessedxaml\">
  38. <Output ItemName="NewApplicationDefinition" TaskParameter="NewApplicationDefinitions" />
  39. <Output ItemName="NewPage" TaskParameter="NewPages" />
  40. <Output ItemName="NewEmbeddedXamlResource" TaskParameter="NewEmbeddedXamlResources" />
  41. <Output ItemName="FileWrites" TaskParameter="GeneratedFiles" />
  42. </PreprocessXaml>
  43. <ItemGroup>
  44. <ApplicationDefinition Remove="@(ApplicationDefinition)" />
  45. <Page Remove="@(Page)" />
  46. <EmbeddedResource Remove="@(EmbeddedXamlResource)" />
  47. <ApplicationDefinition Include="@(NewApplicationDefinition)" />
  48. <Page Include="@(NewPage)" />
  49. <EmbeddedResource Include="@(NewEmbeddedXamlResource)" />
  50. </ItemGroup>
  51. </Target>
  52. </Project>