|
14 | 14 | <!-- Public members should not use oblivious types. Not done with all nullable annotations. --> |
15 | 15 | <NoWarn>$(NoWarn);RS0041</NoWarn> |
16 | 16 | </PropertyGroup> |
17 | | - <ItemGroup Condition=" '$(IsImplementationProject)' == 'true' AND |
| 17 | + |
| 18 | + <ItemGroup Condition=" Exists('$(MSBuildProjectDirectory)\PublicAPI.*.txt') AND |
| 19 | + '$(IsImplementationProject)' == 'true' AND |
18 | 20 | '$(DotNetBuildFromSource)' != 'true' AND |
19 | 21 | ! $(RepoRelativeProjectDir.Contains('Tools')) "> |
20 | | - <!-- Package does nothing in projects lacking PublicAPI.Shipped.txt or PublicAPI.Unshipped.txt files. --> |
21 | 22 | <Reference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" ExcludeAssets="Compile" PrivateAssets="All" /> |
22 | | - |
23 | | - <AdditionalFiles Include="PublicAPI.Shipped.txt" |
24 | | - Condition=" Exists('$(MSBuildProjectDirectory)\PublicAPI.Shipped.txt') " /> |
25 | | - <AdditionalFiles Include="PublicAPI.Unshipped.txt" |
26 | | - Condition=" Exists('$(MSBuildProjectDirectory)\PublicAPI.Unshipped.txt') " /> |
27 | | - <AdditionalFiles Include="PublicAPI.Shipped.txt" |
28 | | - Condition=" Exists('$(MSBuildProjectDirectory)\$(_TFMDirectory)\PublicAPI.Shipped.txt') " /> |
29 | | - <AdditionalFiles Include="PublicAPI.Unshipped.txt" |
30 | | - Condition=" Exists('$(MSBuildProjectDirectory)\$(_TFMDirectory)\PublicAPI.Unshipped.txt') " /> |
31 | 23 | </ItemGroup> |
| 24 | + <Target Name="_CheckIgnoredPublicApiFiles" |
| 25 | + BeforeTargets="Build;Restore" |
| 26 | + Condition=" Exists('$(MSBuildProjectDirectory)\PublicAPI.*.txt') AND |
| 27 | + !('$(IsImplementationProject)' == 'true' AND |
| 28 | + '$(DotNetBuildFromSource)' != 'true' AND |
| 29 | + ! $(RepoRelativeProjectDir.Contains('Tools'))) "> |
| 30 | + <Warning Text="Public API baseline files ignored." /> |
| 31 | + </Target> |
32 | 32 |
|
33 | 33 | <Target Name="GetCustomAssemblyAttributes" |
34 | 34 | BeforeTargets="GetAssemblyAttributes" |
|
0 commit comments