dependabot-nuget 0.302.0 → 0.303.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/helpers/lib/NuGetUpdater/Directory.Packages.props +5 -5
  3. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/DependencyDiscoveryTargetingPacks.props +10 -0
  4. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs +96 -97
  5. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/SdkProjectDiscovery.cs +2 -0
  6. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/ExperimentsManager.cs +3 -0
  7. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/NuGetUpdater.Core.csproj +1 -0
  8. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs +8 -0
  9. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectManager.cs +7 -4
  10. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/LockFileUpdater.cs +2 -0
  11. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackageReferenceUpdater.cs +257 -37
  12. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackagesConfigUpdater.cs +12 -3
  13. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdateOperationBase.cs +209 -0
  14. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdateOperationResult.cs +3 -0
  15. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs +79 -24
  16. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +11 -11
  17. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.PackagesConfig.cs +19 -5
  18. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/RunWorkerTests.cs +24 -6
  19. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/PackageReferenceUpdaterTests.cs +177 -0
  20. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateOperationBaseTests.cs +130 -0
  21. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +5 -0
  22. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Mixed.cs +71 -5
  23. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackageReference.cs +87 -3
  24. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs +23 -0
  25. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +145 -147
  26. metadata +11 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa40dad694a6849be3c9da853f6d075f0db1f44f9cc9338e07586405e5f02bcc
4
- data.tar.gz: 0f7ddac2d69e9a1dce70c7000b3159c0daf337816c93b9498678d58fa3753afc
3
+ metadata.gz: c0d78d1b91ae626712aaadfdc2f4d03f8f15247b88b869a7285e0b4ad75a36c6
4
+ data.tar.gz: 6bb59e2674de36c8fae8ee8172db65e6c64447a9f951bd9717bc5915b1a491b3
5
5
  SHA512:
6
- metadata.gz: ee07bf8ca5e089cc11ec1e077e2982b0525ac071f77f1411c3f2fdda7ffe378e6ecfa9d00c2762dee45dc65dd5fd76bcea3f1e2688dae83a1e431470744695f3
7
- data.tar.gz: 5f0837e22360fb06fca6271bbd335e921e72be1d79d1b36802ca7aa80cecfb92c0218ae7b1a1914de7b45bde64d5c5ff34c4f1450c2405c30ac981d0dd90ea67
6
+ metadata.gz: 0d71151a04b9a0ad457713832a763169027b9e24dc95366ffad4fa0011c7820f458410b288d4b85b3382f28923369cf56a60aa0d1970e66c91096c49c857b8b9
7
+ data.tar.gz: c041d7724ecfbf3dd2cd43064ff566eae5526ee5fe73f5b51df153b093f75b5fbc3a0600bbbe4b250bb1919de3e779f233f9a6100d20bfcc1f0b67cbbb82a503
@@ -19,7 +19,7 @@
19
19
  <PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.12.0" />
20
20
  <PackageVersion Include="Microsoft.CSharp" Version="4.7.0" />
21
21
  <PackageVersion Include="Microsoft.Extensions.FileProviders.Abstractions" Version="9.0.0" />
22
- <PackageVersion Include="Microsoft.Extensions.FileSystemGlobbing" Version="9.0.0" />
22
+ <PackageVersion Include="Microsoft.Extensions.FileSystemGlobbing" Version="9.0.3" />
23
23
  <PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
24
24
  <PackageVersion Include="Microsoft.VisualStudio.Setup.Configuration.Interop" Version="3.12.2149" />
25
25
  <PackageVersion Include="Microsoft.Web.Xdt" Version="3.1.0" />
@@ -28,16 +28,16 @@
28
28
  <PackageVersion Include="NuGet.Core" Version="2.14.0" Aliases="CoreV2" />
29
29
  <PackageVersion Include="Semver" Version="3.0.0" />
30
30
  <PackageVersion Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
31
- <PackageVersion Include="System.ComponentModel.Composition" Version="9.0.0" />
31
+ <PackageVersion Include="System.ComponentModel.Composition" Version="9.0.3" />
32
32
  <PackageVersion Include="System.Net.Http" Version="4.3.4" />
33
33
  <PackageVersion Include="System.Formats.Asn1" Version="8.0.1" />
34
34
  <PackageVersion Include="System.Security.Cryptography.Pkcs" Version="9.0.0" />
