|
16 | 16 | <!-- Public members should not use oblivious types. Not done with all nullable annotations. --> |
17 | 17 | <NoWarn>$(NoWarn);RS0041</NoWarn> |
18 | 18 |
|
19 | | - <Nullable Condition=" '$(Nullable)' == '' AND ( |
20 | | - '$(IsImplementationProject)' == 'true' OR |
| 19 | + <_IsSrcProject Condition="'$(IsImplementationProject)' == 'true' OR |
21 | 20 | '$(IsAnalyzersProject)' == true OR |
22 | | - '$(IsSpecificationTestProject)' == 'true') ">enable</Nullable> |
| 21 | + '$(IsSpecificationTestProject)' == 'true'">true</_IsSrcProject> |
| 22 | + |
| 23 | + <Nullable Condition=" '$(Nullable)' == '' AND '$(_IsSrcProject)' == 'true'">enable</Nullable> |
23 | 24 |
|
24 | 25 | <!-- Strip out non-public nullable annotations for src projects. This should help with size reduction --> |
25 | | - <Features Condition=" |
26 | | - '$(IsImplementationProject)' == 'true' OR |
27 | | - '$(IsAnalyzersProject)' == true OR |
28 | | - '$(IsSpecificationTestProject)' == 'true'">$(Features);nullablePublicOnly</Features> |
| 26 | + <Features Condition="'$(_IsSrcProject)' == 'true'">$(Features);nullablePublicOnly</Features> |
29 | 27 |
|
30 | 28 | <!-- Turn off platform compatibility analyzer warnings in test, test assets, and samples. --> |
31 | 29 | <NoWarn Condition=" '$(IsTestProject)' == 'true' OR |
|
41 | 39 | <EnforceCodeStyleInBuild Condition="'$(EnforceCodeStyleInBuild)' == ''">true</EnforceCodeStyleInBuild> |
42 | 40 | </PropertyGroup> |
43 | 41 |
|
| 42 | + <!-- Enable implicit usings for projects that target the default TFM --> |
| 43 | + <PropertyGroup Condition="'$(ImplicitUsings)' == '' AND '$(TargetFrameworks)' == '' AND '$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)'"> |
| 44 | + <ImplicitUsings>enable</ImplicitUsings> |
| 45 | + </PropertyGroup> |
| 46 | + |
| 47 | + <ItemGroup Condition="'$(ImplicitUsings)' == 'enable'"> |
| 48 | + <!-- We should make it obvious when Linq is being used in shipping code --> |
| 49 | + <Using Remove="System.Linq" Condition="'$(_IsSrcProject)' == 'true'" /> |
| 50 | + <!-- System.Net.Http types will frequently conflict with ASP.NET Core types--> |
| 51 | + <Using Remove="System.Net.Http" /> |
| 52 | + <Using Include="Xunit" Condition="'$(IsTestProject)' == 'true' OR '$(IsUnitTestProject)' == 'true'" /> |
| 53 | + </ItemGroup> |
| 54 | + |
44 | 55 | <ItemGroup Condition=" '$(DotNetBuildFromSource)' != 'true' AND $(AddPublicApiAnalyzers) "> |
45 | 56 | <Reference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" ExcludeAssets="Compile" PrivateAssets="All" /> |
46 | 57 | </ItemGroup> |
|
0 commit comments