|
1 | 1 | <Project>
|
| 2 | + |
2 | 3 | <PropertyGroup>
|
3 | 4 | <EnableLibraryImportGenerator Condition="'$(EnableLibraryImportGenerator)' == '' and
|
4 | 5 | '$(MSBuildProjectName)' == 'System.Private.CoreLib'">true</EnableLibraryImportGenerator>
|
|
13 | 14 | <!-- If the current project is not System.Private.CoreLib, we enable the LibraryImportGenerator source generator
|
14 | 15 | when the project is a C# source project that:
|
15 | 16 | - doesn't target the latest TFM or
|
16 |
| - - references everything from the targeting pack (OOB) or |
| 17 | + - doesn't reference the targeting pack (i.e. when inbox) and |
17 | 18 | - references System.Private.CoreLib, or
|
18 | 19 | - references System.Runtime.InteropServices -->
|
19 | 20 | <EnabledGenerators Include="LibraryImportGenerator"
|
|
22 | 23 | '$(MSBuildProjectExtension)' == '.csproj' and
|
23 | 24 | (
|
24 | 25 | '$(TargetFrameworkMoniker)' != '$(NetCoreAppCurrentTargetFrameworkMoniker)' or
|
25 |
| - '$(DisableImplicitFrameworkReferences)' != 'true' or |
26 |
| - ( |
27 |
| - '@(Reference)' != '' and |
28 |
| - @(Reference->AnyHaveMetadataValue('Identity', 'System.Runtime.InteropServices')) |
29 |
| - ) or |
30 | 26 | (
|
31 |
| - '@(ProjectReference)' != '' and |
32 |
| - @(ProjectReference->AnyHaveMetadataValue('Identity', '$(CoreLibProject)')) |
| 27 | + '$(DisableImplicitFrameworkReferences)' == 'true' and |
| 28 | + ( |
| 29 | + '@(Reference->AnyHaveMetadataValue('Identity', 'System.Runtime.InteropServices'))' == 'true' or |
| 30 | + '@(ProjectReference->AnyHaveMetadataValue('Identity', '$(CoreLibProject)'))' == 'true' |
| 31 | + ) |
33 | 32 | )
|
34 | 33 | )" />
|
35 | 34 | <!-- We enable the ComInterfaceGenerator source generator
|
36 | 35 | when the project is a C# source project that:
|
37 |
| - - References everything from the targeting pack (OOB) or |
| 36 | + - Doesn't reference the targeting pack (i.e. when inbox) and |
38 | 37 | - references System.Runtime.InteropServices -->
|
39 | 38 | <EnabledGenerators Include="ComInterfaceGenerator"
|
40 | 39 | Condition="'$(IsSourceProject)' == 'true' and
|
41 | 40 | '$(MSBuildProjectExtension)' == '.csproj' and
|
42 | 41 | (
|
43 |
| - '$(DisableImplicitFrameworkReferences)' != 'true' or |
| 42 | + '$(TargetFrameworkMoniker)' != '$(NetCoreAppCurrentTargetFrameworkMoniker)' or |
44 | 43 | (
|
45 |
| - '@(Reference)' != '' and |
46 |
| - @(Reference->AnyHaveMetadataValue('Identity', 'System.Runtime.InteropServices')) |
| 44 | + '$(DisableImplicitFrameworkReferences)' == 'true' and |
| 45 | + '@(Reference->AnyHaveMetadataValue('Identity', 'System.Runtime.InteropServices'))' == 'true' |
47 | 46 | )
|
48 | 47 | )" />
|
49 | 48 | </ItemGroup>
|
|
61 | 60 | <ProjectReference Include="$(LibrariesProjectRoot)System.Runtime.InteropServices\gen\Microsoft.Interop.SourceGeneration\Microsoft.Interop.SourceGeneration.csproj"
|
62 | 61 | ReferenceOutputAssembly="false"
|
63 | 62 | OutputItemType="Analyzer" />
|
64 |
| - </ItemGroup> |
65 |
| - <ItemGroup Condition="'@(EnabledGenerators)' != '' and |
66 |
| - @(EnabledGenerators->AnyHaveMetadataValue('Identity', 'LibraryImportGenerator'))"> |
67 | 63 | <ProjectReference Include="$(LibrariesProjectRoot)System.Runtime.InteropServices\gen\LibraryImportGenerator\LibraryImportGenerator.csproj"
|
68 | 64 | ReferenceOutputAssembly="false"
|
69 |
| - OutputItemType="Analyzer" /> |
70 |
| - </ItemGroup> |
71 |
| - <ItemGroup Condition="'@(EnabledGenerators)' != '' and |
72 |
| - @(EnabledGenerators->AnyHaveMetadataValue('Identity', 'ComInterfaceGenerator'))"> |
| 65 | + OutputItemType="Analyzer" |
| 66 | + Condition="@(EnabledGenerators->AnyHaveMetadataValue('Identity', 'LibraryImportGenerator'))" /> |
73 | 67 | <ProjectReference Include="$(LibrariesProjectRoot)System.Runtime.InteropServices\gen\ComInterfaceGenerator\ComInterfaceGenerator.csproj"
|
74 | 68 | ReferenceOutputAssembly="false"
|
75 |
| - OutputItemType="Analyzer" /> |
| 69 | + OutputItemType="Analyzer" |
| 70 | + Condition="@(EnabledGenerators->AnyHaveMetadataValue('Identity', 'ComInterfaceGenerator'))" /> |
76 | 71 | </ItemGroup>
|
77 | 72 |
|
78 | 73 | <Target Name="ConfigureGenerators"
|
|
87 | 82 | <PropertyGroup>
|
88 | 83 | <LibraryImportGenerator_UseMarshalType>true</LibraryImportGenerator_UseMarshalType>
|
89 | 84 | </PropertyGroup>
|
90 |
| - |
91 |
| - <ItemGroup Condition="'$(NetCoreAppCurrentTargetFrameworkMoniker)' == '$(TargetFrameworkMoniker)' and '$(IncludeLibraryImportGeneratorSources)' != 'false'"> |
92 |
| - </ItemGroup> |
93 | 85 | </Target>
|
94 | 86 |
|
95 | 87 | <Import Project="$(LibrariesProjectRoot)System.Runtime.InteropServices\gen\LibraryImportGenerator\Microsoft.Interop.LibraryImportGenerator.props" />
|
| 88 | + |
96 | 89 | </Project>
|
0 commit comments