Skip to content

Commit e54c631

Browse files
Arlodotexemichael-hawker
authored andcommitted
Fixed bug, update UseTargetFrameworks script to accommodate submodule
1 parent 6bb29f4 commit e54c631

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

MultiTarget/UseTargetFrameworks.ps1

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,9 @@
2424
Param (
2525
[Parameter(HelpMessage = "The target frameworks to enable.")]
2626
[ValidateSet('all', 'all-uwp', 'wasm', 'uwp', 'winappsdk', 'wpf', 'gtk', 'macos', 'ios', 'droid', 'netstandard')]
27-
[string[]]$targets = @('uwp', 'winappsdk', 'wasm'), # default settings
28-
29-
[Parameter(HelpMessage = "Disables suppressing changes to the TargetFrameworks file in git, allowing changes to be committed.")]
30-
[switch]$allowGitChanges = $false
27+
[string[]]$targets = @('uwp', 'winappsdk', 'wasm') # default settings
3128
)
3229

33-
# Suppress git warning "core.useBuiltinFSMonitor will be deprecated soon; use core.fsmonitor instead"
34-
& git config advice.useCoreFSMonitorConfig false;
35-
36-
if ($allowGitChanges.IsPresent) {
37-
Write-Warning "Changes to the default TargetFrameworks can now be committed. Run this command again without the -allowGitChanges flag to disable committing further changes.";
38-
git update-index --no-assume-unchanged $PSScriptRoot/EnabledTargetFrameworks.props
39-
}
40-
else {
41-
Write-Output "Changes to the default TargetFrameworks are now suppressed. To switch branches, run git reset --hard with a clean working tree.";
42-
git update-index --assume-unchanged $PSScriptRoot/EnabledTargetFrameworks.props
43-
}
44-
4530
$UwpTfm = "UwpTargetFramework";
4631
$WinAppSdkTfm = "WinAppSdkTargetFramework";
4732
$WasmTfm = "NetStandardCommonTargetFramework";
@@ -112,10 +97,14 @@ if ($targets.Contains("netstandard")) {
11297
$desiredTfmValues += $NetstandardTfm;
11398
}
11499

100+
Write-Output "Setting enabled TargetFrameworks: $targets"
101+
115102
$targetFrameworksToRemove = $allTargetFrameworks.Where({ -not $desiredTfmValues.Contains($_) })
116103

117104
$targetFrameworksToRemoveRegexPartial = $targetFrameworksToRemove -join "|";
118105

119106
$newFileContents = $fileContents -replace "<(?:$targetFrameworksToRemoveRegexPartial)>.+?>", '';
120107

121-
Set-Content -Force -Path $PSScriptRoot/TargetFrameworks.props -Value $newFileContents;
108+
Set-Content -Force -Path $PSScriptRoot/EnabledTargetFrameworks.props -Value $newFileContents;
109+
110+
Write-Output "Done. Please close and regenerate your solution. Do not commit these changes to the tooling repository."

0 commit comments

Comments
 (0)