-
Notifications
You must be signed in to change notification settings - Fork 545
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
EF Code First Migrations failure in VS 2022 #2092
Comments
@alexmaie, ha-ha, I bet they regret they made netstandard 2.1. You can create migrations using small hacks. <PropertyGroup>
<EF6>false</EF6>
<EF6Command>[command required]</EF6Command>
</PropertyGroup> <ItemGroup>
<PackageReference Include="EntityFramework" Version="6.4.4" GeneratePathProperty="true" />
</ItemGroup> <Target Name="Migration" AfterTargets="Publish" Condition="$(EF6) AND '$(TargetFramework)' != 'net48'">
<Message Text="Executing EF6 command:" Importance="high" />
<!-- I'm using Microsoft.Data.SqlClient, it may not be needed in your case -->
<Copy SourceFiles="$(MSBuildProjectDirectory)\$(PublishDir)runtimes\win\lib\netcoreapp3.1\Microsoft.Data.SqlClient.dll" DestinationFiles="$(MSBuildProjectDirectory)\$(PublishDir)Microsoft.Data.SqlClient.dll" Condition="'$(OS)' == 'Windows_NT'" />
<Copy SourceFiles="$(MSBuildProjectDirectory)\$(PublishDir)runtimes\win-x64\native\Microsoft.Data.SqlClient.SNI.dll" DestinationFiles="$(MSBuildProjectDirectory)\$(PublishDir)Microsoft.Data.SqlClient.SNI.dll" Condition="'$(OS)' == 'Windows_NT'" />
<Copy SourceFiles="$(MSBuildProjectDirectory)\$(PublishDir)runtimes\win-x64\native\sni.dll" DestinationFiles="$(MSBuildProjectDirectory)\$(PublishDir)sni.dll" Condition="'$(OS)' == 'Windows_NT'" />
<Copy SourceFiles="$(MSBuildProjectDirectory)\$(PublishDir)runtimes\unix\lib\net6.0\Microsoft.Data.SqlClient.dll" DestinationFiles="$(MSBuildProjectDirectory)\$(PublishDir)Microsoft.Data.SqlClient.dll" Condition="'$(OS)' != 'Windows_NT'" />
<Copy SourceFiles="$(PkgEntityFramework)\tools\netcoreapp3.0\any\ef6.dll" DestinationFiles="$(MSBuildProjectDirectory)\$(PublishDir)ef6.dll" />
<Copy SourceFiles="$(MSBuildProjectDirectory)\ef6.runtimeconfig.json" DestinationFiles=" $(MSBuildProjectDirectory)\$(PublishDir)ef6.runtimeconfig.json" />
<!-- todo: change DAL.Model.dll to your dll -->
<Message Text="dotnet exec --runtimeconfig $(MSBuildProjectDirectory)\$(PublishDir)ef6.runtimeconfig.json $(MSBuildProjectDirectory)\$(PublishDir)ef6.dll $(EF6Command) --assembly $(MSBuildProjectDirectory)\$(PublishDir)DAL.Model.dll --project-dir $(MSBuildProjectDirectory)" Importance="high" />
<Exec Command="dotnet exec --runtimeconfig $(MSBuildProjectDirectory)\$(PublishDir)ef6.runtimeconfig.json $(MSBuildProjectDirectory)\$(PublishDir)ef6.dll $(EF6Command) --assembly $(MSBuildProjectDirectory)\$(PublishDir)DAL.Model.dll --project-dir $(MSBuildProjectDirectory)" WorkingDirectory="$(MSBuildProjectDirectory)\$(PublishDir)" ConsoleToMSBuild="true" />
</Target>
{
"runtimeOptions": {
"tfm": "netcoreapp3.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "7.0.0"
}
}
}
|
This issue has been closed because EF6 is no longer being actively developed. We are instead focusing on stability of the codebase, which means we will only make changes to address security issues. See the repo README for more information. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi EF6 Team,
I have to reopen this ticket: #1870
I know and understand that EF6 is not being actively maintained, but since you created a netstandard 2.1 compatible version of EF6, then you also need to make sure that we can still create migrations. Right now our only option is to use VS 2019 and and to create a slim solution which only contains some older code related to EF since we can't run net6 code in VS 2019
The text was updated successfully, but these errors were encountered: