AL/Remove-ALTestDependencies.ps1
function Remove-ALTestDependencies { Param( [Parameter(Mandatory = $false)] [string] $sourcePath = (Get-Location) ) $testapps = Get-EnvironmentKeyValue -SourcePath $sourcePath -KeyName "testapps" $dependencies = Get-AppKeyValue -SourcePath $sourcePath -KeyName "dependencies" [Version]$PlatformVersion = [Version]::Parse((Get-AppKeyValue -SourcePath (Get-Location) -KeyName 'platform')) $compiler = Get-AppKeyValue -SourcePath $TestPath -KeyName 'runtime' if ($compiler -ge '4.3') { try { $dependencies = $dependencies | Where-Object { $testapps.appId -notcontains $_.Id } Set-AppKeyValue -SourcePath $sourcePath -KeyName "dependencies" -KeyValue $dependencies #(ConvertTo-Json $dependencies -Compress) } catch { throw "Could not remove test dependencies" } } else { if ($PlatformVersion -ge ([Version]::Parse('15.0.0.0'))) { try { $dependencies = $dependencies | Where-Object { $testapps.appId -notcontains $_.appId } Set-AppKeyValue -SourcePath $sourcePath -KeyName "dependencies" -KeyValue $dependencies #(ConvertTo-Json $dependencies -Compress) } catch { throw "Could not remove test dependencies" } } else { Set-AppKeyValue -SourcePath $sourcePath -KeyName test -KeyValue '' } } } Export-ModuleMember Remove-ALTestDependencies |