Skip to content

Commit

Permalink
Force NullabilityInfoContextSupport=true in user projects
Browse files Browse the repository at this point in the history
To make NRT-based model building work correctly in aggressively
trimmed applications (e.g. MAUI).

Fixes #27474
  • Loading branch information
roji committed Apr 29, 2022
1 parent 5e49b24 commit fb4c053
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/EFCore/EFCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ Microsoft.EntityFrameworkCore.DbSet
<ProjectReference Condition="'$(BuildingByReSharper)' != 'true'" Include="..\EFCore.Analyzers\EFCore.Analyzers.csproj" PrivateAssets="contentfiles;build" />
</ItemGroup>

<ItemGroup>
<!-- See https://github.com/NuGet/Home/wiki/Allow-package%2D%2Dauthors-to-define-build-assets-transitive-behavior for transitively flowing .props build assets -->
<None Include="build\**\*">
<Pack>True</Pack>
<PackagePath>build</PackagePath>
</None>
<None Include="build\**\*">
<Pack>True</Pack>
<PackagePath>buildTransitive</PackagePath>
</None>
</ItemGroup>

<ItemGroup>
<None Update="Properties\CoreStrings.Designer.tt">
<Generator>TextTemplatingFileGenerator</Generator>
Expand Down
9 changes: 9 additions & 0 deletions src/EFCore/build/net6.0/Microsoft.EntityFrameworkCore.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!--
MAUI (and other size-conscient profiles) trim the nullability attributes, causing the EF Core NRT support to break.
This prevents the attributes from being trimmed.
-->
<NullabilityInfoContextSupport>true</NullabilityInfoContextSupport>
</PropertyGroup>
</Project>

0 comments on commit fb4c053

Please sign in to comment.