Skip to content

Commit

Permalink
Write global.json
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffkl committed Dec 7, 2022
1 parent 9505fbb commit ac2b98c
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,33 @@ public abstract class TestBase : MSBuildTestBase, IDisposable
protected TestBase()
{
TestRootPath = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), Path.GetRandomFileName())).FullName;
WriteGlobalJson();
}

private void WriteGlobalJson()
{
File.WriteAllText(
Path.Combine(TestRootPath, "global.json"),
$@"{{
""sdk"": {{
""version"": ""{DotNetSdkVersion}"",
""rollForward"": ""latestMinor""
}}
}}");
}

public string DotNetSdkVersion
{
get =>
#if NETCOREAPP3_1
"3.1.100";
#elif NET6_0
"6.0.100";
#elif NET7_0 || NETFRAMEWORK
"7.0.100";
#else
Unknown target framework!
#endif
}

public string TargetFramework
Expand Down

0 comments on commit ac2b98c

Please sign in to comment.