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,203 @@
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 System.Diagnostics.CodeAnalysis;
7
+ using System.Globalization;
8
+ using System.IO;
9
+ using System.Linq;
10
+ using System.Reflection;
11
+ using NuGet.Common;
12
+ using NuGet.Packaging;
13
+ using NuGet.Packaging.Core;
14
+ using NuGet.Versioning;
15
+
16
+ namespace NuGet.CommandLine
17
+ {
18
+ internal sealed class AssemblyMetadataExtractor
19
+ {
20
+ private readonly ILogger _logger;
21
+
22
+ public AssemblyMetadataExtractor(ILogger logger) => _logger = logger ?? NullLogger.Instance;
23
+
24
+ private static T CreateInstance<T>(AppDomain domain)
25
+ {
26
+ string assemblyLocation = Assembly.GetExecutingAssembly().Location;
27
+
28
+ try
29
+ {
30
+ return (T)domain.CreateInstanceFromAndUnwrap(assemblyLocation, typeof(T).FullName);
31
+ }
32
+ catch (FileLoadException flex) when (UriUtility.GetLocalPath(flex.FileName).Equals(assemblyLocation, StringComparison.Ordinal))
33
+ {
34
+ // Reflection loading error for sandboxed assembly
35
+ var exceptionMessage = string.Format(
36
+ CultureInfo.InvariantCulture,
37
+ LocalizedResourceManager.GetString("Error_NuGetExeNeedsToBeUnblockedAfterDownloading"),
38
+ UriUtility.GetLocalPath(flex.FileName));
39
+ throw new PackagingException(NuGetLogCode.NU5133, exceptionMessage, flex);
40
+ }
41
+ }
42
+
43
+ public AssemblyMetadata GetMetadata(string assemblyPath)
44
+ {
45
+ return new AssemblyMetadata();
46
+ }
47
+
48
+ public void ExtractMetadata(PackageBuilder builder, string assemblyPath)
49
+ {
50
+ AssemblyMetadata assemblyMetadata = GetMetadata(assemblyPath);
51
+ builder.Title = assemblyMetadata.Title;
52
+ builder.Description = assemblyMetadata.Description;
53
+ builder.Copyright = assemblyMetadata.Copyright;
54
+
55
+ // using InformationalVersion if possible, fallback to Version otherwise
56
+ if (NuGetVersion.TryParse(assemblyMetadata.InformationalVersion, out var informationalVersion))
57
+ {
58
+ builder.Version = informationalVersion;
59
+ }
60
+ else
61
+ {
62
+ _logger.LogInformation(string.Format(
63
+ CultureInfo.CurrentCulture, NuGetResources.InvalidAssemblyInformationalVersion,
64
+ assemblyMetadata.InformationalVersion, assemblyPath, assemblyMetadata.Version));
65
+
66
+ builder.Version = NuGetVersion.Parse(assemblyMetadata.Version);
67
+ }
68
+
69
+ if (!builder.Authors.Any())
70
+ {
71
+ if (assemblyMetadata.Properties.ContainsKey("authors"))
72
+ {
73
+ builder.Authors.AddRange(assemblyMetadata.Properties["authors"].Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries));
74
+ }
75
+ else if (!string.IsNullOrEmpty(assemblyMetadata.Company))
76
+ {
77
+ builder.Authors.Add(assemblyMetadata.Company);
78
+ }
79
+ }
80
+
81
+ if (assemblyMetadata.Properties.ContainsKey("owners"))
82
+ {
83
+ builder.Owners.AddRange(assemblyMetadata.Properties["owners"].Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries));
84
+ }
85
+
86
+ builder.Properties.AddRange(assemblyMetadata.Properties);
87
+ // Let the id be overriden by AssemblyMetadataAttribute
88
+ // This preserves the existing behavior if no id metadata
89
+ // is provided by the assembly.
90
+ if (builder.Properties.ContainsKey("id"))
91
+ {
92
+ builder.Id = builder.Properties["id"];
93
+ }
94
+ else
95
+ {
96
+ builder.Id = assemblyMetadata.Name;
97
+ }
98
+ }
99
+
100
+ private sealed class MetadataExtractor : MarshalByRefObject
101
+ {
102
+ private class AssemblyResolver
103
+ {
104
+ private readonly string _lookupPath;
105
+
106
+ public AssemblyResolver(string assemblyPath)
107
+ {
108
+ _lookupPath = Path.GetDirectoryName(assemblyPath);
109
+ }
110
+
111
+ public Assembly ReflectionOnlyAssemblyResolve(object sender, ResolveEventArgs args)
112
+ {
113
+ var name = new AssemblyName(AppDomain.CurrentDomain.ApplyPolicy(args.Name));
114
+ var assemblyPath = Path.Combine(_lookupPath, name.Name + ".dll");
115
+ return File.Exists(assemblyPath) ?
116
+ Assembly.ReflectionOnlyLoadFrom(assemblyPath) : // load from same folder as parent assembly
117
+ Assembly.ReflectionOnlyLoad(name.FullName); // load from GAC
118
+ }
119
+ }
120
+
121
+ [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "It's a marshal by ref object used to collection information in another app domain")]
122
+ public AssemblyMetadata GetAssemblyMetadata(string path)
123
+ {
124
+ var resolver = new AssemblyResolver(path);
125
+ AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += resolver.ReflectionOnlyAssemblyResolve;
126
+
127
+ try
128
+ {
129
+ Assembly assembly = Assembly.ReflectionOnlyLoadFrom(path);
130
+ AssemblyName assemblyName = assembly.GetName();
131
+
132
+ var attributes = CustomAttributeData.GetCustomAttributes(assembly);
133
+
134
+ // We should not try to parse the version and eventually throw here: this leads to incorrect errors when, later on, ProjectFactory is trying to retrieve Authors and Description
135
+ // Best to parse the version into a NuGetVersion later.
136
+ // We should also not decide here whether to use informationalVersion or assembly version. Let's let consumers decide.
137
+ var version = assemblyName.Version.ToString();
138
+ var informationalVersion = GetAttributeValueOrDefault<AssemblyInformationalVersionAttribute>(attributes);
139
+ informationalVersion = string.IsNullOrEmpty(informationalVersion) ? version : informationalVersion;
140
+
141
+ return new AssemblyMetadata(GetProperties(attributes))
142
+ {
143
+ Name = assemblyName.Name,
144
+ Version = version,
145
+ InformationalVersion = informationalVersion,
146
+ Title = GetAttributeValueOrDefault<AssemblyTitleAttribute>(attributes),
147
+ Company = GetAttributeValueOrDefault<AssemblyCompanyAttribute>(attributes),
148
+ Description = GetAttributeValueOrDefault<AssemblyDescriptionAttribute>(attributes),
149
+ Copyright = GetAttributeValueOrDefault<AssemblyCopyrightAttribute>(attributes)
150
+ };
151
+ }
152
+ finally
153
+ {
154
+ AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve -= resolver.ReflectionOnlyAssemblyResolve;
155
+ }
156
+ }
157
+
158
+ private static Dictionary<string, string> GetProperties(IList<CustomAttributeData> attributes)
159
+ {
160
+ var properties = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
161
+ // NOTE: we make this check only by attribute type fullname, and we try to duck
162
+ // type it, therefore enabling the same metadata extesibility behavior for other platforms
163
+ // that don't define the attribute already as part of the framework.
164
+ // A package author could simply declare this attribute in his own project, using
165
+ // the same namespace and members, and we'd pick it up automatically. This is consistent
166
+ // with what MS did in the past with the System.Runtime.CompilerServices.ExtensionAttribute
167
+ // which allowed Linq to be re-implemented for .NET 2.0 :).
168
+ var attributeName = typeof(AssemblyMetadataAttribute).FullName;
169
+ foreach (var attribute in attributes.Where(x =>
170
+ x.Constructor.DeclaringType.FullName == attributeName &&
171
+ x.ConstructorArguments.Count == 2))
172
+ {
173
+ string key = attribute.ConstructorArguments[0].Value.ToString();
174
+ string value = attribute.ConstructorArguments[1].Value.ToString();
175
+ // Return the value only if it isn't null or empty so that we can use ?? to fall back
176
+ if (!string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(value))
177
+ {
178
+ properties[key] = value;
179
+ }
180
+ }
181
+
182
+ return properties;
183
+ }
184
+
185
+ private static string GetAttributeValueOrDefault<T>(IList<CustomAttributeData> attributes) where T : Attribute
186
+ {
187
+ foreach (var attribute in attributes)
188
+ {
189
+ if (attribute.Constructor.DeclaringType == typeof(T))
190
+ {
191
+ string value = attribute.ConstructorArguments[0].Value.ToString();
192
+ // Return the value only if it isn't null or empty so that we can use ?? to fall back
193
+ if (!string.IsNullOrEmpty(value))
194
+ {
195
+ return value;
196
+ }
197
+ }
198
+ }
199
+ return null;
200
+ }
201
+ }
202
+ }
203
+ }
@@ -0,0 +1,33 @@
1
+ <Project Sdk="Microsoft.NET.Sdk">
2
+
3
+ <PropertyGroup>
4
+ <TargetFramework>$(CommonTargetFramework)</TargetFramework>
5
+ <NoWarn>$(NoWarn);CA1416</NoWarn>
6
+ </PropertyGroup>
7
+
8
+ <ItemGroup>
9
+ <ProjectReference Include="..\NuGet.Build.Tasks\NuGet.Build.Tasks.csproj" />
10
+ <ProjectReference Include="..\NuGet.PackageManagement\NuGet.PackageManagement.csproj" />
11
+ </ItemGroup>
12
+
13
+ <ItemGroup>
14
+ <PackageReference Include="Microsoft.VisualStudio.Setup.Configuration.Interop" ExcludeAssets="runtime" />
15
+ <PackageReference Include="NuGet.Core" Aliases="CoreV2" PrivateAssets="All" />
16
+ <PackageReference Include="System.ComponentModel.Composition" />
17
+ </ItemGroup>
18
+
19
+ <ItemGroup>
20
+ <Compile Include="$(NuGetSourceLocation)\src\NuGet.Clients\NuGet.CommandLine\**\*.cs" />
21
+ <!--
22
+ The `AssemblyMetadataExtractor.GetMetadata()` method is dependent upon app domains which are not supported, so this
23
+ directory contains a copy of that file with that method replaced by a stub.
24
+ -->
25
+ <Compile Remove="$(NuGetSourceLocation)\src\NuGet.Clients\NuGet.CommandLine\Commands\Pack\AssemblyMetadataExtractor.cs" />
26
+ </ItemGroup>
27
+
28
+ <ItemGroup>
29
+ <EmbeddedResource Include="$(NuGetSourceLocation)\src\NuGet.Clients\NuGet.CommandLine\**\*.resx" />
30
+ <EmbeddedResource Include="$(OutputPath)\**\$(AssemblyName).resources.dll" />
31
+ </ItemGroup>
32
+
33
+ </Project>
@@ -0,0 +1,26 @@
1
+ <Project Sdk="Microsoft.NET.Sdk">
2
+
3
+ <PropertyGroup>
4
+ <TargetFramework>$(CommonTargetFramework)</TargetFramework>
5
+ <NoWarn>$(NoWarn);CS1591;CS1574;CS1573;CS1584;CS1658;CS1998;RS0041</NoWarn>
6
+ </PropertyGroup>
7
+
8
+ <ItemGroup>
9
+ <ProjectReference Include="..\NuGet.Credentials\NuGet.Credentials.csproj" />
10
+ <ProjectReference Include="..\NuGet.ProjectModel\NuGet.ProjectModel.csproj" />
11
+ </ItemGroup>
12
+
13
+ <ItemGroup>
14
+ <PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" />
15
+ <PackageReference Include="Microsoft.Extensions.FileProviders.Abstractions" />
16
+ </ItemGroup>
17
+
18
+ <ItemGroup>
19
+ <Compile Include="$(NuGetSourceLocation)\src\NuGet.Core\NuGet.Commands\**\*.cs" />
20
+ </ItemGroup>
21
+
22
+ <ItemGroup>
23
+ <EmbeddedResource Include="$(NuGetSourceLocation)\src\NuGet.Core\NuGet.Commands\**\*.resx" />
24
+ </ItemGroup>
25
+
26
+ </Project>
@@ -0,0 +1,21 @@
1
+ <Project Sdk="Microsoft.NET.Sdk">
2
+
3
+ <PropertyGroup>
4
+ <TargetFramework>$(CommonTargetFramework)</TargetFramework>
5
+ <NoWarn>$(NoWarn);CS1591;CS1574;RS0041</NoWarn>
6
+ <Nullable>enable</Nullable>
7
+ </PropertyGroup>
8
+
9
+ <ItemGroup>
10
+ <ProjectReference Include="..\NuGet.Frameworks\NuGet.Frameworks.csproj" />
11
+ </ItemGroup>
12
+
13
+ <ItemGroup>
14
+ <Compile Include="$(NuGetSourceLocation)\src\NuGet.Core\NuGet.Common\**\*.cs" />
15
+ </ItemGroup>
16
+
17
+ <ItemGroup>
18
+ <EmbeddedResource Include="$(NuGetSourceLocation)\src\NuGet.Core\NuGet.Common\**\*.resx" />
19
+ </ItemGroup>
20
+
21
+ </Project>
@@ -0,0 +1,6 @@
1
+ <configuration>
2
+ <packageSources>
3
+ <clear />
4
+ <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
5
+ </packageSources>
6
+ </configuration>
@@ -0,0 +1,24 @@
1
+ <Project Sdk="Microsoft.NET.Sdk">
2
+
3
+ <PropertyGroup>
4
+ <TargetFramework>$(CommonTargetFramework)</TargetFramework>
5
+ <NoWarn>$(NoWarn);CS1591;RS0041</NoWarn>
6
+ </PropertyGroup>
7
+
8
+ <ItemGroup>
9
+ <ProjectReference Include="..\NuGet.Common\NuGet.Common.csproj" />
10
+ </ItemGroup>
11
+
12
+ <ItemGroup>
13
+ <PackageReference Include="System.Security.Cryptography.ProtectedData" />
14
+ </ItemGroup>
15
+
16
+ <ItemGroup>
17
+ <Compile Include="$(NuGetSourceLocation)\src\NuGet.Core\NuGet.Configuration\**\*.cs" />
18
+ </ItemGroup>
19
+
20
+ <ItemGroup>
21
+ <EmbeddedResource Include="$(NuGetSourceLocation)\src\NuGet.Core\NuGet.Configuration\**\*.resx" />
22
+ </ItemGroup>
23
+
24
+ </Project>
@@ -0,0 +1,20 @@
1
+ <Project Sdk="Microsoft.NET.Sdk">
2
+
3
+ <PropertyGroup>
4
+ <TargetFramework>$(CommonTargetFramework)</TargetFramework>
5
+ <NoWarn>$(NoWarn);RS0041</NoWarn>
6
+ </PropertyGroup>
7
+
8
+ <ItemGroup>
9
+ <ProjectReference Include="..\NuGet.Protocol\NuGet.Protocol.csproj" />
10
+ </ItemGroup>
11
+
12
+ <ItemGroup>
13
+ <Compile Include="$(NuGetSourceLocation)\src\NuGet.Core\NuGet.Credentials\**\*.cs" />
14
+ </ItemGroup>
15
+
16
+ <ItemGroup>
17
+ <EmbeddedResource Include="$(NuGetSourceLocation)\src\NuGet.Core\NuGet.Credentials\**\*.resx" />
18
+ </ItemGroup>
19
+
20
+ </Project>
@@ -0,0 +1,22 @@
1
+ <Project Sdk="Microsoft.NET.Sdk">
2
+
3
+ <PropertyGroup>
4
+ <TargetFramework>$(CommonTargetFramework)</TargetFramework>
5
+ <NoWarn>$(NoWarn);CS1591;CS1574;RS0041</NoWarn>
6
+ </PropertyGroup>
7
+
8
+ <ItemGroup>
9
+ <ProjectReference Include="..\NuGet.Configuration\NuGet.Configuration.csproj" />
10
+ <ProjectReference Include="..\NuGet.LibraryModel\NuGet.LibraryModel.csproj" />
11
+ <ProjectReference Include="..\NuGet.Protocol\NuGet.Protocol.csproj" />
12
+ </ItemGroup>
13
+
14
+ <ItemGroup>
15
+ <Compile Include="$(NuGetSourceLocation)\src\NuGet.Core\NuGet.DependencyResolver.Core\**\*.cs" />
16
+ </ItemGroup>
17
+
18
+ <ItemGroup>
19
+ <EmbeddedResource Include="$(NuGetSourceLocation)\src\NuGet.Core\NuGet.DependencyResolver.Core\**\*.resx" />
20
+ </ItemGroup>
21
+
22
+ </Project>
@@ -0,0 +1,17 @@
1
+ <Project Sdk="Microsoft.NET.Sdk">
2
+
3
+ <PropertyGroup>
4
+ <TargetFramework>$(CommonTargetFramework)</TargetFramework>
5
+ <NoWarn>$(NoWarn);CS1591;CS1574;CS1573;RS0041</NoWarn>
6
+ <Nullable>enable</Nullable>
7
+ </PropertyGroup>
8
+
9
+ <ItemGroup>
10
+ <Compile Include="$(NuGetSourceLocation)\src\NuGet.Core\NuGet.Frameworks\**\*.cs" />
11
+ </ItemGroup>
12
+
13
+ <ItemGroup>
14
+ <EmbeddedResource Include="$(NuGetSourceLocation)\src\NuGet.Core\NuGet.Frameworks\**\*.resx" />
15
+ </ItemGroup>
16
+
17
+ </Project>
@@ -0,0 +1,17 @@
1
+ <Project Sdk="Microsoft.NET.Sdk">
2
+
3
+ <PropertyGroup>
4
+ <TargetFramework>$(CommonTargetFramework)</TargetFramework>
5
+ <NoWarn>$(NoWarn);CS1591;RS0041</NoWarn>
6
+ </PropertyGroup>
7
+
8
+ <ItemGroup>
9
+ <ProjectReference Include="..\NuGet.Common\NuGet.Common.csproj" />
10
+ <ProjectReference Include="..\NuGet.Versioning\NuGet.Versioning.csproj" />
11
+ </ItemGroup>
12
+
13
+ <ItemGroup>
14
+ <Compile Include="$(NuGetSourceLocation)\src\NuGet.Core\NuGet.LibraryModel\**\*.cs" />
15
+ </ItemGroup>
16
+
17
+ </Project>
@@ -0,0 +1,27 @@
1
+ <Project Sdk="Microsoft.NET.Sdk">
2
+
3
+ <PropertyGroup>
4
+ <TargetFramework>$(CommonTargetFramework)</TargetFramework>
5
+ <NoWarn>$(NoWarn);CS1591;CS1580;CS1574;CS1573;RS0041</NoWarn>
6
+ </PropertyGroup>
7
+
8
+ <ItemGroup>
9
+ <ProjectReference Include="..\NuGet.Commands\NuGet.Commands.csproj" />
10
+ <ProjectReference Include="..\NuGet.Resolver\NuGet.Resolver.csproj" />
11
+ </ItemGroup>
12
+
13
+ <ItemGroup>
14
+ <PackageReference Include="Microsoft.Web.Xdt" />
15
+ <PackageReference Include="Microsoft.CSharp" />
16
+ <PackageReference Include="System.ComponentModel.Composition" />
17
+ </ItemGroup>
18
+
19
+ <ItemGroup>
20
+ <Compile Include="$(NuGetSourceLocation)\src\NuGet.Core\NuGet.PackageManagement\**\*.cs" />
21
+ </ItemGroup>
22
+
23
+ <ItemGroup>
24
+ <EmbeddedResource Include="$(NuGetSourceLocation)\src\NuGet.Core\NuGet.PackageManagement\**\*.resx" />
25
+ </ItemGroup>
26
+
27
+ </Project>
@@ -0,0 +1,28 @@
1
+ <Project Sdk="Microsoft.NET.Sdk">
2
+
3
+ <PropertyGroup>
4
+ <TargetFramework>$(CommonTargetFramework)</TargetFramework>
5
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
6
+ <NoWarn>$(NoWarn);CS0414;CS1591;CS1574;CS1573;CS1572;RS0041</NoWarn>
7
+ </PropertyGroup>
8
+
9
+ <ItemGroup>
10
+ <ProjectReference Include="..\NuGet.Configuration\NuGet.Configuration.csproj" />
11
+ <ProjectReference Include="..\NuGet.Versioning\NuGet.Versioning.csproj" />
12
+ </ItemGroup>
13
+
14
+ <ItemGroup>
15
+ <PackageReference Include="Newtonsoft.Json" />
16
+ <PackageReference Include="System.Security.Cryptography.Pkcs" />
17
+ <PackageReference Include="System.Security.Cryptography.Cng" />
18
+ </ItemGroup>
19
+
20
+ <ItemGroup>
21
+ <Compile Include="$(NuGetSourceLocation)\src\NuGet.Core\NuGet.Packaging\**\*.cs" />
22
+ </ItemGroup>
23
+
24
+ <ItemGroup>
25
+ <EmbeddedResource Include="$(NuGetSourceLocation)\src\NuGet.Core\NuGet.Packaging\**\*.resx" />
26
+ </ItemGroup>
27
+
28
+ </Project>
@@ -0,0 +1,20 @@
1
+ <Project Sdk="Microsoft.NET.Sdk">
2
+
3
+ <PropertyGroup>
4
+ <TargetFramework>$(CommonTargetFramework)</TargetFramework>
5
+ <NoWarn>$(NoWarn);CS1591;CS1573;RS0041</NoWarn>
6
+ </PropertyGroup>
7
+
8
+ <ItemGroup>
9
+ <ProjectReference Include="..\NuGet.DependencyResolver.Core\NuGet.DependencyResolver.Core.csproj" />
10
+ </ItemGroup>
11
+
12
+ <ItemGroup>
13
+ <Compile Include="$(NuGetSourceLocation)\src\NuGet.Core\NuGet.ProjectModel\**\*.cs" />
14
+ </ItemGroup>
15
+
16
+ <ItemGroup>
17
+ <EmbeddedResource Include="$(NuGetSourceLocation)\src\NuGet.Core\NuGet.ProjectModel\**\*.resx" />
18
+ </ItemGroup>
19
+
20
+ </Project>
@@ -0,0 +1,21 @@
1
+ <Project Sdk="Microsoft.NET.Sdk">
2
+
3
+ <PropertyGroup>
4
+ <TargetFramework>$(CommonTargetFramework)</TargetFramework>
5
+ <DefineConstants>$(DefineConstants);IS_DESKTOP</DefineConstants>
6
+ <NoWarn>$(NoWarn);CS1591;CS1573;CS0012;RS0041</NoWarn>
7
+ </PropertyGroup>
8
+
9
+ <ItemGroup>
10
+ <ProjectReference Include="..\NuGet.Packaging\NuGet.Packaging.csproj" />
11
+ </ItemGroup>
12
+
13
+ <ItemGroup>
14
+ <Compile Include="$(NuGetSourceLocation)\src\NuGet.Core\NuGet.Protocol\**\*.cs" />
15
+ </ItemGroup>
16
+
17
+ <ItemGroup>
18
+ <EmbeddedResource Include="$(NuGetSourceLocation)\src\NuGet.Core\NuGet.Protocol\**\*.resx" />
19
+ </ItemGroup>
20
+
21
+ </Project>
@@ -0,0 +1,20 @@
1
+ <Project Sdk="Microsoft.NET.Sdk">
2
+
3
+ <PropertyGroup>
4
+ <TargetFramework>$(CommonTargetFramework)</TargetFramework>
5
+ <NoWarn>$(NoWarn);CS1591;CS1573;RS0041</NoWarn>
6
+ </PropertyGroup>
7
+
8
+ <ItemGroup>
9
+ <ProjectReference Include="..\NuGet.Protocol\NuGet.Protocol.csproj" />
10
+ </ItemGroup>
11
+
12
+ <ItemGroup>
13
+ <Compile Include="$(NuGetSourceLocation)\src\NuGet.Core\NuGet.Resolver\**\*.cs" />
14
+ </ItemGroup>
15
+
16
+ <ItemGroup>
17
+ <EmbeddedResource Include="$(NuGetSourceLocation)\src\NuGet.Core\NuGet.Resolver\**\*.resx" />
18
+ </ItemGroup>
19
+
20
+ </Project>
@@ -0,0 +1,17 @@
1
+ <Project Sdk="Microsoft.NET.Sdk">
2
+
3
+ <PropertyGroup>
4
+ <TargetFramework>$(CommonTargetFramework)</TargetFramework>
5
+ <NoWarn>$(NoWarn);RS0041</NoWarn>
6
+ <Nullable>enable</Nullable>
7
+ </PropertyGroup>
8
+
9
+ <ItemGroup>
10
+ <Compile Include="$(NuGetSourceLocation)\src\NuGet.Core\NuGet.Versioning\**\*.cs" />
11
+ </ItemGroup>
12
+
13
+ <ItemGroup>
14
+ <EmbeddedResource Include="$(NuGetSourceLocation)\src\NuGet.Core\NuGet.Versioning\**\*.resx" />
15
+ </ItemGroup>
16
+
17
+ </Project>
@@ -0,0 +1,35 @@
1
+ using System;
2
+ using System.CommandLine;
3
+
4
+ using NuGetUpdater.Core;
5
+ using NuGetUpdater.Core.FrameworkChecker;
6
+
7
+ namespace NuGetUpdater.Cli.Commands;
8
+
9
+ internal static class FrameworkCheckCommand
10
+ {
11
+ internal static readonly Option<string[]> ProjectTfmsOption = new("--project-tfms") { IsRequired = true, AllowMultipleArgumentsPerToken = true };
12
+ internal static readonly Option<string[]> PackageTfmsOption = new("--package-tfms") { IsRequired = true, AllowMultipleArgumentsPerToken = true };
13
+ internal static readonly Option<bool> VerboseOption = new("--verbose", getDefaultValue: () => false);
14
+
15
+ internal static Command GetCommand(Action<int> setExitCode)
16
+ {
17
+ Command command = new("framework-check", "Checks that a project's target frameworks are satisfied by the target frameworks supported by a package.")
18
+ {
19
+ ProjectTfmsOption,
20
+ PackageTfmsOption,
21
+ VerboseOption
22
+ };
23
+
24
+ command.TreatUnmatchedTokensAsErrors = true;
25
+
26
+ command.SetHandler((projectTfms, packageTfms, verbose) =>
27
+ {
28
+ setExitCode(CompatibilityChecker.IsCompatible(projectTfms, packageTfms, new Logger(verbose))
29
+ ? 0
30
+ : 1);
31
+ }, ProjectTfmsOption, PackageTfmsOption, VerboseOption);
32
+
33
+ return command;
34
+ }
35
+ }
@@ -0,0 +1,43 @@
1
+ using System;
2
+ using System.CommandLine;
3
+ using System.IO;
4
+
5
+ using NuGetUpdater.Core;
6
+
7
+ namespace NuGetUpdater.Cli.Commands;
8
+
9
+ internal static class UpdateCommand
10
+ {
11
+ internal static readonly Option<DirectoryInfo> RepoRootOption = new("--repo-root", () => new DirectoryInfo(Environment.CurrentDirectory)) { IsRequired = false };
12
+ internal static readonly Option<FileInfo> SolutionOrProjectFileOption = new("--solution-or-project") { IsRequired = true };
13
+ internal static readonly Option<string> DependencyNameOption = new("--dependency") { IsRequired = true };
14
+ internal static readonly Option<string> NewVersionOption = new("--new-version") { IsRequired = true };
15
+ internal static readonly Option<string> PreviousVersionOption = new("--previous-version") { IsRequired = true };
16
+ internal static readonly Option<bool> IsTransitiveOption = new("--transitive", getDefaultValue: () => false);
17
+ internal static readonly Option<bool> VerboseOption = new("--verbose", getDefaultValue: () => false);
18
+
19
+ internal static Command GetCommand(Action<int> setExitCode)
20
+ {
21
+ Command command = new("update", "Applies the changes from an analysis report to update a dependency.")
22
+ {
23
+ RepoRootOption,
24
+ SolutionOrProjectFileOption,
25
+ DependencyNameOption,
26
+ NewVersionOption,
27
+ PreviousVersionOption,
28
+ IsTransitiveOption,
29
+ VerboseOption
30
+ };
31
+
32
+ command.TreatUnmatchedTokensAsErrors = true;
33
+
34
+ command.SetHandler(async (repoRoot, solutionOrProjectFile, dependencyName, newVersion, previousVersion, isTransitive, verbose) =>
35
+ {
36
+ var worker = new UpdaterWorker(new Logger(verbose));
37
+ await worker.RunAsync(repoRoot.FullName, solutionOrProjectFile.FullName, dependencyName, previousVersion, newVersion, isTransitive);
38
+ setExitCode(0);
39
+ }, RepoRootOption, SolutionOrProjectFileOption, DependencyNameOption, NewVersionOption, PreviousVersionOption, IsTransitiveOption, VerboseOption);
40
+
41
+ return command;
42
+ }
43
+ }
@@ -0,0 +1,20 @@
1
+ <Project Sdk="Microsoft.NET.Sdk">
2
+
3
+ <PropertyGroup>
4
+ <TargetFramework>$(CommonTargetFramework)</TargetFramework>
5
+ <OutputType>Exe</OutputType>
6
+ </PropertyGroup>
7
+
8
+ <ItemGroup>
9
+ <ProjectReference Include="..\NuGetUpdater.Core\NuGetUpdater.Core.csproj" />
10
+ </ItemGroup>
11
+
12
+ <ItemGroup>
13
+ <PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
14
+ </ItemGroup>
15
+
16
+ <ItemGroup>
17
+ <InternalsVisibleTo Include="NuGetUpdater.Cli.Test"/>
18
+ </ItemGroup>
19
+
20
+ </Project>