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";
42
42
$NetstandardTfm = " DotnetStandardCommonTargetFramework" ;
43
43
44
44
$fileContents = Get-Content - Path $PSScriptRoot / AvailableTargetFrameworks.props
45
+ $newFileContents = $fileContents ;
45
46
46
47
# 'all' represents many '$MultiTargets' values
47
48
if ($MultiTargets.Contains (" all" )) {
@@ -105,10 +106,12 @@ $targetFrameworksToRemove = @(
105
106
$NetstandardTfm
106
107
).Where ({ -not $desiredTfmValues.Contains ($_ ) })
107
108
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
+ }
111
115
112
116
Set-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