Skip to content

Commit 97e721d

Browse files
authored
Show a warning when the PMC tools are used with a platform-specific app (#38000)
1 parent 44db7bb commit 97e721d

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/EFCore.Tools/tools/EntityFrameworkCore.psm1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,6 +1292,17 @@ function EF($project, $startupProject, $params, $applicationArgs, [switch] $skip
12921292
elseif ($targetFramework -eq '.NETCoreApp')
12931293
{
12941294
$targetPlatformIdentifier = GetCpsProperty $startupProject 'TargetPlatformIdentifier'
1295+
$targetFrameworkValue = GetCpsProperty $startupProject 'TargetFramework'
1296+
$dashIndex = if ($targetFrameworkValue) { $targetFrameworkValue.IndexOf('-') } else { -1 }
1297+
if ($targetPlatformIdentifier -or $dashIndex -gt 0)
1298+
{
1299+
Write-Warning ("Startup project '$($startupProject.ProjectName)' targets a platform-specific" +
1300+
" framework: '$targetFrameworkValue'. The Entity Framework Core Package Manager Console" +
1301+
' Tools might not function correctly. Implement IDesignTimeDbContextFactory<> to ensure' +
1302+
' design-time tools work correctly with this project.' +
1303+
' See https://aka.ms/efcore-docs-migrations-projects for more information.')
1304+
}
1305+
12951306
if ($targetPlatformIdentifier -and $targetPlatformIdentifier -ne 'Windows')
12961307
{
12971308
throw "Startup project '$($startupProject.ProjectName)' targets platform '$targetPlatformIdentifier'. The Entity Framework " +

0 commit comments

Comments
 (0)