35
35
  <PackageVersion Include="System.Security.Cryptography.ProtectedData" Version="9.0.0" />
36
- <PackageVersion Include="System.Text.Json" Version="8.0.4" />
36
+ <PackageVersion Include="System.Text.Json" Version="9.0.3" />
37
37
  <PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
38
- <PackageVersion Include="System.Threading.Tasks.Dataflow" Version="9.0.0" />
38
+ <PackageVersion Include="System.Threading.Tasks.Dataflow" Version="9.0.3" />
39
39
  <PackageVersion Include="xunit" Version="2.9.3" />
40
- <PackageVersion Include="xunit.runner.visualstudio" Version="3.0.0" />
40
+ <PackageVersion Include="xunit.runner.visualstudio" Version="3.0.2" />
41
41
  </ItemGroup>
42
42
 
43
43
  </Project>
@@ -0,0 +1,10 @@
1
+ <Project>
2
+ <PropertyGroup>
3
+ <!--
4
+ Suppress errors like:
5
+ error MSB3644: The reference assemblies for .NETFramework,Version=v4.7.2 were not found.
6
+ because that's irrelevant to dependency discovery.
7
+ -->
8
+ <NoWarn>$(NoWarn);MSB3644</NoWarn>
9
+ </PropertyGroup>
10
+ </Project>
@@ -304,129 +304,128 @@ public partial class DiscoveryWorker : IDiscoveryWorker
304
304
 
305
305
  private async Task<ImmutableArray<ProjectDiscoveryResult>> RunForProjectPathsAsync(string repoRootPath, string workspacePath, IEnumerable<string> projectPaths)
