Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions MultiTarget/UseTargetFrameworks.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ $DroidTfm = "AndroidLibTargetFramework";
$NetstandardTfm = "DotnetStandardCommonTargetFramework";

$fileContents = Get-Content -Path $PSScriptRoot/AvailableTargetFrameworks.props
$newFileContents = $fileContents;

# 'all' represents many '$MultiTargets' values
if ($MultiTargets.Contains("all")) {
Expand Down Expand Up @@ -105,10 +106,12 @@ $targetFrameworksToRemove = @(
$NetstandardTfm
).Where({ -not $desiredTfmValues.Contains($_) })

$targetFrameworksToRemoveRegexPartial = $targetFrameworksToRemove -join "|";

$newFileContents = $fileContents -replace "<(?:$targetFrameworksToRemoveRegexPartial).+?>.+?>", '';
# When targetFrameworksToRemoveRegexPartial is empty, the regex will match everything.
# To work around this, check if there's anything to remove before doing it.
if ($targetFrameworksToRemove.Length -gt 0) {
$targetFrameworksToRemoveRegexPartial = "$($targetFrameworksToRemove -join "|")";
$newFileContents = $fileContents -replace "<(?:$targetFrameworksToRemoveRegexPartial).+?>.+?>", '';
}

Set-Content -Force -Path $PSScriptRoot/EnabledTargetFrameworks.props -Value $newFileContents;

Write-Output "Done. Please close and regenerate your solution. Do not commit these changes to the tooling repository."
Write-Output "Done. Please close and regenerate your solution. Do not commit these changes to the tooling repository."
Loading