return;
}
+ WriteEmptyGlobalJson();
+
// Add SDK versions
AddAvailableSdkVersions(_regSdkBaseDir, "9999.0.4");
return;
}
+ WriteEmptyGlobalJson();
+
using (var registeredInstallLocationOverride = new RegisteredInstallLocationOverride(DotNet.GreatestVersionHostFxrFilePath))
{
registeredInstallLocationOverride.SetInstallLocation(_regDir, RepoDirectories.BuildArchitecture);
return;
}
+ WriteEmptyGlobalJson();
+
// Add SDK versions
AddAvailableSdkVersions(_regSdkBaseDir, "9999.0.0", "9999.0.3-dummy");
File.Copy(srcFile, destFile, true);
}
+
+ private void WriteGlobalJson(string contents)
+ {
+ File.WriteAllText(Path.Combine(_currentWorkingDir, "global.json"), contents);
+ }
+
+ private void WriteEmptyGlobalJson() => WriteGlobalJson("{}");
}
}
Directory.CreateDirectory(_cwdSdkBaseDir);
Directory.CreateDirectory(_userSdkBaseDir);
Directory.CreateDirectory(_exeSdkBaseDir);
-
+
// Trace messages used to identify from which folder the SDK was picked
_exeSelectedMessage = $"Using .NET Core SDK dll=[{_exeSdkBaseDir}";
}
[Fact]
public void SdkLookup_Negative_Version()
{
+ WriteEmptyGlobalJson();
+
// Add a negative SDK version
AddAvailableSdkVersions(_exeSdkBaseDir, "-1.-1.-1");
[Fact]
public void SdkLookup_Must_Pick_The_Highest_Semantic_Version()
{
+ WriteEmptyGlobalJson();
+
// Add SDK versions
AddAvailableSdkVersions(_exeSdkBaseDir, "9999.0.0", "9999.0.3-dummy.9", "9999.0.3-dummy.10");
{
const string Requested = "9999.0.100";
+ WriteEmptyGlobalJson();
+
AddAvailableSdkVersions(_exeSdkBaseDir, Requested);
WriteGlobalJson(FormatGlobalJson(policy: rollForward, version: Requested));
{
File.WriteAllText(Path.Combine(_currentWorkingDir, "global.json"), contents);
}
+
+ private void WriteEmptyGlobalJson() => WriteGlobalJson("{}");
}
}