|
1 | 1 | <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
2 | 2 |
|
3 | | - <UsingTask TaskName="Microsoft.Maui.Controls.Build.Tasks.XamlGTask" AssemblyFile="$(MSBuildThisFileDirectory)Microsoft.Maui.Controls.Build.Tasks.dll" /> |
4 | | - <UsingTask TaskName="Microsoft.Maui.Controls.Build.Tasks.CssGTask" AssemblyFile="$(MSBuildThisFileDirectory)Microsoft.Maui.Controls.Build.Tasks.dll" /> |
5 | 3 | <UsingTask TaskName="Microsoft.Maui.Controls.Build.Tasks.XamlCTask" AssemblyFile="$(MSBuildThisFileDirectory)Microsoft.Maui.Controls.Build.Tasks.dll" /> |
6 | 4 |
|
7 | 5 | <PropertyGroup> |
8 | 6 | <SynthesizeLinkMetadata>true</SynthesizeLinkMetadata> |
9 | 7 | <EnableDefaultXamlItems Condition="'$(EnableDefaultXamlItems)'==''">True</EnableDefaultXamlItems> |
10 | | - <_DefaultXamlItemsEnabled>False</_DefaultXamlItemsEnabled> |
11 | 8 | <EnableDefaultCssItems Condition="'$(EnableDefaultCssItems)'==''">True</EnableDefaultCssItems> |
12 | | - <_DefaultCssItemsEnabled>False</_DefaultCssItemsEnabled> |
13 | 9 | <!-- The WINUI check for this only runs when there is an empty string so I just convert false to an empty string to fall in line with our other properties --> |
14 | 10 | <SkipMicrosoftUIXamlCheckTargetPlatformVersion Condition="'$(SkipMicrosoftUIXamlCheckTargetPlatformVersion)'==''">true</SkipMicrosoftUIXamlCheckTargetPlatformVersion> |
15 | 11 | <SkipMicrosoftUIXamlCheckTargetPlatformVersion Condition="'$(SkipMicrosoftUIXamlCheckTargetPlatformVersion)'=='false'"></SkipMicrosoftUIXamlCheckTargetPlatformVersion> |
|
19 | 15 |
|
20 | 16 | <ItemGroup> |
21 | 17 | <ProjectCapability Include="Maui" Condition="'$(_ExcludeMauiProjectCapability)' != 'true'" /> |
| 18 | + <AvailableItemName Include="MauiXaml" /> |
| 19 | + <AvailableItemName Include="MauiCss" /> |
22 | 20 | </ItemGroup> |
23 | 21 |
|
24 | 22 | <!-- Check Tasks ABI and other validations --> |
|
48 | 46 | Text="Microsoft.Maui requires .NETFramework >= v4.6.1. You have '$(TargetFrameworkVersion)'" /> |
49 | 47 | </Target> |
50 | 48 |
|
51 | | - <!-- XamlG --> |
52 | | - <Target |
53 | | - Name="UpdateDesignTimeXaml" |
54 | | - DependsOnTargets="XamlG"/> |
55 | 49 |
|
56 | | - <PropertyGroup> |
57 | | - <CoreCompileDependsOn> |
58 | | - XamlG; |
59 | | - $(CoreCompileDependsOn); |
60 | | - </CoreCompileDependsOn> |
61 | | - </PropertyGroup> |
| 50 | + <!-- Inject MauiXaml and MauiCss as AdditionalFiles for partial type generation--> |
| 51 | + <Target Name="_MauiInjectXamlCssAdditionalFiles" |
| 52 | + BeforeTargets="GenerateMSBuildEditorConfigFileShouldRun" |
| 53 | + DependsOnTargets="$(CreateManifestResourceNamesDependsOn)"> |
| 54 | + <ItemGroup> |
| 55 | + <_MauiXamlWithResourceNames Remove="@(_MauiXamlWithResourceNames)" /> |
| 56 | + <_MauiXamlWithTargetPath Remove="@(_MauiXamlWithTargetPath)" /> |
| 57 | + <_MauiCssWithResourceNames Remove="@(_MauiCssWithResourceNames)" /> |
| 58 | + <_MauiCssWithTargetPath Remove="@(_MauiCssWithTargetPath)" /> |
| 59 | + </ItemGroup> |
| 60 | + |
| 61 | + <CreateCSharpManifestResourceName |
| 62 | + ResourceFiles="@(MauiXaml)" |
| 63 | + RootNamespace="$(RootNamespace)" |
| 64 | + UseDependentUponConvention="$(EmbeddedResourceUseDependentUponConvention)"> |
| 65 | + <Output TaskParameter="ResourceFilesWithManifestResourceNames" ItemName="_MauiXamlWithResourceNames" /> |
| 66 | + </CreateCSharpManifestResourceName> |
| 67 | + |
| 68 | + <CreateCSharpManifestResourceName |
| 69 | + ResourceFiles="@(MauiCss)" |
| 70 | + RootNamespace="$(RootNamespace)" |
| 71 | + UseDependentUponConvention="$(EmbeddedResourceUseDependentUponConvention)"> |
| 72 | + <Output TaskParameter="ResourceFilesWithManifestResourceNames" ItemName="_MauiCssWithResourceNames" /> |
| 73 | + </CreateCSharpManifestResourceName> |
| 74 | + |
| 75 | + <AssignTargetPath Files="@(_MauiXamlWithResourceNames)" RootFolder="$(MSBuildProjectDirectory)"> |
| 76 | + <Output TaskParameter="AssignedFiles" ItemName="_MauiXamlWithTargetPath" /> |
| 77 | + </AssignTargetPath> |
| 78 | + |
| 79 | + <AssignTargetPath Files="@(_MauiCssWithResourceNames)" RootFolder="$(MSBuildProjectDirectory)"> |
| 80 | + <Output TaskParameter="AssignedFiles" ItemName="_MauiCssWithTargetPath" /> |
| 81 | + </AssignTargetPath> |
| 82 | + |
| 83 | + <ItemGroup> |
| 84 | + <AdditionalFiles Include="@(_MauiXamlWithTargetPath)" ManifestResourceName="%(ManifestResourceName)" TargetPath="%(TargetPath)" ItemSpec="%(OriginalItemSpec)" GenKind="Xaml"/> |
| 85 | + <AdditionalFiles Include="@(_MauiCssWithTargetPath)" ManifestResourceName="%(ManifestResourceName)" TargetPath="%(TargetPath)" ItemSpec="%(OriginalItemSpec)" GenKind="Css"/> |
| 86 | + <_MauiXamlWithResourceNames Remove="@(_MauiXamlWithResourceNames)" /> |
| 87 | + <_MauiXamlWithTargetPath Remove="@(_MauiXamlWithTargetPath)" /> |
| 88 | + <_MauiCssWithResourceNames Remove="@(_MauiCssWithResourceNames)" /> |
| 89 | + <_MauiCssWithTargetPath Remove="@(_MauiCssWithTargetPath)" /> |
| 90 | + </ItemGroup> |
| 91 | + </Target> |
62 | 92 |
|
63 | | - <Target |
64 | | - Name="_FindXamlGFiles" |
65 | | - DependsOnTargets="PrepareResourceNames"> |
66 | | - <ItemGroup> |
67 | | - <_XamlGInputs |
68 | | - Include="@(EmbeddedResource)" |
69 | | - Condition="'%(Extension)' == '.xaml' AND '$(DefaultLanguageSourceExtension)' == '.cs' AND '%(TargetPath)' != ''" /> |
70 | | - <_XamlGOutputs |
71 | | - Include="@(_XamlGInputs->'$(IntermediateOutputPath)%(TargetPath).g.cs')" /> |
72 | | - </ItemGroup> |
73 | | - </Target> |
74 | 93 |
|
75 | | - <Target |
76 | | - Name="XamlG" |
77 | | - BeforeTargets="BeforeCompile" |
78 | | - DependsOnTargets="_FindXamlGFiles; PrepareResourceNames; AfterResolveReferences" |
79 | | - Inputs="@(_XamlGInputs)" |
80 | | - Outputs="@(_XamlGOutputs)"> |
81 | | - <PropertyGroup> |
82 | | - <ReferencedAssemblies>@(ReferencePath)</ReferencedAssemblies> |
83 | | - </PropertyGroup> |
84 | | - <XamlGTask |
85 | | - XamlFiles="@(_XamlGInputs)" |
86 | | - OutputFiles="@(_XamlGOutputs)" |
87 | | - Language="$(Language)" |
88 | | - References = "$(ReferencedAssemblies)" |
89 | | - AssemblyName="$(AssemblyName)" /> |
90 | | - <ItemGroup> |
91 | | - <FileWrites Include="@(_XamlGOutputs)" /> |
92 | | - <Compile Include="@(_XamlGOutputs)" /> |
93 | | - </ItemGroup> |
94 | | - </Target> |
| 94 | + <!-- re-add MauiXaml and MauiCss as EmbeddedResources --> |
| 95 | + <PropertyGroup> |
| 96 | + <PrepareResourcesDependsOn> |
| 97 | + _MauiAddXamlEmbeddedResources; |
| 98 | + $(PrepareResourcesDependsOn); |
| 99 | + </PrepareResourcesDependsOn> |
| 100 | + </PropertyGroup> |
| 101 | + <Target Name="_MauiAddXamlEmbeddedResources"> |
| 102 | + <ItemGroup> |
| 103 | + <EmbeddedResource Include="@(MauiXaml)" /> |
| 104 | + <EmbeddedResource Include="@(MauiCss)" /> |
| 105 | + </ItemGroup> |
| 106 | + </Target> |
95 | 107 |
|
96 | 108 | <!-- XamlC --> |
97 | 109 | <PropertyGroup> |
|
103 | 115 |
|
104 | 116 | <Target Name="XamlC" |
105 | 117 | AfterTargets="AfterCompile" |
106 | | - DependsOnTargets="_FindXamlGFiles" |
107 | 118 | Inputs="$(IntermediateOutputPath)$(TargetFileName)" |
108 | 119 | Outputs="$(IntermediateOutputPath)XamlC.stamp" |
109 | | - Condition=" '$(DesignTimeBuild)' != 'True' AND '@(_XamlGInputs->Count())' != '0' "> |
| 120 | + Condition=" '$(DesignTimeBuild)' != 'True' AND '@(MauiXaml)' != ''"> |
110 | 121 | <PropertyGroup> |
111 | 122 | <_MauiXamlCValidateOnly>$(MauiXamlCValidateOnly)</_MauiXamlCValidateOnly> |
112 | 123 | <_MauiXamlCValidateOnly Condition="'$(BuildingForLiveUnitTesting)' == 'True' ">True</_MauiXamlCValidateOnly> |
|
124 | 135 | <FileWrites Include="$(IntermediateOutputPath)XamlC.stamp" /> |
125 | 136 | </ItemGroup> |
126 | 137 | </Target> |
127 | | - |
128 | | - <!-- CssG --> |
129 | | - <PropertyGroup> |
130 | | - <CoreCompileDependsOn> |
131 | | - CssG; |
132 | | - $(CoreCompileDependsOn); |
133 | | - </CoreCompileDependsOn> |
134 | | - </PropertyGroup> |
135 | | - |
136 | | - <Target Name="_FindCSSFiles" DependsOnTargets="PrepareResourceNames"> |
137 | | - <ItemGroup> |
138 | | - <_CSSInputs Include="@(EmbeddedResource)" Condition="'%(Extension)' == '.css' AND '$(DefaultLanguageSourceExtension)' == '.cs' AND '%(TargetPath)' != ''" /> |
139 | | - <_CSSOutputs Include="@(_CSSInputs->'$(IntermediateOutputPath)%(TargetPath).g.cs')" /> |
140 | | - </ItemGroup> |
141 | | - </Target> |
142 | | - |
143 | | - <Target Name="CssG" BeforeTargets="BeforeCompile" DependsOnTargets="_FindCSSFiles" Inputs="@(_CSSInputs)" Outputs="@(_CSSOutputs)"> |
144 | | - <CssGTask |
145 | | - CSSFiles="@(_CSSInputs)" |
146 | | - OutputFiles="@(_CSSOutputs)" |
147 | | - Language = "$(Language)" |
148 | | - AssemblyName = "$(AssemblyName)" /> |
149 | | - <ItemGroup> |
150 | | - <FileWrites Include="@(_CSSOutputs)" /> |
151 | | - <Compile Include="@(_CSSOutputs)" /> |
152 | | - </ItemGroup> |
153 | | - </Target> |
154 | 138 |
|
155 | 139 | <!-- |
156 | 140 | Platform Specific Targets. |
|
0 commit comments