Skip to content

Commit

Permalink
Update tool to require .NET 6 / .NET Framework 4.6.1 at minimum.
Browse files Browse the repository at this point in the history
This is needed otherwise it will try to require ".NET 2.0 Runtime" to be installed, which will cause roll forward to fail to load 6.0.0's System.Runtime when used on devices with newer versions of the .NET SDK and runtimes.

Fixes: #27660.

Signed-off-by: AraHaan <seandhunt_7@yahoo.com>
  • Loading branch information
AraHaan committed Mar 20, 2022
1 parent 44f1c24 commit 7aeb4a7
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/EFCore.Tools/EFCore.Tools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<PackageId>Microsoft.EntityFrameworkCore.Tools</PackageId>
<NuspecFile>$(MSBuildThisFileDirectory)$(MSBuildProjectName).nuspec</NuspecFile>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
Expand Down
6 changes: 3 additions & 3 deletions src/EFCore.Tools/EFCore.Tools.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<file src="../../artifacts/bin/ef/$configuration$/net461/ef.pdb" target="tools/net461/any/" />
<file src="../../artifacts/bin/ef/x86/$configuration$/net461/ef.exe" target="tools/net461/win-x86/" />
<file src="../../artifacts/bin/ef/x86/$configuration$/net461/ef.pdb" target="tools/net461/win-x86/" />
<file src="../../artifacts/bin/ef/$configuration$/netcoreapp2.0/ef.dll" target="tools/netcoreapp2.0/any/" />
<file src="../../artifacts/bin/ef/$configuration$/netcoreapp2.0/ef.pdb" target="tools/netcoreapp2.0/any/" />
<file src="../../artifacts/bin/ef/$configuration$/netcoreapp2.0/ef.runtimeconfig.json" target="tools/netcoreapp2.0/any/" />
<file src="../../artifacts/bin/ef/$configuration$/net6.0/ef.dll" target="tools/net6.0/any/" />
<file src="../../artifacts/bin/ef/$configuration$/net6.0/ef.pdb" target="tools/net6.0/any/" />
<file src="../../artifacts/bin/ef/$configuration$/net6.0/ef.runtimeconfig.json" target="tools/net6.0/any/" />
</files>
</package>
2 changes: 1 addition & 1 deletion src/EFCore.Tools/tools/EntityFrameworkCore.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1249,7 +1249,7 @@ function EF($project, $startupProject, $params, $applicationArgs, [switch] $skip
$projectAssetsFile = GetCpsProperty $startupProject 'ProjectAssetsFile'
$runtimeConfig = Join-Path $targetDir ($startupTargetName + '.runtimeconfig.json')
$runtimeFrameworkVersion = GetCpsProperty $startupProject 'RuntimeFrameworkVersion'
$efPath = Join-Path $PSScriptRoot 'netcoreapp2.0\any\ef.dll'
$efPath = Join-Path $PSScriptRoot 'net6.0\any\ef.dll'

$dotnetParams = 'exec', '--depsfile', $depsFile

Expand Down
2 changes: 1 addition & 1 deletion src/dotnet-ef/RootCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ protected override int Execute(string[] _)
args.Add(startupProject.RuntimeFrameworkVersion);
}