306
306
  {
307
+ var normalizedProjectPaths = projectPaths.SelectMany(p => PathHelper.ResolveCaseInsensitivePathsInsideRepoRoot(p, repoRootPath) ?? []).Distinct().ToImmutableArray();
308
+ var disposables = normalizedProjectPaths.Select(p => new SpecialImportsConditionPatcher(p)).ToImmutableArray();
307
309
  var results = new Dictionary<string, ProjectDiscoveryResult>(StringComparer.Ordinal);
308
- foreach (var projectPath in projectPaths)
309
- {
310
- // If there is some MSBuild logic that needs to run to fully resolve the path skip the project
311
- // Ensure file existence is checked case-insensitively
312
- var actualProjectPaths = PathHelper.ResolveCaseInsensitivePathsInsideRepoRoot(projectPath, repoRootPath);
313
-
314
- if (actualProjectPaths == null)
315
- {
316
- continue;
317
- }
318
310
 
319
- foreach (var actualProjectPath in actualProjectPaths)
311
+ try
312
+ {
313
+ foreach (var projectPath in normalizedProjectPaths)
320
314
  {
321
- if (_processedProjectPaths.Contains(actualProjectPath))
315
+ if (_processedProjectPaths.Contains(projectPath))
322
316
  {
323
317
  continue;
324
318
  }
325
319
 
326
- _processedProjectPaths.Add(actualProjectPath);
320
+ _processedProjectPaths.Add(projectPath);
327
321
 
328
- using (new SpecialImportsConditionPatcher(actualProjectPath))
322
+ var relativeProjectPath = Path.GetRelativePath(workspacePath, projectPath).NormalizePathToUnix();
323
+ var packagesConfigResult = await PackagesConfigDiscovery.Discover(repoRootPath, workspacePath, projectPath, _experimentsManager, _logger);
324
+ var projectResults = await SdkProjectDiscovery.DiscoverAsync(repoRootPath, workspacePath, projectPath, _experimentsManager, _logger);
325
+
326
+ // Determine if there were unrestored MSBuildSdks
327
+ var msbuildSdks = projectResults.SelectMany(p => p.Dependencies.Where(d => d.Type == DependencyType.MSBuildSdk)).ToImmutableArray();
328
+ if (msbuildSdks.Length > 0)
329
329
  {
330
- var relativeProjectPath = Path.GetRelativePath(workspacePath, actualProjectPath).NormalizePathToUnix();
331
- var packagesConfigResult = await PackagesConfigDiscovery.Discover(repoRootPath, workspacePath, actualProjectPath, _experimentsManager, _logger);
332
- var projectResults = await SdkProjectDiscovery.DiscoverAsync(repoRootPath, workspacePath, actualProjectPath, _experimentsManager, _logger);
330
+ // If new SDKs were restored, then we need to rerun SdkProjectDiscovery.
331
+ if (await TryRestoreMSBuildSdksAsync(repoRootPath, workspacePath, msbuildSdks, _logger))
332
+ {
333
+ projectResults = await SdkProjectDiscovery.DiscoverAsync(repoRootPath, workspacePath, projectPath, _experimentsManager, _logger);
334
+ }
335
+ }
333
336
 
334
- // Determine if there were unrestored MSBuildSdks
335
- var msbuildSdks = projectResults.SelectMany(p => p.Dependencies.Where(d => d.Type == DependencyType.MSBuildSdk)).ToImmutableArray();
336
- if (msbuildSdks.Length > 0)
337
+ foreach (var projectResult in projectResults)
338
+ {
339
+ if (results.ContainsKey(projectResult.FilePath))
337
340
  {
338
- // If new SDKs were restored, then we need to rerun SdkProjectDiscovery.
339
- if (await TryRestoreMSBuildSdksAsync(repoRootPath, workspacePath, msbuildSdks, _logger))
340
- {
341
- projectResults = await SdkProjectDiscovery.DiscoverAsync(repoRootPath, workspacePath, actualProjectPath, _experimentsManager, _logger);
342
- }
341
+ continue;
343
342
  }
344
343
 
345
- foreach (var projectResult in projectResults)
344
+ // If we had packages.config dependencies, merge them with the project dependencies
345
+ if (projectResult.FilePath == relativeProjectPath && packagesConfigResult is not null)
346
346
  {
347
- if (results.ContainsKey(projectResult.FilePath))
348
- {
349
- continue;
350
- }
347
+ var packagesConfigDependencies = packagesConfigResult.Dependencies
348
+ .Select(d => d with { TargetFrameworks = projectResult.TargetFrameworks })
349
+ .ToImmutableArray();
351
350
 
352
- // If we had packages.config dependencies, merge them with the project dependencies
353
- if (projectResult.FilePath == relativeProjectPath && packagesConfigResult is not null)
351
+ results[projectResult.FilePath] = projectResult with
354
352
  {
355
- var packagesConfigDependencies = packagesConfigResult.Dependencies
356
- .Select(d => d with { TargetFrameworks = projectResult.TargetFrameworks })
357
- .ToImmutableArray();
353
+ Dependencies = [.. projectResult.Dependencies, .. packagesConfigDependencies],
354
+ };
355
+ }
356
+ else
357
+ {
358
+ results[projectResult.FilePath] = projectResult;
359
+ }
360
+ }
358
361
 
359
- results[projectResult.FilePath] = projectResult with
362
+ if (packagesConfigResult is not null)
363
+ {
364
+ // we might have to merge this dependency with some others
365
+ if (results.TryGetValue(relativeProjectPath, out var existingProjectDiscovery))
366
+ {
367
+ // merge SDK and packages.config results
368
+ var mergedDependencies = existingProjectDiscovery.Dependencies.Concat(packagesConfigResult.Dependencies)
369
+ .DistinctBy(d => d.Name, StringComparer.OrdinalIgnoreCase)
370
+ .OrderBy(d => d.Name)
371
+ .ToImmutableArray();
372
+ var mergedTargetFrameworks = existingProjectDiscovery.TargetFrameworks.Concat(packagesConfigResult.TargetFrameworks)
373
+ .Select(t =>
360
374
  {
361
- Dependencies = [.. projectResult.Dependencies, .. packagesConfigDependencies],
362
- };
363
- }
364
- else
375
+ try
376
+ {
377
+ var tfm = NuGetFramework.Parse(t);
378
+ return tfm.GetShortFolderName();
379
+ }
380
+ catch
381
+ {
382
+ return string.Empty;
383
+ }
384
+ })
385
+ .Where(tfm => !string.IsNullOrEmpty(tfm))
386
+ .Distinct()
387
+ .OrderBy(tfm => tfm)
388
+ .ToImmutableArray();
389
+ var mergedProperties = existingProjectDiscovery.Properties; // packages.config discovery doesn't produce properties
390
+ var mergedImportedFiles = existingProjectDiscovery.ImportedFiles; // packages.config discovery doesn't produce imported files
391
+ var mergedAdditionalFiles = existingProjectDiscovery.AdditionalFiles.Concat(packagesConfigResult.AdditionalFiles)
392
+ .Distinct(StringComparer.OrdinalIgnoreCase)
393
+ .OrderBy(f => f)
394
+ .ToImmutableArray();
395
+ var mergedResult = new ProjectDiscoveryResult()
365
396
  {
366
- results[projectResult.FilePath] = projectResult;
367
- }
397
+ FilePath = existingProjectDiscovery.FilePath,
398
+ Dependencies = mergedDependencies,
399
+ TargetFrameworks = mergedTargetFrameworks,
400
+ Properties = mergedProperties,
401
+ ImportedFiles = mergedImportedFiles,
402
+ AdditionalFiles = mergedAdditionalFiles,
403
+ };
404
+ results[relativeProjectPath] = mergedResult;
368
405
  }
369
-
370
- if (packagesConfigResult is not null)
406
+ else
371
407
  {
372
- // we might have to merge this dependency with some others
373
- if (results.TryGetValue(relativeProjectPath, out var existingProjectDiscovery))
408
+ // add packages.config results
409
+ results[relativeProjectPath] = new ProjectDiscoveryResult()
374
410
  {
375
- // merge SDK and packages.config results
376
- var mergedDependencies = existingProjectDiscovery.Dependencies.Concat(packagesConfigResult.Dependencies)
377
- .DistinctBy(d => d.Name, StringComparer.OrdinalIgnoreCase)
378
- .OrderBy(d => d.Name)
379
- .ToImmutableArray();
380
- var mergedTargetFrameworks = existingProjectDiscovery.TargetFrameworks.Concat(packagesConfigResult.TargetFrameworks)
381
- .Select(t =>
382
- {
383
- try
384
- {
385
- var tfm = NuGetFramework.Parse(t);
386
- return tfm.GetShortFolderName();
387
- }
388
- catch
389
- {
390
- return string.Empty;
391
- }
392
- })
393
- .Where(tfm => !string.IsNullOrEmpty(tfm))
394
- .Distinct()
395
- .OrderBy(tfm => tfm)
396
- .ToImmutableArray();
397
- var mergedProperties = existingProjectDiscovery.Properties; // packages.config discovery doesn't produce properties
398
- var mergedImportedFiles = existingProjectDiscovery.ImportedFiles; // packages.config discovery doesn't produce imported files
399
- var mergedAdditionalFiles = existingProjectDiscovery.AdditionalFiles.Concat(packagesConfigResult.AdditionalFiles)
400
- .Distinct(StringComparer.OrdinalIgnoreCase)
401
- .OrderBy(f => f)
402
- .ToImmutableArray();
403
- var mergedResult = new ProjectDiscoveryResult()
404
- {
405
- FilePath = existingProjectDiscovery.FilePath,
406
- Dependencies = mergedDependencies,
407
- TargetFrameworks = mergedTargetFrameworks,
408
- Properties = mergedProperties,
409
- ImportedFiles = mergedImportedFiles,
410
- AdditionalFiles = mergedAdditionalFiles,
411
- };
412
- results[relativeProjectPath] = mergedResult;
413
- }
414
- else
415
- {
416
- // add packages.config results
417
- results[relativeProjectPath] = new ProjectDiscoveryResult()
418
- {
419
- FilePath = relativeProjectPath,
420
- Dependencies = packagesConfigResult.Dependencies,
421
- TargetFrameworks = packagesConfigResult.TargetFrameworks,
422
- ImportedFiles = [], // no imported files resolved for packages.config scenarios
423
- AdditionalFiles = packagesConfigResult.AdditionalFiles,
424
- };
425
- }
411
+ FilePath = relativeProjectPath,
412
+ Dependencies = packagesConfigResult.Dependencies,
413
+ TargetFrameworks = packagesConfigResult.TargetFrameworks,
414
+ ImportedFiles = [], // no imported files resolved for packages.config scenarios
415
+ AdditionalFiles = packagesConfigResult.AdditionalFiles,
416
+ };
426
417
  }
427
418
  }
