|
7 | 7 | <DependencyPropertyGeneratorUseWindowsUIXaml Condition="'$(DependencyPropertyGeneratorUseWindowsUIXaml)' == '' AND '$(UseUwp)' != 'true'">false<DependencyPropertyGeneratorUseWindowsUIXaml> |
8 | 8 | </PropertyGroup> |
9 | 9 |
|
| 10 | + <!-- Properties for the embedded mode, with defaults --> |
| 11 | + <PropertyGroup> |
| 12 | + <EnableGeneratedDependencyPropertyAttributeEmbeddedMode Condition="'$(EnableGeneratedDependencyPropertyAttributeEmbeddedMode)' == ''">false</EnableGeneratedDependencyPropertyAttributeEmbeddedMode> |
| 13 | + <EnableGeneratedDependencyPropertyEmbeddedMode Condition="'$(EnableGeneratedDependencyPropertyEmbeddedMode)' == ''">false</EnableGeneratedDependencyPropertyEmbeddedMode> |
| 14 | + </PropertyGroup> |
| 15 | + |
10 | 16 | <!-- Allow the source generators to detect the selected XAML mode --> |
11 | 17 | <ItemGroup> |
12 | 18 | <CompilerVisibleProperty Include="DependencyPropertyGeneratorUseWindowsUIXaml" /> |
13 | 19 | </ItemGroup> |
14 | 20 |
|
15 | | - <!-- Define the 'GENERATED_DEPENDENCY_PROPERTY_USE_WINDOWS_UI_XAML' name, if needed --> |
16 | | - <PropertyGroup Condition="'$(EnableGeneratedDependencyPropertyEmbeddedMode)' == 'true' AND '$(DependencyPropertyGeneratorUseWindowsUIXaml)' == 'true'"> |
17 | | - <DefineConstants>$(DefineConstants);GENERATED_DEPENDENCY_PROPERTY_USE_WINDOWS_UI_XAML</DefineConstants> |
| 21 | + <!-- Define the build constants depending on the current configuration --> |
| 22 | + <PropertyGroup> |
| 23 | + <DefineConstants Condition="'$(DependencyPropertyGeneratorUseWindowsUIXaml)' == 'true'">$(DefineConstants);GENERATED_DEPENDENCY_PROPERTY_USE_WINDOWS_UI_XAML</DefineConstants> |
| 24 | + <DefineConstants Condition="'$(EnableGeneratedDependencyPropertyAttributeEmbeddedMode)' == 'true'">$(DefineConstants);GENERATED_DEPENDENCY_PROPERTY_ATTRIBUTE_EMBEDDED_MODE</DefineConstants> |
| 25 | + <DefineConstants Condition="'$(EnableGeneratedDependencyPropertyEmbeddedMode)' == 'true'">$(DefineConstants);GENERATED_DEPENDENCY_PROPERTY_EMBEDDED_MODE</DefineConstants> |
18 | 26 | </PropertyGroup> |
19 | 27 |
|
20 | 28 | <!-- Emit additional messages for invalid configurations when referencing the runtime library --> |
21 | 29 | <Target Name="CommunityToolkitGeneratedDependencyPropertyCheckForInvalidEmbeddedMode" |
22 | 30 | DependsOnTargets="ResolveAssemblyReferences" |
23 | 31 | BeforeTargets="CoreCompile" |
24 | | - Condition="'$(EnableGeneratedDependencyPropertyEmbeddedMode)' == 'true'"> |
| 32 | + Condition="'$(EnableGeneratedDependencyPropertyAttributeEmbeddedMode)' == 'true' OR '$(EnableGeneratedDependencyPropertyEmbeddedMode)' == 'true'"> |
25 | 33 | <ItemGroup> |
26 | 34 | <CommunityToolkitGeneratedDependencyPropertyUwpDllReferencePath Include="@(ReferencePath)" Condition="'%(Filename)%(Extension)' == 'CommunityToolkit.Uwp.GeneratedDependencyProperty.dll'" /> |
27 | 35 | <CommunityToolkitGeneratedDependencyPropertyWinUIDllReferencePath Include="@(ReferencePath)" Condition="'%(Filename)%(Extension)' == 'CommunityToolkit.WinUI.GeneratedDependencyProperty.dll'" /> |
|
36 | 44 | <Error Condition="'$(CommunityToolkitGeneratedDependencyPropertyDllReferenced)' == 'true'" |
37 | 45 | Code="WCTDPCFG0001" |
38 | 46 | HelpLink="https://aka.ms/toolkit/labs/windows" |
39 | | - Text="This project is referencing the '[GeneratedDependencyProperty]' .dll file, but it's also setting 'EnableGeneratedDependencyPropertyEmbeddedMode'. The embedded mode can only be used when the .dll file is not being referenced. Make sure to use 'PrivateAssets="all"' and 'ExcludeAssets="lib"' in the '<PackageReference>' element for the NuGet package." /> |
| 47 | + Text="This project is referencing the '[GeneratedDependencyProperty]' .dll file, but it's also enabling the embedded mode for its public APIs. The embedded mode can only be used when the .dll file is not being referenced. Make sure to use 'PrivateAssets="all"' and 'ExcludeAssets="lib"' in the '<PackageReference>' element for the NuGet package." /> |
40 | 48 | </Target> |
41 | 49 |
|
42 | 50 | <!-- Check the Roslyn version and warn if it's not high enough (we don't need to remove the analyzers, as they're leveraging multi-targeting) --> |
|
0 commit comments