From 5b947f42305467150e19006449192bced84a8579 Mon Sep 17 00:00:00 2001 From: Brice Lambson Date: Fri, 21 Aug 2020 15:06:16 -0700 Subject: [PATCH] PMC Tools: Avoid more PowerShell path cmdlets These parameters accepted wildcard characters causing problems. Fixes #16649 --- src/EFCore.Tools/tools/EntityFrameworkCore.psm1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/EFCore.Tools/tools/EntityFrameworkCore.psm1 b/src/EFCore.Tools/tools/EntityFrameworkCore.psm1 index 7a3de94250b..ce2c72086dd 100644 --- a/src/EFCore.Tools/tools/EntityFrameworkCore.psm1 +++ b/src/EFCore.Tools/tools/EntityFrameworkCore.psm1 @@ -582,7 +582,7 @@ function Script-DbContext if (![IO.Path]::IsPathRooted($intermediatePath)) { $projectDir = GetProperty $dteProject.Properties 'FullPath' - $intermediatePath = Join-Path $projectDir $intermediatePath -Resolve | Convert-Path + $intermediatePath = [IO.Path]::GetFullPath((Join-Path $projectDir $intermediatePath)) } $scriptFileName = [IO.Path]::ChangeExtension([IO.Path]::GetRandomFileName(), '.sql') @@ -679,7 +679,7 @@ function Script-Migration if (![IO.Path]::IsPathRooted($intermediatePath)) { $projectDir = GetProperty $dteProject.Properties 'FullPath' - $intermediatePath = Join-Path $projectDir $intermediatePath -Resolve | Convert-Path + $intermediatePath = [IO.Path]::GetFullPath((Join-Path $projectDir $intermediatePath)) } $scriptFileName = [IO.Path]::ChangeExtension([IO.Path]::GetRandomFileName(), '.sql') @@ -882,7 +882,7 @@ function GetStartupProject($name, $fallbackProject) if (![IO.Path]::IsPathRooted($startupProjectPath)) { $solutionPath = Split-Path (GetProperty $DTE.Solution.Properties 'Path') - $startupProjectPath = Join-Path $solutionPath $startupProjectPath -Resolve | Convert-Path + $startupProjectPath = [IO.Path]::GetFullPath((Join-Path $solutionPath $startupProjectPath)) } $startupProject = GetSolutionProjects | ?{ @@ -1068,7 +1068,7 @@ function EF($project, $startupProject, $params, $applicationArgs, [switch] $skip } } - if (Test-Path $runtimeConfig) + if ([IO.File]::Exists($runtimeConfig)) { $dotnetParams += '--runtimeconfig', $runtimeConfig } @@ -1122,7 +1122,7 @@ function EF($project, $startupProject, $params, $applicationArgs, [switch] $skip } $arguments = ToArguments $params - if ($applicationArgs -ne $null) + if ($applicationArgs) { $arguments += ' -- ' $arguments += $applicationArgs