428
419
  }
429
420
  }
421
+ finally
422
+ {
423
+ foreach (var disposable in disposables)
424
+ {
425
+ // restore the original project file
426
+ disposable.Dispose();
427
+ }
428
+ }
430
429
 
431
430
  return [.. results.Values];
432
431
  }
@@ -108,6 +108,7 @@ internal static class SdkProjectDiscovery
108
108
  var (exitCode, stdOut, stdErr) = await MSBuildHelper.HandleGlobalJsonAsync(startingProjectDirectory, repoRootPath, experimentsManager, async () =>
109
109
  {
110
110
  // the built-in target `GenerateBuildDependencyFile` forces resolution of all NuGet packages, but doesn't invoke a full build
111
+ var dependencyDiscoveryTargetingPacksPropsPath = MSBuildHelper.GetFileFromRuntimeDirectory("DependencyDiscoveryTargetingPacks.props");
111
112
  var dependencyDiscoveryTargetsPath = MSBuildHelper.GetFileFromRuntimeDirectory("DependencyDiscovery.targets");
112
113
  var args = new List<string>()
113
114
  {
@@ -115,6 +116,7 @@ internal static class SdkProjectDiscovery
115
116
  startingProjectPath,
116
117
  "/t:_DiscoverDependencies",
117
118
  $"/p:TargetFramework={tfm}",
119
+ $"/p:CustomBeforeMicrosoftCommonProps={dependencyDiscoveryTargetingPacksPropsPath}",
118
120
  $"/p:CustomAfterMicrosoftCommonCrossTargetingTargets={dependencyDiscoveryTargetsPath}",
119
121
  $"/p:CustomAfterMicrosoftCommonTargets={dependencyDiscoveryTargetsPath}",
120
122
  "/p:TreatWarningsAsErrors=false", // if using CPM and a project also sets TreatWarningsAsErrors to true, this can cause discovery to fail; explicitly don't allow that
@@ -8,6 +8,7 @@ namespace NuGetUpdater.Core;
8
8
  public record ExperimentsManager
9
9
  {
10
10
  public bool InstallDotnetSdks { get; init; } = false;
11
+ public bool NativeUpdater { get; init; } = false;
11
12
  public bool UseLegacyDependencySolver { get; init; } = false;
12
13
  public bool UseDirectDiscovery { get; init; } = false;
13
14
 
@@ -16,6 +17,7 @@ public record ExperimentsManager
16
17
  return new()
17
18
  {
18
19
  ["nuget_install_dotnet_sdks"] = InstallDotnetSdks,
20
+ ["nuget_native_updater"] = NativeUpdater,
19
21
  ["nuget_legacy_dependency_solver"] = UseLegacyDependencySolver,
20
22
  ["nuget_use_direct_discovery"] = UseDirectDiscovery,
21
23
  };
@@ -26,6 +28,7 @@ public record ExperimentsManager
26
28
  return new ExperimentsManager()
27
29
  {
28
30
  InstallDotnetSdks = IsEnabled(experiments, "nuget_install_dotnet_sdks"),
31
+ NativeUpdater = IsEnabled(experiments, "nuget_native_updater"),
29
32
  UseLegacyDependencySolver = IsEnabled(experiments, "nuget_legacy_dependency_solver"),
30
33
  UseDirectDiscovery = IsEnabled(experiments, "nuget_use_direct_discovery"),
31
34
  };
@@ -9,6 +9,7 @@
9
9
 
10
10
  <ItemGroup>
11
11
  <None Include="DependencyDiscovery.props" CopyToOutputDirectory="PreserveNewest" />
12
+ <None Include="DependencyDiscoveryTargetingPacks.props" CopyToOutputDirectory="PreserveNewest" />
12
13
  <None Include="DependencyDiscovery.targets" CopyToOutputDirectory="PreserveNewest" />
13
14
  <None Include="TargetFrameworkReporter.targets" CopyToOutputDirectory="PreserveNewest" />
14
15
  </ItemGroup>
@@ -10,6 +10,7 @@ using NuGet.Versioning;
10
10
  using NuGetUpdater.Core.Analyze;
11
11
  using NuGetUpdater.Core.Discover;
12
12
  using NuGetUpdater.Core.Run.ApiModel;
13
+ using NuGetUpdater.Core.Updater;
13
14
  using NuGetUpdater.Core.Utilities;
14
15
 
15
16
  using static NuGetUpdater.Core.Utilities.EOLHandling;
@@ -158,6 +159,7 @@ public class RunWorker
158
159
  }
159
160
 
160
161
  // do update
162
+ var updateOperationsPerformed = new List<UpdateOperationBase>();
161
163
  var existingPullRequests = job.GetAllExistingPullRequests();
162
164
  var unhandledPullRequestDependenciesSet = existingPullRequests
163
165
  .Select(pr => pr.Item2.Select(d => d.DependencyName).ToHashSet(StringComparer.OrdinalIgnoreCase))
@@ -240,6 +242,8 @@ public class RunWorker
240
242
  {
241
243
  actualUpdatedDependencies.Add(updatedDependency);
242
244
  }
245
+
246
+ updateOperationsPerformed.AddRange(updateResult.UpdateOperations);
243
247
  }
244
248
  }
245
249
 
@@ -317,6 +321,10 @@ public class RunWorker
317
321
  await SendApiMessage(new SecurityUpdateNotNeeded(depName));
318
322
  }
