-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Add OptimizeContext MSBuild target that runs on build #33049
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <Description>MSBuild tasks for Entity Framework Core projects.</Description> | ||
| <TargetFrameworks>$(DefaultNetCoreTargetFramework);net472</TargetFrameworks> | ||
| <AssemblyName>Microsoft.EntityFrameworkCore.Tasks</AssemblyName> | ||
| <RootNamespace>Microsoft.EntityFrameworkCore</RootNamespace> | ||
| <IncludeSymbols>false</IncludeSymbols> | ||
| <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> | ||
| <GenerateDependencyFile>true</GenerateDependencyFile> | ||
| <SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking> | ||
| <NoWarn>NU5100;NU5128</NoWarn> | ||
| <ImplicitUsings>true</ImplicitUsings> | ||
| <CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)..\..\rulesets\EFCore.noxmldocs.ruleset</CodeAnalysisRuleSet> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <Compile Include="..\dotnet-ef\Exe.cs" Link="Tools\Exe.cs" /> | ||
| <Compile Include="..\ef\AnsiConsole.cs" Link="Tools\AnsiConsole.cs"/> | ||
| <Compile Include="..\ef\AnsiConstants.cs" Link="Tools\AnsiConstants.cs"/> | ||
| <Compile Include="..\ef\AnsiTextWriter.cs" Link="Tools\AnsiTextWriter.cs"/> | ||
| <Compile Include="..\ef\Reporter.cs" Link="Tools\Reporter.cs"/> | ||
| <Compile Include="..\ef\NotNullIfNotNullAttribute.cs" Link="Tools\NotNullIfNotNullAttribute.cs"/> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <None Update="Properties\Resources.Designer.tt"> | ||
| <Generator>TextTemplatingFileGenerator</Generator> | ||
| <LastGenOutput>Resources.Designer.cs</LastGenOutput> | ||
| <CustomToolNamespace>Microsoft.EntityFrameworkCore.Tools.Properties</CustomToolNamespace> | ||
| </None> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <Compile Update="Properties\Resources.Designer.cs"> | ||
| <DesignTime>True</DesignTime> | ||
| <AutoGen>True</AutoGen> | ||
| <DependentUpon>Resources.Designer.tt</DependentUpon> | ||
| </Compile> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <Using Include="Microsoft.Build" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\ef\ef.csproj" ReferenceOutputAssembly="false" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup Condition="'$(TargetFramework)' != 'net472'"> | ||
| <PackageReference Include="Microsoft.Build.Framework" Version="$(MicrosoftBuildFrameworkVersion)" PrivateAssets="all" ExcludeAssets="Runtime" IsImplicitlyDefined="true" /> | ||
| <PackageReference Include="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildTasksCoreVersion)" PrivateAssets="all" ExcludeAssets="Runtime" IsImplicitlyDefined="true" /> | ||
| <PackageReference Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildUtilitiesCoreVersion)" PrivateAssets="all" ExcludeAssets="Runtime" IsImplicitlyDefined="true" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup Condition="'$(TargetFramework)' == 'net472'"> | ||
| <PackageReference Include="System.Text.Json" Version="$(SystemTextJsonVersion)" PrivateAssets="All" /> | ||
AndriySvyryd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <Reference Include="Microsoft.Build" /> | ||
| <Reference Include="Microsoft.Build.Framework" /> | ||
| <Reference Include="Microsoft.Build.Tasks.v4.0" /> | ||
| <Reference Include="Microsoft.Build.Utilities.v4.0" /> | ||
| <Reference Include="Microsoft.CSharp" /> | ||
| <Reference Include="System.Configuration" /> | ||
| </ItemGroup> | ||
|
|
||
| <!-- | ||
| Workaround for insufficient support for task packages by NuGet Pack: https://github.com/NuGet/Home/issues/6321 | ||
| and bugs with ProjectReference: https://github.com/NuGet/Home/issues/10907, https://github.com/NuGet/Home/issues/10312 | ||
| --> | ||
| <PropertyGroup> | ||
| <NoPackageAnalysis>true</NoPackageAnalysis> | ||
| <NuspecFile>$(MSBuildThisFileDirectory)$(MSBuildProjectName).nuspec</NuspecFile> | ||
| </PropertyGroup> | ||
|
|
||
| <Target Name="SetPackageProperties" BeforeTargets="InitializeStandardNuspecProperties" DependsOnTargets="Build"> | ||
| <ItemGroup> | ||
| <NuspecProperty Include="AssemblyName=$(AssemblyName)" /> | ||
| <NuspecProperty Include="OutputPath=$(OutputPath)" /> | ||
| <NuspecProperty Include="DefaultNetCoreTargetFramework=$(DefaultNetCoreTargetFramework)" /> | ||
| <NuspecProperty Include="Configuration=$(Configuration)" /> | ||
| </ItemGroup> | ||
| </Target> | ||
|
|
||
| <ItemGroup> | ||
| <Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" /> | ||
SamMonoRT marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| </ItemGroup> | ||
|
|
||
| </Project> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
|
|
||
| <package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd"> | ||
| <metadata> | ||
| $CommonMetadataElements$ | ||
| <dependencies> | ||
| <group targetFramework=".NET8.0"> | ||
AndriySvyryd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <dependency id="Microsoft.EntityFrameworkCore.Design" version="$Version$" /> | ||
| </group> | ||
| </dependencies> | ||
| <readme>docs\PACKAGE.md</readme> | ||
| </metadata> | ||
| <files> | ||
| $CommonFileElements$ | ||
| <file src="PACKAGE.md" target="docs\" /> | ||
| <file src="$OutputPath$$DefaultNetCoreTargetFramework$\$AssemblyName$.dll" target="tasks\$DefaultNetCoreTargetFramework$\" /> | ||
| <file src="$OutputPath$$DefaultNetCoreTargetFramework$\$AssemblyName$.pdb" target="tasks\$DefaultNetCoreTargetFramework$\" /> | ||
| <file src="$OutputPath$$DefaultNetCoreTargetFramework$\$AssemblyName$.deps.json" target="tasks\$DefaultNetCoreTargetFramework$\" /> | ||
| <file src="$OutputPath$net472\*" target="tasks\net472\" /> | ||
| <file src="..\..\artifacts\bin\ef\$Configuration$\netcoreapp2.0\*" target="tools\netcoreapp2.0\" /> | ||
AndriySvyryd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <file src="buildTransitive\*" target="buildTransitive\" /> | ||
| </files> | ||
| </package> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| The Entity Framework Core MSBuild tasks integrate EF design-time tools into the build process. They're primarily used to generate the compiled model. | ||
|
|
||
| This package should be referenced by the project containing the derived `DbContext`. | ||
|
|
||
| ## Usage | ||
|
|
||
| Install the package into your project, set `<EFOptimizeContext Condition="'$(Configuration)'=='Release'">true</EFOptimizeContext>` and then run build normally. | ||
|
|
||
| If the startup project is different from the current project it needs to be specified: `<EFStartupProject>..\Startup\Startup.csproj</EFStartupProject>` | ||
|
|
||
| ## Getting started with EF Core | ||
|
|
||
| See [Getting started with EF Core](https://learn.microsoft.com/ef/core/get-started/overview/install) for more information about EF NuGet packages, including which to install when getting started. | ||
|
|
||
| ## Feedback | ||
|
|
||
| If you encounter a bug or issues with this package,you can [open an Github issue](https://github.com/dotnet/efcore/issues/new/choose). For more details, see [getting support](https://github.com/dotnet/efcore/blob/main/.github/SUPPORT.md). |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| <# | ||
| Session["ResourceFile"] = "Resources.resx"; | ||
| Session["ResourceNamespace"] = "Microsoft.EntityFrameworkCore.Properties"; | ||
| Session["AccessModifier"] = "internal"; | ||
| Session["NoDiagnostics"] = true; | ||
| #> | ||
| <#@ include file="..\..\..\tools\Resources.tt" #> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.