dependabot-nuget 0.240.0 → 0.242.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/helpers/build +45 -0
  3. data/helpers/lib/NuGetUpdater/.editorconfig +364 -0
  4. data/helpers/lib/NuGetUpdater/.gitignore +5 -0
  5. data/helpers/lib/NuGetUpdater/Directory.Build.props +10 -0
  6. data/helpers/lib/NuGetUpdater/Directory.Common.props +16 -0
  7. data/helpers/lib/NuGetUpdater/NuGetProjects/Directory.Build.props +14 -0
  8. data/helpers/lib/NuGetUpdater/NuGetProjects/Directory.Build.targets +7 -0
  9. data/helpers/lib/NuGetUpdater/NuGetProjects/Directory.Packages.props +29 -0
  10. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Build.Tasks/NuGet.Build.Tasks.csproj +27 -0
  11. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.CommandLine/AssemblyMetadataExtractor.cs +203 -0
  12. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.CommandLine/NuGet.CommandLine.csproj +33 -0
  13. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Commands/NuGet.Commands.csproj +26 -0
  14. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Common/NuGet.Common.csproj +21 -0
  15. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Config +6 -0
  16. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Configuration/NuGet.Configuration.csproj +24 -0
  17. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Credentials/NuGet.Credentials.csproj +20 -0
  18. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.DependencyResolver.Core/NuGet.DependencyResolver.Core.csproj +22 -0
  19. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Frameworks/NuGet.Frameworks.csproj +17 -0
  20. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.LibraryModel/NuGet.LibraryModel.csproj +17 -0
  21. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.PackageManagement/NuGet.PackageManagement.csproj +27 -0
  22. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Packaging/NuGet.Packaging.csproj +28 -0
  23. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.ProjectModel/NuGet.ProjectModel.csproj +20 -0
  24. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Protocol/NuGet.Protocol.csproj +21 -0
  25. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Resolver/NuGet.Resolver.csproj +20 -0
  26. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Versioning/NuGet.Versioning.csproj +17 -0
  27. data/helpers/lib/NuGetUpdater/NuGetProjects/README.md +1 -0
  28. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/FrameworkCheckCommand.cs +35 -0
  29. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/UpdateCommand.cs +43 -0
  30. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/NuGetUpdater.Cli.csproj +20 -0
  31. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Program.cs +31 -0
  32. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.FrameworkCheck.cs +42 -0
  33. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Update.cs +323 -0
  34. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/NuGetUpdater.Cli.Test.csproj +24 -0
  35. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Dependency.cs +3 -0
  36. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/DependencyType.cs +12 -0
  37. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/BuildFile.cs +97 -0
  38. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/DotNetToolsJsonBuildFile.cs +23 -0
  39. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/GlobalJsonBuildFile.cs +36 -0
  40. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/JsonBuildFile.cs +47 -0
  41. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/PackagesConfigBuildFile.cs +31 -0
  42. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/ProjectBuildFile.cs +94 -0
  43. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/XmlBuildFile.cs +14 -0
  44. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/CompatabilityChecker.cs +39 -0
  45. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/FrameworkCompatibilityService.cs +73 -0
  46. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/SupportedFrameworks.cs +146 -0
  47. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/NuGetUpdater.Core.csproj +27 -0
  48. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectManager.cs +316 -0
  49. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectResolver.cs +87 -0
  50. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/ConfigurationFile.cs +3 -0
  51. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/DotNetToolsJsonUpdater.cs +66 -0
  52. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/GlobalJsonUpdater.cs +48 -0
  53. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackagesConfigUpdater.cs +172 -0
  54. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/SdkPackageUpdater.cs +498 -0
  55. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdateResult.cs +7 -0
  56. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs +105 -0
  57. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/JsonHelper.cs +222 -0
  58. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/Logger.cs +24 -0
  59. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +460 -0
  60. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/NuGetHelper.cs +15 -0
  61. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/PathHelper.cs +69 -0
  62. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ProcessExtensions.cs +83 -0
  63. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/XmlExtensions.cs +124 -0
  64. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/DotNetToolsJsonBuildFileTests.cs +53 -0
  65. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/GlobalJsonBuildFileTests.cs +80 -0
  66. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/PackagesConfigBuildFileTests.cs +63 -0
  67. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/ProjectBuildFileTests.cs +154 -0
  68. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/FrameworkChecker/CompatibilityCheckerFacts.cs +64 -0
  69. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/FrameworkChecker/FrameworkCompatibilityServiceFacts.cs +122 -0
  70. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/FrameworkChecker/SupportedFrameworkFacts.cs +68 -0
  71. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/NuGetUpdater.Core.Test.csproj +23 -0
  72. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TemporaryDirectory.cs +36 -0
  73. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TestExtensions.cs +15 -0
  74. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/PackagesConfigUpdaterTests.cs +79 -0
  75. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorker.DirsProj.cs +201 -0
  76. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +147 -0
  77. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DotNetTools.cs +225 -0
  78. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.GlobalJson.cs +217 -0
  79. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Mixed.cs +94 -0
  80. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs +938 -0
  81. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Sdk.cs +2177 -0
  82. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/JsonHelperTests.cs +239 -0
  83. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +598 -0
  84. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/SdkPackageUpdaterHelperTests.cs +179 -0
  85. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/SdkPackageUpdaterTests.cs +238 -0
  86. data/helpers/lib/NuGetUpdater/NuGetUpdater.sln +152 -0
  87. data/helpers/lib/NuGetUpdater/xunit.runner.json +4 -0
  88. data/lib/dependabot/nuget/metadata_finder.rb +4 -4
  89. metadata +91 -5
