-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathReferenceAssemblyCatalog.cs
66 lines (54 loc) · 3.18 KB
/
ReferenceAssemblyCatalog.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
namespace EffectiveCSharp.Analyzers.Tests.Helpers;
/// <summary>
/// The testing framework does heavy work to resolve references for set of <see cref="ReferenceAssemblies"/>, including potentially
/// running the NuGet client to download packages. This class caches the ReferenceAssemblies class (which is thread-safe), so that
/// package resolution only happens once for a given configuration.
/// </summary>
/// <remarks>
/// It would be more straightforward to pass around ReferenceAssemblies instances directly, but using non-primitive types causes
/// Visual Studio's Test Explorer to collapse all test cases down to a single entry, which makes it harder to see which test cases
/// are failing or debug a single test case.
/// </remarks>
internal static class ReferenceAssemblyCatalog
{
// We want to test the supported versions of .NET
// References
// https://learn.microsoft.com/en-us/lifecycle/products/microsoft-net-framework
// https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-framework
// https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core
//
// As of July 2024, the supported versions are:
// .NET Framework:
// 4.8.1 and 4.8
// 4.7.2, 4.7.1, and 4.7
// 4.6.2 (ends Jan 12, 2027 because of Windows)
// 3.5 SP1 (ends Jan 9, 2029 because of Windows)
// NOTE: 4.5.2, 4.6, 4.6.1 retired on April 26, 2022
// .NET (formally .NET Core)
// 8 LTS (ends Nov 10, 2026)
// 6 LTS (ends Nov 12, 2024)
// NOTE: 7, 5, Core 3.1, 3.0, 2.2, 2.1, 2.0, 1.1, and 1.0 are no longer supported
public static string Net48 => nameof(ReferenceAssemblies.NetFramework.Net48);
public static string Net472 => nameof(ReferenceAssemblies.NetFramework.Net472);
public static string Net471 => nameof(ReferenceAssemblies.NetFramework.Net471);
public static string Net47 => nameof(ReferenceAssemblies.NetFramework.Net47);
public static string Net462 => nameof(ReferenceAssemblies.NetFramework.Net462);
public static string Net35 => nameof(ReferenceAssemblies.NetFramework.Net35);
public static string Net60 => nameof(ReferenceAssemblies.Net.Net60);
public static string Net80 => nameof(ReferenceAssemblies.Net.Net80);
public static string Net90 => nameof(ReferenceAssemblies.Net.Net90);
public static string Latest => nameof(ReferenceAssemblies.Net.Net80);
public static IReadOnlyDictionary<string, ReferenceAssemblies> Catalog { get; } = new Dictionary<string, ReferenceAssemblies>(StringComparer.Ordinal)
{
{ Net48, ReferenceAssemblies.NetFramework.Net48.Default },
{ Net472, ReferenceAssemblies.NetFramework.Net472.Default },
{ Net471, ReferenceAssemblies.NetFramework.Net471.Default },
{ Net47, ReferenceAssemblies.NetFramework.Net47.Default },
{ Net462, ReferenceAssemblies.NetFramework.Net462.Default },
{ Net35, ReferenceAssemblies.NetFramework.Net35.Default },
{ Net60, ReferenceAssemblies.Net.Net60 },
{ Net80, ReferenceAssemblies.Net.Net80 },
{ Net90, ReferenceAssemblies.Net.Net90 },
};
public static IReadOnlySet<string> DotNetCore { get; } = new HashSet<string>([Net60, Net80, Net90], StringComparer.Ordinal);
}