1- // Windows-only: Enables gcServer in the local .dotnet SDK testhost app.config files and prints the SDK version.
2- // What it does:
3- // 1) Finds the repo-local .dotnet folder by walking up from this script's directory.
4- // 2) Runs .dotnet\dotnet.exe --version to get the SDK version and prints it.
5- // 3) Locates both
6- // - .dotnet\sdk\{version}\TestHostNetFramework\testhost.net472.exe.config and
7- // - .dotnet\sdk\{version}\TestHostNetFramework\testhost.net472.x86.exe.config
8- // and ensures <runtime><gcServer enabled="true"/></runtime> is present, then saves the files.
1+ // Windows-only utility for F# build: ensures <gcServer enabled="true"/> in .NET Framework testhost configs.
2+ // - Prints local .dotnet SDK version
3+ // - Updates BOTH AnyCPU and x86 testhost.net472*.exe.config files under the local .dotnet SDK
4+ // - Intended to run ONCE before desktop/VS tests (not per test)
95// Usage (from repo root): dotnet fsi eng/update-testhost-gcserver.fsx
106
117open System
@@ -14,7 +10,7 @@ open System.IO
1410
1511// This script is intended for Windows only
1612if not ( OperatingSystem.IsWindows()) then
17- eprintfn " Error : This script supports Windows only."
13+ eprintfn " [ServerGC] ERROR : This script supports Windows only."
1814 exit 1
1915
2016let exeName = " dotnet.exe"
@@ -32,7 +28,7 @@ let startDir = DirectoryInfo(__SOURCE_DIRECTORY__)
3228
3329match findDotnetRoot startDir with
3430| None ->
35- eprintfn " Error : .dotnet folder with %s not found starting from %s " exeName startDir.FullName
31+ eprintfn " [ServerGC] ERROR : .dotnet folder with %s not found starting from %s " exeName startDir.FullName
3632 exit 1
3733| Some dotnetRoot ->
3834 let dotnetPath = Path.Combine( dotnetRoot, exeName)
@@ -49,26 +45,26 @@ match findDotnetRoot startDir with
4945 use proc = new Process()
5046 proc.StartInfo <- psi
5147 if not ( proc.Start()) then
52- eprintfn " Error : Failed to start %s " dotnetPath
48+ eprintfn " [ServerGC] ERROR : Failed to start %s " dotnetPath
5349 exit 1
5450
5551 let stdOut = proc.StandardOutput.ReadToEnd()
5652 let stdErr = proc.StandardError.ReadToEnd()
5753 proc.WaitForExit()
5854
5955 if proc.ExitCode <> 0 then
60- eprintfn " Error : %s --version failed with exit code %d " dotnetPath proc.ExitCode
56+ eprintfn " [ServerGC] ERROR : %s --version failed with exit code %d " dotnetPath proc.ExitCode
6157 if not ( System.String.IsNullOrWhiteSpace stdErr) then eprintf " %s " stdErr
6258 exit proc.ExitCode
6359 else
6460 let version = stdOut.Trim()
6561 if System.String.IsNullOrWhiteSpace version then
66- eprintfn " Error : No version output from %s --version" dotnetPath
62+ eprintfn " [ServerGC] ERROR : No version output from %s --version" dotnetPath
6763 if not ( System.String.IsNullOrWhiteSpace stdErr) then eprintf " %s " stdErr
6864 exit 1
6965 else
7066 // Print the SDK version
71- printfn " %s " version
67+ printfn " [ServerGC] Local .dotnet SDK version: %s " version
7268
7369 // Locate both config files and ensure gcServer is enabled
7470 let cfgFileNames =
@@ -107,7 +103,7 @@ match findDotnetRoot startDir with
107103 el.SetAttributeValue( xn " enabled" , " true" )
108104
109105 doc.Save( path)
110- printfn " Updated: %s (gcServer enabled=true)" path
106+ printfn " [ServerGC] Updated: %s (gcServer enabled=true)" path
111107 true
112108
113109 let cfgPaths =
@@ -119,7 +115,10 @@ match findDotnetRoot startDir with
119115
120116 if updatedCount = 0 then
121117 // Fail only if none of the expected files were found
122- eprintfn " Error : None of the expected config files were found:\n %s " ( String.Join( " \n " , cfgPaths))
118+ eprintfn " [ServerGC] ERROR : None of the expected config files were found:\n %s " ( String.Join( " \n " , cfgPaths))
123119 exit 2
124120 else
121+ printfn " [ServerGC] Updated %d config file(s):" updatedCount
122+ for i = 0 to cfgPaths.Length - 1 do
123+ if results.[ i] then printfn " [ServerGC] %s " cfgPaths.[ i]
125124 exit 0
0 commit comments