File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ $DroidTfm = "AndroidLibTargetFramework";
4242$NetstandardTfm = " DotnetStandardCommonTargetFramework" ;
4343
4444$fileContents = Get-Content - Path $PSScriptRoot / AvailableTargetFrameworks.props
45+ $newFileContents = $fileContents ;
4546
4647# 'all' represents many '$MultiTargets' values
4748if ($MultiTargets.Contains (" all" )) {
@@ -105,10 +106,12 @@ $targetFrameworksToRemove = @(
105106 $NetstandardTfm
106107).Where ({ -not $desiredTfmValues.Contains ($_ ) })
107108
108- $targetFrameworksToRemoveRegexPartial = $targetFrameworksToRemove -join " |" ;
109-
110- $newFileContents = $fileContents -replace " <(?:$targetFrameworksToRemoveRegexPartial ).+?>.+?>" , ' ' ;
109+ # When targetFrameworksToRemoveRegexPartial is empty, the regex will match everything.
110+ # To work around this, check if there's anything to remove before doing it.
111+ if ($targetFrameworksToRemove.Length -gt 0 ) {
112+ $targetFrameworksToRemoveRegexPartial = " $ ( $targetFrameworksToRemove -join " |" ) " ;
113+ $newFileContents = $fileContents -replace " <(?:$targetFrameworksToRemoveRegexPartial ).+?>.+?>" , ' ' ;
114+ }
111115
112116Set-Content - Force - Path $PSScriptRoot / EnabledTargetFrameworks.props - Value $newFileContents ;
113-
114- Write-Output " Done. Please close and regenerate your solution. Do not commit these changes to the tooling repository."
117+ Write-Output " Done. Please close and regenerate your solution. Do not commit these changes to the tooling repository."
You can’t perform that action at this time.
0 commit comments