args.Add(Path.Combine(toolsPath, "netcoreapp2.0", "any", "ef.dll"));
args.Add(Path.Combine(toolsPath, "net6.0", "any", "ef.dll"));
}
else if (targetFramework.Identifier == ".NETStandard")
{
Expand Down
8 changes: 4 additions & 4 deletions src/dotnet-ef/dotnet-ef.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dotnet ef dbcontext scaffold
dotnet ef database drop
dotnet ef database update
</Description>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Exe</OutputType>
<PackAsTool>true</PackAsTool>
<PackAsToolShimRuntimeIdentifiers>win-x64;win-x86</PackAsToolShimRuntimeIdentifiers>
Expand Down Expand Up @@ -85,9 +85,9 @@ dotnet ef database update

<NuspecProperty Include="SettingsFile=$(_ToolsSettingsFilePath)" />
<NuspecProperty Include="Output=$(PublishDir)**\*" />
<NuspecProperty Include="OutputBinary=..\..\artifacts\bin\ef\$(Configuration)\netcoreapp2.0\ef.dll" />
<NuspecProperty Include="OutputRuntimeConfig=..\..\artifacts\bin\ef\$(Configuration)\netcoreapp2.0\ef.runtimeconfig.json" />
<NuspecProperty Include="OutputSymbol=..\..\artifacts\bin\ef\$(Configuration)\netcoreapp2.0\ef.pdb" />
<NuspecProperty Include="OutputBinary=..\..\artifacts\bin\ef\$(Configuration)\net6.0\ef.dll" />
<NuspecProperty Include="OutputRuntimeConfig=..\..\artifacts\bin\ef\$(Configuration)\net6.0\ef.runtimeconfig.json" />
<NuspecProperty Include="OutputSymbol=..\..\artifacts\bin\ef\$(Configuration)\net6.0\ef.pdb" />
<NuspecProperty Include="OutputExe=..\..\artifacts\bin\ef\$(Configuration)\net461\ef.exe" />
<NuspecProperty Include="OutputExeSymbol=..\..\artifacts\bin\ef\$(Configuration)\net461\ef.pdb" />
<NuspecProperty Include="OutputX86Exe=..\..\artifacts\bin\ef\x86\$(Configuration)\net461\ef.exe" />
Expand Down
6 changes: 3 additions & 3 deletions src/dotnet-ef/dotnet-ef.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
$CommonFileElements$
<file src="$SettingsFile$" target="tools\$targetFramework$\any" />
<file src="$Output$" target="tools\$targetFramework$\any" />
<file src="$OutputBinary$" target="tools\$targetFramework$\any\tools\netcoreapp2.0\any" />
<file src="$OutputRuntimeConfig$" target="tools\$targetFramework$\any\tools\netcoreapp2.0\any" />
<file src="$OutputSymbol$" target="tools\$targetFramework$\any\tools\netcoreapp2.0\any" />
<file src="$OutputBinary$" target="tools\$targetFramework$\any\tools\net6.0\any" />
<file src="$OutputRuntimeConfig$" target="tools\$targetFramework$\any\tools\net6.0\any" />
<file src="$OutputSymbol$" target="tools\$targetFramework$\any\tools\net6.0\any" />
<file src="$OutputExe$" target="tools\$targetFramework$\any\tools\net461\any" />
<file src="$OutputExeSymbol$" target="tools\$targetFramework$\any\tools\net461\any" />
<file src="$OutputX86Exe$" target="tools\$targetFramework$\any\tools\net461\win-x86" />
Expand Down
2 changes: 1 addition & 1 deletion src/ef/AppDomainOperationExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public override void Dispose()
}
}
}
#elif NETCOREAPP2_0
#elif NET6_0
#else
#error target frameworks need to be updated.
#endif
2 changes: 1 addition & 1 deletion src/ef/Commands/ProjectCommandBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected IOperationExecutor CreateExecutor(string[] remainingArguments)
}
}
}
#elif !NETCOREAPP2_0
#elif !NET6_0
#error target frameworks need to be updated.
#endif
return new ReflectionOperationExecutor(
Expand Down
5 changes: 4 additions & 1 deletion src/ef/ef.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<TargetFrameworks>net6.0;net461</TargetFrameworks>
<Description>Entity Framework Core Command-line Tools</Description>
<OutputType>Exe</OutputType>
<IsPackable>false</IsPackable>
<RootNamespace>Microsoft.EntityFrameworkCore.Tools</RootNamespace>
<CheckEolTargetFramework>False</CheckEolTargetFramework>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)..\..\rulesets\EFCore.noxmldocs.ruleset</CodeAnalysisRuleSet>
<RollForward>Major</RollForward>
<!-- disable nullable warnings for now. -->
<Nullable>annotations</Nullable>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 7aeb4a7

Please sign in to comment.