|
24 | 24 | Param ( |
25 | 25 | [Parameter(HelpMessage = "The target frameworks to enable.")] |
26 | 26 | [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 |
31 | 28 | ) |
32 | 29 |
|
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 | | - |
45 | 30 | $UwpTfm = "UwpTargetFramework"; |
46 | 31 | $WinAppSdkTfm = "WinAppSdkTargetFramework"; |
47 | 32 | $WasmTfm = "NetStandardCommonTargetFramework"; |
@@ -112,10 +97,14 @@ if ($targets.Contains("netstandard")) { |
112 | 97 | $desiredTfmValues += $NetstandardTfm; |
113 | 98 | } |
114 | 99 |
|
| 100 | +Write-Output "Setting enabled TargetFrameworks: $targets" |
| 101 | + |
115 | 102 | $targetFrameworksToRemove = $allTargetFrameworks.Where({ -not $desiredTfmValues.Contains($_) }) |
116 | 103 |
|
117 | 104 | $targetFrameworksToRemoveRegexPartial = $targetFrameworksToRemove -join "|"; |
118 | 105 |
|
119 | 106 | $newFileContents = $fileContents -replace "<(?:$targetFrameworksToRemoveRegexPartial)>.+?>", ''; |
120 | 107 |
|
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