319
323
 
324
+ var normalizedUpdateOperationsPerformed = UpdateOperationBase.NormalizeUpdateOperationCollection(repoContentsPath.FullName, updateOperationsPerformed);
325
+ var report = UpdateOperationBase.GenerateUpdateOperationReport(normalizedUpdateOperationsPerformed);
326
+ _logger.Info(report);
327
+
320
328
  var result = new RunResult()
321
329
  {
322
330
  Base64DependencyFiles = originalDependencyFileContents.OrderBy(kvp => kvp.Key).Select(kvp =>
@@ -1,5 +1,6 @@
1
1
  extern alias CoreV2;
2
2
 
3
+ using System.Collections.Immutable;
3
4
  using System.Xml.Linq;
4
5
 
5
6
  using CoreV2::NuGet.Runtime;
@@ -8,6 +9,7 @@ using Microsoft.Language.Xml;
8
9
 
9
10
  using NuGet.ProjectManagement;
10
11
 
12
+ using NuGetUpdater.Core.Updater;
11
13
  using NuGetUpdater.Core.Utilities;
12
14
 
13
15
  using Runtime_AssemblyBinding = CoreV2::NuGet.Runtime.AssemblyBinding;
@@ -32,13 +34,14 @@ internal static class BindingRedirectManager
32
34
  /// <param name="projectBuildFile">The project build file (*.xproj) to be updated</param>
33
35
  /// <param name="updatedPackageName"/>The name of the package that was updated</param>
34
36
  /// <param name="updatedPackageVersion">The version of the package that was updated</param>
35
- public static async ValueTask UpdateBindingRedirectsAsync(ProjectBuildFile projectBuildFile, string updatedPackageName, string updatedPackageVersion)
37
+ /// <returns>The updated files.</returns>
38
+ public static async ValueTask<ImmutableArray<string>> UpdateBindingRedirectsAsync(ProjectBuildFile projectBuildFile, string updatedPackageName, string updatedPackageVersion)
36
39
  {
37
40
  var configFile = await TryGetRuntimeConfigurationFile(projectBuildFile.Path);
38
41
  if (configFile is null)
39
42
  {
40
43
  // no runtime config file so no need to add binding redirects
41
- return;
44
+ return [];
42
45
  }
43
46
 
44
47
  var references = ExtractReferenceElements(projectBuildFile);
@@ -48,7 +51,7 @@ internal static class BindingRedirectManager
48
51
  if (!bindings.Any())
49
52
  {
50
53
  // no bindings found in the project file, nothing to update
51
- return;
54
+ return [];
52
55
  }
53
56
 
54
57
  // we need to detect what assembly references come from the newly updated package; the `HintPath` will look like
@@ -75,7 +78,7 @@ internal static class BindingRedirectManager
75
78
  AddConfigFileToProject(projectBuildFile, configFile);
76
79
  }
77
80
 
78
- return;
81
+ return [configFile.Path];
79
82
 
80
83
  static List<(string Include, string HintPath)> ExtractReferenceElements(ProjectBuildFile projectBuildFile)
81
84
  {
@@ -1,3 +1,5 @@
1
+ using NuGetUpdater.Core.Updater;
2
+
1
3
  namespace NuGetUpdater.Core;
2
4
 
3
5
  internal static class LockFileUpdater