@@ -0,0 +1,31 @@
1
+ using System;
2
+ using System.Collections.Generic;
3
+ using System.IO;
4
+ using System.Linq;
5
+
6
+ using Microsoft.Language.Xml;
7
+
8
+ namespace NuGetUpdater.Core;
9
+
10
+ internal sealed class PackagesConfigBuildFile : XmlBuildFile
11
+ {
12
+ public static PackagesConfigBuildFile Open(string repoRootPath, string path)
13
+ => Parse(repoRootPath, path, File.ReadAllText(path));
14
+ public static PackagesConfigBuildFile Parse(string repoRootPath, string path, string xml)
15
+ => new(repoRootPath, path, Parser.ParseText(xml));
16
+
17
+ public PackagesConfigBuildFile(string repoRootPath, string path, XmlDocumentSyntax contents)
18
+ : base(repoRootPath, path, contents)
19
+ {
20
+ }
21
+
22
+ public IEnumerable<IXmlElementSyntax> Packages => Contents.RootSyntax.GetElements("package", StringComparison.OrdinalIgnoreCase);
23
+
24
+ public IEnumerable<Dependency> GetDependencies() => Packages
25
+ .Where(p => p.GetAttribute("id") is not null && p.GetAttribute("version") is not null)
26
+ .Select(p => new Dependency(
27
+ p.GetAttributeValue("id", StringComparison.OrdinalIgnoreCase),
28
+ p.GetAttributeValue("version", StringComparison.OrdinalIgnoreCase),
29
+ DependencyType.PackageConfig,
30
+ (p.GetAttribute("developmentDependency", StringComparison.OrdinalIgnoreCase)?.Value ?? "false").Equals(true.ToString(), StringComparison.OrdinalIgnoreCase)));
31
+ }
@@ -0,0 +1,94 @@
1
+ using System;
2
+ using System.Collections.Generic;
3
+ using System.IO;
4
+ using System.Linq;
5
+
6
+ using Microsoft.Language.Xml;
7
+
8
+ namespace NuGetUpdater.Core;
9
+
10
+ internal sealed class ProjectBuildFile : XmlBuildFile
11
+ {
12
+ public static ProjectBuildFile Open(string repoRootPath, string path)
13
+ => Parse(repoRootPath, path, File.ReadAllText(path));
14
+ public static ProjectBuildFile Parse(string repoRootPath, string path, string xml)
15
+ => new(repoRootPath, path, Parser.ParseText(xml));
16
+
17
+ public ProjectBuildFile(string repoRootPath, string path, XmlDocumentSyntax contents)
18
+ : base(repoRootPath, path, contents)
19
+ {
20
+ }
21
+
22
+ public IEnumerable<IXmlElementSyntax> PropertyNodes => Contents.RootSyntax
23
+ .GetElements("PropertyGroup", StringComparison.OrdinalIgnoreCase)
24
+ .SelectMany(e => e.Elements);
25
+
26
+ public IEnumerable<KeyValuePair<string, string>> GetProperties() => PropertyNodes
27
+ .Select(e => new KeyValuePair<string, string>(e.Name, e.GetContentValue()));
28
+
29
+ public IEnumerable<IXmlElementSyntax> ItemNodes => Contents.RootSyntax
30
+ .GetElements("ItemGroup", StringComparison.OrdinalIgnoreCase)
31
+ .SelectMany(e => e.Elements);
32
+
33
+ public IEnumerable<IXmlElementSyntax> PackageItemNodes => ItemNodes.Where(e =>
34
+ e.Name.Equals("PackageReference", StringComparison.OrdinalIgnoreCase) ||
35
+ e.Name.Equals("GlobalPackageReference", StringComparison.OrdinalIgnoreCase) ||
36
+ e.Name.Equals("PackageVersion", StringComparison.OrdinalIgnoreCase));
37
+
38
+ public IEnumerable<Dependency> GetDependencies() => PackageItemNodes
39
+ .Select(GetDependency)
40
+ .OfType<Dependency>();
41
+
42
+ private static Dependency? GetDependency(IXmlElementSyntax element)
43
+ {
44
+ var name = element.GetAttributeOrSubElementValue("Include", StringComparison.OrdinalIgnoreCase)
45
+ ?? element.GetAttributeOrSubElementValue("Update", StringComparison.OrdinalIgnoreCase);
46
+ if (name is null || name.StartsWith("@("))
47
+ {
48
+ return null;
49
+ }
50
+
51
+ var isVersionOverride = false;
52
+ var version = element.GetAttributeOrSubElementValue("Version", StringComparison.OrdinalIgnoreCase);
53
+ if (version is null)
54
+ {
55
+ version = element.GetAttributeOrSubElementValue("VersionOverride", StringComparison.OrdinalIgnoreCase);
56
+ isVersionOverride = version is not null;
57
+ }
58
+
59
+ return new Dependency(
60
+ Name: name,
61
+ Version: version?.Length == 0 ? null : version,
62
+ Type: GetDependencyType(element.Name),
63
+ IsOverride: isVersionOverride);
64
+ }
65
+
66
+ private static DependencyType GetDependencyType(string name)
67
+ {
68
+ return name.ToLower() switch
69
+ {
70
+ "packagereference" => DependencyType.PackageReference,
71
+ "globalpackagereference" => DependencyType.GlobalPackageReference,
72
+ "packageversion" => DependencyType.PackageVersion,
73
+ _ => throw new InvalidOperationException($"Unknown dependency type: {name}")
74
+ };
75
+ }
76
+
77
+ public IEnumerable<string> GetReferencedProjectPaths() => ItemNodes
78
+ .Where(e =>
79
+ e.Name.Equals("ProjectReference", StringComparison.OrdinalIgnoreCase) ||
80
+ e.Name.Equals("ProjectFile", StringComparison.OrdinalIgnoreCase))
81
+ .Select(e => PathHelper.GetFullPathFromRelative(System.IO.Path.GetDirectoryName(Path)!, e.GetAttribute("Include").Value));
82
+
83
+ public void NormalizeDirectorySeparatorsInProject()
84
+ {
85
+ var hintPathNodes = Contents.Descendants()
86
+ .Where(e =>
87
+ e.Name.Equals("HintPath", StringComparison.OrdinalIgnoreCase) &&
88
+ e.Parent.Name.Equals("Reference", StringComparison.OrdinalIgnoreCase))
89
+ .Select(e => (XmlElementSyntax)e.AsNode);
90
+ var updatedXml = Contents.ReplaceNodes(hintPathNodes,
91
+ (_, n) => n.WithContent(n.GetContentValue().Replace("/", "\\")).AsNode);
92
+ Update(updatedXml);
93
+ }
94
+ }
@@ -0,0 +1,14 @@
1
+ using Microsoft.Language.Xml;
2
+
3
+ namespace NuGetUpdater.Core;
4
+
5
+ internal abstract class XmlBuildFile : BuildFile<XmlDocumentSyntax>
6
+ {
7
+ public XmlBuildFile(string repoRootPath, string path, XmlDocumentSyntax contents)
8
+ : base(repoRootPath, path, contents)
9
+ {
10
+ }
11
+
12
+ protected override string GetContentsString(XmlDocumentSyntax contents)
13
+ => contents.ToFullString();
14
+ }
@@ -0,0 +1,39 @@
1
+ using System.Linq;
2
+
3
+ using NuGet.Frameworks;
4
+
5
+ namespace NuGetUpdater.Core.FrameworkChecker;
6
+
7
+ public class CompatibilityChecker
8
+ {
9
+ public static bool IsCompatible(string[] projectTfms, string[] packageTfms, Logger logger)
10
+ {
11
+ var projectFrameworks = projectTfms.Select(ParseFramework);
12
+ var packageFrameworks = packageTfms.Select(ParseFramework);
13
+
14
+ var compatibilityService = new FrameworkCompatibilityService();
15
+ var compatibleFrameworks = compatibilityService.GetCompatibleFrameworks(packageFrameworks);
16
+
17
+ var incompatibleFrameworks = projectFrameworks.Where(f => !compatibleFrameworks.Contains(f)).ToArray();
18
+ if (incompatibleFrameworks.Length > 0)
19
+ {
20
+ logger.Log($"The package is not compatible. Incompatible project frameworks: {string.Join(", ", incompatibleFrameworks.Select(f => f.GetShortFolderName()))}");
21
+ return false;
22
+ }
23
+
24
+ logger.Log("The package is compatible.");
25
+ return true;
26
+
27
+ static NuGetFramework ParseFramework(string tfm)
28
+ {
29
+ var framework = NuGetFramework.Parse(tfm);
30
+ if (framework.HasPlatform && framework.PlatformVersion != FrameworkConstants.EmptyVersion)
31
+ {
32
+ // Platform versions are not well supported by the FrameworkCompatibilityService. Make a best
33
+ // effort by including just the platform.
34
+ framework = new NuGetFramework(framework.Framework, framework.Version, framework.Platform, FrameworkConstants.EmptyVersion);
35
+ }
36
+ return framework;
37
+ }
38
+ }
39
+ }
@@ -0,0 +1,73 @@
1
+ // Copyright (c) .NET Foundation. All rights reserved.
2
+ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3
+
4
+ using System;
5
+ using System.Collections.Generic;
6
+
7
+ using NuGet.Frameworks;
8
+ using NuGetGallery.Frameworks;
9
+
10
+ namespace NuGetUpdater.Core.FrameworkChecker;
11
+
12
+ public class FrameworkCompatibilityService
13
+ {
14
+ private static readonly IFrameworkCompatibilityProvider CompatibilityProvider = DefaultCompatibilityProvider.Instance;
15
+ private static readonly IReadOnlyList<NuGetFramework> AllSupportedFrameworks = SupportedFrameworks.AllSupportedNuGetFrameworks;
16
+ private static readonly IReadOnlyDictionary<NuGetFramework, ISet<NuGetFramework>> CompatibilityMatrix = GetCompatibilityMatrix();
17
+
18
+ public ISet<NuGetFramework> GetCompatibleFrameworks(IEnumerable<NuGetFramework> packageFrameworks)
19
+ {
20
+ if (packageFrameworks == null)
21
+ {
22
+ throw new ArgumentNullException(nameof(packageFrameworks));
23
+ }
24
+
25
+ var allCompatibleFrameworks = new HashSet<NuGetFramework>();
26
+
27
+ foreach (var packageFramework in packageFrameworks)
28
+ {
29
+ if (packageFrameworks == null || packageFramework.IsUnsupported || packageFramework.IsPCL)
30
+ {
31
+ continue;
32
+ }
33
+
34
+ if (CompatibilityMatrix.TryGetValue(packageFramework, out var compatibleFrameworks))
35
+ {
36
+ allCompatibleFrameworks.UnionWith(compatibleFrameworks);
37
+ }
38
+ else
39
+ {
40
+ allCompatibleFrameworks.Add(packageFramework);
41
+ }
42
+ }
43
+
44
+ return allCompatibleFrameworks;
45
+ }
46
+
47
+ private static IReadOnlyDictionary<NuGetFramework, ISet<NuGetFramework>> GetCompatibilityMatrix()
48
+ {
49
+ var matrix = new Dictionary<NuGetFramework, ISet<NuGetFramework>>();
50
+
51
+ foreach (var packageFramework in AllSupportedFrameworks)
52
+ {
53
+ var compatibleFrameworks = new HashSet<NuGetFramework>();
54
+ matrix.Add(packageFramework, compatibleFrameworks);
55
+
56
+ foreach (var projectFramework in AllSupportedFrameworks)
57
+ {
58
+ // This compatibility check is to know if the packageFramework can be installed on a certain projectFramework
59
+ if (CompatibilityProvider.IsCompatible(projectFramework, packageFramework))
60
+ {
61
+ compatibleFrameworks.Add(projectFramework);
62
+ }
63
+ }
64
+ }
65
+
66
+ matrix.Add(SupportedFrameworks.Net60Windows7,
67
+ new HashSet<NuGetFramework>() {
68
+ SupportedFrameworks.Net60Windows, SupportedFrameworks.Net60Windows7,
69
+ SupportedFrameworks.Net70Windows, SupportedFrameworks.Net70Windows7 });
70
+
71
+ return matrix;
72
+ }
73
+ }
@@ -0,0 +1,146 @@
1
+ // Copyright (c) .NET Foundation. All rights reserved.
2
+ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3
+
4
+ using System;
5
+ using System.Collections.Generic;
6
+ using NuGet.Frameworks;
7
+ using static NuGet.Frameworks.FrameworkConstants;
8
+ using static NuGet.Frameworks.FrameworkConstants.CommonFrameworks;
9
+
10
+ namespace NuGetGallery.Frameworks
11
+ {
12
+ /// <summary>
13
+ /// This class contains documented supported frameworks.
14
+ /// </summary>
15
+ /// <remarks>
16
+ /// All these frameworks were retrieved from the following sources:
17
+ /// dotnet documentation: https://docs.microsoft.com/en-us/dotnet/standard/frameworks.
18
+ /// nuget documentation: https://docs.microsoft.com/en-us/nuget/reference/target-frameworks.
19
+ /// nuget client FrameworkConstants.CommonFrameworks: https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Core/NuGet.Frameworks/FrameworkConstants.cs.
20
+ /// Deprecated frameworks are not included on the list https://docs.microsoft.com/en-us/dotnet/standard/frameworks#deprecated-target-frameworks.
21
+ /// </remarks>
22
+ public static class SupportedFrameworks
23
+ {
24
+ public static readonly Version Version8 = new Version(8, 0, 0, 0); // https://github.com/NuGet/Engineering/issues/5112
25
+
26
+ public static readonly NuGetFramework MonoAndroid = new NuGetFramework(FrameworkIdentifiers.MonoAndroid, EmptyVersion);
27
+ public static readonly NuGetFramework MonoTouch = new NuGetFramework(FrameworkIdentifiers.MonoTouch, EmptyVersion);
28
+ public static readonly NuGetFramework MonoMac = new NuGetFramework(FrameworkIdentifiers.MonoMac, EmptyVersion);
29
+ public static readonly NuGetFramework Net3 = new NuGetFramework(FrameworkIdentifiers.Net, new Version(3, 0, 0, 0));
30
+ public static readonly NuGetFramework Net48 = new NuGetFramework(FrameworkIdentifiers.Net, new Version(4, 8, 0, 0));
31
+ public static readonly NuGetFramework Net481 = new NuGetFramework(FrameworkIdentifiers.Net, new Version(4, 8, 1, 0));
32
+ public static readonly NuGetFramework Net50Windows = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version5, "windows", EmptyVersion);
33
+ public static readonly NuGetFramework Net60Android = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version6, "android", EmptyVersion);
34
+ public static readonly NuGetFramework Net60Ios = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version6, "ios", EmptyVersion);
35
+ public static readonly NuGetFramework Net60MacOs = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version6, "macos", EmptyVersion);
36
+ public static readonly NuGetFramework Net60MacCatalyst = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version6, "maccatalyst", EmptyVersion);
37
+ public static readonly NuGetFramework Net60TvOs = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version6, "tvos", EmptyVersion);
38
+ public static readonly NuGetFramework Net60Windows = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version6, "windows", EmptyVersion);
39
+ public static readonly NuGetFramework Net70Android = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version7, "android", EmptyVersion);
40
+ public static readonly NuGetFramework Net70Ios = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version7, "ios", EmptyVersion);
41
+ public static readonly NuGetFramework Net70MacOs = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version7, "macos", EmptyVersion);
42
+ public static readonly NuGetFramework Net70MacCatalyst = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version7, "maccatalyst", EmptyVersion);
43
+ public static readonly NuGetFramework Net70TvOs = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version7, "tvos", EmptyVersion);
44
+ public static readonly NuGetFramework Net70Windows = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version7, "windows", EmptyVersion);
45
+ public static readonly NuGetFramework Net80 = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version8); // https://github.com/NuGet/Engineering/issues/5112
46
+ public static readonly NuGetFramework Net80Android = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version8, "android", EmptyVersion);
47
+ public static readonly NuGetFramework Net80Ios = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version8, "ios", EmptyVersion);
48
+ public static readonly NuGetFramework Net80MacOs = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version8, "macos", EmptyVersion);
49
+ public static readonly NuGetFramework Net80MacCatalyst = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version8, "maccatalyst", EmptyVersion);
50
+ public static readonly NuGetFramework Net80TvOs = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version8, "tvos", EmptyVersion);
51
+ public static readonly NuGetFramework Net80Windows = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version8, "windows", EmptyVersion);
52
+ public static readonly NuGetFramework NetCore = new NuGetFramework(FrameworkIdentifiers.NetCore, EmptyVersion);
53
+ public static readonly NuGetFramework NetMf = new NuGetFramework(FrameworkIdentifiers.NetMicro, EmptyVersion);
54
+ public static readonly NuGetFramework UAP = new NuGetFramework(FrameworkIdentifiers.UAP, EmptyVersion);
55
+ public static readonly NuGetFramework WP = new NuGetFramework(FrameworkIdentifiers.WindowsPhone, EmptyVersion);
56
+ public static readonly NuGetFramework XamarinIOs = new NuGetFramework(FrameworkIdentifiers.XamarinIOs, EmptyVersion);
57
+ public static readonly NuGetFramework XamarinMac = new NuGetFramework(FrameworkIdentifiers.XamarinMac, EmptyVersion);
58
+ public static readonly NuGetFramework XamarinTvOs = new NuGetFramework(FrameworkIdentifiers.XamarinTVOS, EmptyVersion);
59
+ public static readonly NuGetFramework XamarinWatchOs = new NuGetFramework(FrameworkIdentifiers.XamarinWatchOS, EmptyVersion);
60
+
61
+ public static readonly NuGetFramework Net60Windows7 = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version6, "windows", Version7);
62
+ public static readonly NuGetFramework Net70Windows7 = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version7, "windows", Version7);
63
+
64
+ public static readonly IReadOnlyList<NuGetFramework> AllSupportedNuGetFrameworks;
65
+
66
+ static SupportedFrameworks()
67
+ {
68
+ AllSupportedNuGetFrameworks = new List<NuGetFramework>
69
+ {
70
+ MonoAndroid, MonoMac, MonoTouch,
71
+ Native,
72
+ Net11, Net2, Net35, Net4, Net403, Net45, Net451, Net452, Net46, Net461, Net462, Net463, Net47, Net471, Net472, Net48, Net481,
73
+ Net50, Net50Windows,
74
+ Net60, Net60Android, Net60Ios, Net60MacCatalyst, Net60MacOs, Net60TvOs, Net60Windows,
75
+ Net70, Net70Android, Net70Ios, Net70MacCatalyst, Net70MacOs, Net70TvOs, Net70Windows,
76
+ Net80, Net80Android, Net80Ios, Net80MacCatalyst, Net80MacOs, Net80TvOs, Net80Windows,
77
+ NetCore, NetCore45, NetCore451,
78
+ NetCoreApp10, NetCoreApp11, NetCoreApp20, NetCoreApp21, NetCoreApp22, NetCoreApp30, NetCoreApp31,
79
+ NetMf,
80
+ NetStandard, NetStandard10, NetStandard11, NetStandard12, NetStandard13, NetStandard14, NetStandard15, NetStandard16, NetStandard20, NetStandard21,
81
+ SL4, SL5,
82
+ Tizen3, Tizen4, Tizen6,
83
+ UAP, UAP10,
84
+ WP, WP7, WP75, WP8, WP81, WPA81,
85
+ XamarinIOs, XamarinMac, XamarinTvOs, XamarinWatchOs
86
+ };
87
+ }
88
+
89
+ /// <summary>
90
+ /// Lists of TFMs that users can filter packages by (for each Framework Generation) on NuGet.org search
91
+ /// </summary>
92
+ public static class TfmFilters
93
+ {
94
+ public static readonly List<NuGetFramework> NetTfms = new List<NuGetFramework>
95
+ {
96
+ Net80,
97
+ Net70,
98
+ Net60,
99
+ Net50
100
+ };
101
+
102
+ public static readonly List<NuGetFramework> NetCoreAppTfms = new List<NuGetFramework>
103
+ {
104
+ NetCoreApp31,
105
+ NetCoreApp30,
106
+ NetCoreApp22,
107
+ NetCoreApp21,
108
+ NetCoreApp20,
109
+ NetCoreApp11,
110
+ NetCoreApp10
111
+ };
112
+
113
+ public static readonly List<NuGetFramework> NetStandardTfms = new List<NuGetFramework>
114
+ {
115
+ NetStandard21,
116
+ NetStandard20,
117
+ NetStandard16,
118
+ NetStandard15,
119
+ NetStandard14,
120
+ NetStandard13,
121
+ NetStandard12,
122
+ NetStandard11,
123
+ NetStandard10
124
+ };
125
+
126
+ public static readonly List<NuGetFramework> NetFrameworkTfms = new List<NuGetFramework>
127
+ {
128
+ Net481,
129
+ Net48,
130
+ Net472,
131
+ Net471,
132
+ Net47,
133
+ Net462,
134
+ Net461,
135
+ Net46,
136
+ Net452,
137
+ Net451,
138
+ Net45,
139
+ Net4,
140
+ Net35,
141
+ Net3,
142
+ Net2
143
+ };
144
+ }
145
+ }
146
+ }
@@ -0,0 +1,27 @@
1
+ <Project Sdk="Microsoft.NET.Sdk">
2
+
3
+ <PropertyGroup>
4
+ <TargetFramework>$(CommonTargetFramework)</TargetFramework>
5
+ <IsPackable>false</IsPackable>
6
+ <Nullable>enable</Nullable>
7
+ <GeneratePathProperty>true</GeneratePathProperty>
8
+ </PropertyGroup>
9
+
10
+ <ItemGroup>
11
+ <ProjectReference Include="..\NuGetProjects\NuGet.CommandLine\NuGet.CommandLine.csproj" />
12
+ </ItemGroup>
13
+
14
+ <ItemGroup>
15
+ <PackageReference Include="GuiLabs.Language.Xml" Version="1.2.60" />
16
+ <PackageReference Include="DiffPlex" Version="1.7.1" />
17
+ <PackageReference Include="Microsoft.Build.Locator" Version="1.6.1" />
18
+ <PackageReference Include="Microsoft.Build" Version="17.5.0" ExcludeAssets="Runtime" PrivateAssets="All" />
19
+ <PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.5.0" ExcludeAssets="Runtime" PrivateAssets="All" />
20
+ <PackageReference Include="NuGet.Core" Version="2.14.0-rtm-832" Aliases="CoreV2" />
21
+ </ItemGroup>
22
+
23
+ <ItemGroup>
24
+ <InternalsVisibleTo Include="NuGetUpdater.Core.Test"/>
25
+ </ItemGroup>
26
+
27
+ </Project>