Skip to content

Commit

Permalink
[release/3.1] Tools: Enable .NET Framework projects targeting win-arm…
Browse files Browse the repository at this point in the history
…64 (#28254)
  • Loading branch information
bricelam authored Jun 22, 2022
1 parent 94ed70c commit fb8b6e2
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/EFCore.Tools/EFCore.Tools.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
<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/ARM64/$configuration$/net461/ef.exe" target="tools/net461/win-arm64/" />
<file src="../../artifacts/bin/ef/ARM64/$configuration$/net461/ef.pdb" target="tools/net461/win-arm64/" />
<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/" />
</files>
</package>
</package>
4 changes: 4 additions & 0 deletions src/EFCore.Tools/tools/EntityFrameworkCore.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,10 @@ function EF($project, $startupProject, $params, [switch] $skipBuild)
{
$exePath = Join-Path $PSScriptRoot 'net461\win-x86\ef.exe'
}
elseif ($platformTarget -eq 'ARM64')
{
$exePath = Join-Path $PSScriptRoot 'net461\win-arm64\ef.exe'
}
elseif ($platformTarget -in 'AnyCPU', 'x64')
{
$exePath = Join-Path $PSScriptRoot 'net461\any\ef.exe'
Expand Down
9 changes: 6 additions & 3 deletions src/dotnet-ef/RootCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,12 @@ protected override int Execute()
executable = Path.Combine(
toolsPath,
"net461",
startupProject.PlatformTarget == "x86"
? "win-x86"
: "any",
startupProject.PlatformTarget switch
{
"x86" => "win-x86",
"ARM64" => "win-arm64",
_ => "any"
},
"ef.exe");
}
else if (targetFramework.Identifier == ".NETCoreApp")
Expand Down
4 changes: 3 additions & 1 deletion src/dotnet-ef/dotnet-ef.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dotnet ef database update
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
<OutputType>Exe</OutputType>
<PackAsTool>true</PackAsTool>
<PackAsToolShimRuntimeIdentifiers>win-x64;win-x86</PackAsToolShimRuntimeIdentifiers>
<PackAsToolShimRuntimeIdentifiers>win-x64;win-x86;win-arm64</PackAsToolShimRuntimeIdentifiers>
<!-- Because this project uses a custom nuspec, this is necessary to ensure the generated shims are in the publish directory. -->
<PackagedShimOutputRootDirectory>$(OutDir)</PackagedShimOutputRootDirectory>
<RootNamespace>Microsoft.EntityFrameworkCore.Tools</RootNamespace>
Expand Down Expand Up @@ -96,6 +96,8 @@ dotnet ef database update
<NuspecProperty Include="OutputExeSymbol=..\..\artifacts\bin\ef\$(Configuration)\net461\ef.pdb" />
<NuspecProperty Include="OutputX86Exe=..\..\artifacts\bin\ef\x86\$(Configuration)\net461\ef.exe" />
<NuspecProperty Include="OutputX86ExeSymbol=..\..\artifacts\bin\ef\x86\$(Configuration)\net461\ef.pdb" />
<NuspecProperty Include="OutputARM64Exe=..\..\artifacts\bin\ef\ARM64\$(Configuration)\net461\ef.exe" />
<NuspecProperty Include="OutputARM64ExeSymbol=..\..\artifacts\bin\ef\ARM64\$(Configuration)\net461\ef.pdb" />
</ItemGroup>
</Target>
</Project>
2 changes: 2 additions & 0 deletions src/dotnet-ef/dotnet-ef.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@
<file src="$OutputExeSymbol$" target="tools\$targetFramework$\any\tools\net461\any" />
<file src="$OutputX86Exe$" target="tools\$targetFramework$\any\tools\net461\win-x86" />
<file src="$OutputX86ExeSymbol$" target="tools\$targetFramework$\any\tools\net461\win-x86" />
<file src="$OutputARM64Exe$" target="tools\$targetFramework$\any\tools\net461\win-arm64" />
<file src="$OutputARM64ExeSymbol$" target="tools\$targetFramework$\any\tools\net461\win-arm64" />
</files>
</package>
3 changes: 2 additions & 1 deletion src/ef/ef.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@
</Compile>
</ItemGroup>

<Target Name="BuildX86" AfterTargets="Build" Condition=" '$(TargetFramework)' == 'net461' And '$(Platform)' != 'x86' ">
<Target Name="BuildOtherPlatforms" AfterTargets="Build" Condition=" '$(TargetFramework)' == 'net461' And '$(Platform)' == 'AnyCPU' ">
<MSBuild Projects="$(MSBuildProjectFullPath)" Properties="TargetFramework=$(TargetFramework);Platform=x86;Configuration=$(Configuration)" Targets="Build" />
<MSBuild Projects="$(MSBuildProjectFullPath)" Properties="TargetFramework=$(TargetFramework);Platform=ARM64;Configuration=$(Configuration)" Targets="Build" />
</Target>

</Project>

0 comments on commit fb8b6e2

Please sign in to comment.