dependabot-nuget 0.289.0 → 0.290.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/helpers/lib/NuGetUpdater/Directory.Packages.props +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/AnalyzeCommand.cs +7 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/RunCommand.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Analyze.cs +26 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Discover.cs +2 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Run.cs +0 -6
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/AnalyzeWorker.cs +3 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/CompatabilityChecker.cs +24 -9
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/NuGetContext.cs +0 -13
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/RequirementConverter.cs +17 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/Advisory.cs +13 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/AllowedUpdate.cs +18 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/CommitOptions.cs +8 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/Condition.cs +19 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/DependencyGroup.cs +8 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/GroupPullRequest.cs +9 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/Job.cs +13 -10
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/PullRequest.cs +11 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/RequirementsUpdateStrategy.cs +15 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs +24 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/VersionConverter.cs +19 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectManager.cs +2 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackagesConfigUpdater.cs +13 -12
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/JsonHelper.cs +2 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ProjectHelper.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTestBase.cs +5 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.DotNetToolsJson.cs +45 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.GlobalJson.cs +35 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Project.cs +0 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/MiscellaneousTests.cs +85 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/RunWorkerTests.cs +7 -31
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/SerializationTests.cs +340 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TemporaryDirectory.cs +18 -7
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/PackagesConfigUpdaterTests.cs +24 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +0 -12
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DotNetTools.cs +84 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.GlobalJson.cs +66 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackageReference.cs +55 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs +0 -6
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +557 -713
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/PathHelperTests.cs +2 -2
- data/lib/dependabot/nuget/analysis/analysis_json_reader.rb +1 -1
- data/lib/dependabot/nuget/analysis/dependency_analysis.rb +3 -3
- data/lib/dependabot/nuget/discovery/dependency_details.rb +10 -3
- data/lib/dependabot/nuget/discovery/dependency_file_discovery.rb +8 -12
- data/lib/dependabot/nuget/discovery/discovery_json_reader.rb +214 -29
- data/lib/dependabot/nuget/discovery/project_discovery.rb +41 -8
- data/lib/dependabot/nuget/discovery/workspace_discovery.rb +14 -19
- data/lib/dependabot/nuget/file_fetcher.rb +2 -3
- data/lib/dependabot/nuget/file_parser.rb +2 -3
- data/lib/dependabot/nuget/file_updater.rb +13 -13
- data/lib/dependabot/nuget/native_helpers.rb +14 -5
- data/lib/dependabot/nuget/update_checker/requirements_updater.rb +23 -27
- data/lib/dependabot/nuget/update_checker.rb +116 -190
- metadata +18 -29
- data/lib/dependabot/nuget/discovery/directory_packages_props_discovery.rb +0 -43
- data/lib/dependabot/nuget/http_response_helpers.rb +0 -19
- data/lib/dependabot/nuget/native_discovery/native_dependency_details.rb +0 -102
- data/lib/dependabot/nuget/native_discovery/native_dependency_file_discovery.rb +0 -122
- data/lib/dependabot/nuget/native_discovery/native_discovery_json_reader.rb +0 -277
- data/lib/dependabot/nuget/native_discovery/native_evaluation_details.rb +0 -63
- data/lib/dependabot/nuget/native_discovery/native_project_discovery.rb +0 -104
- data/lib/dependabot/nuget/native_discovery/native_property_details.rb +0 -43
- data/lib/dependabot/nuget/native_discovery/native_workspace_discovery.rb +0 -61
- data/lib/dependabot/nuget/native_update_checker/native_requirements_updater.rb +0 -105
- data/lib/dependabot/nuget/native_update_checker/native_update_checker.rb +0 -214
- data/lib/dependabot/nuget/nuget_client.rb +0 -223
- data/lib/dependabot/nuget/update_checker/compatibility_checker.rb +0 -116
- data/lib/dependabot/nuget/update_checker/dependency_finder.rb +0 -297
- data/lib/dependabot/nuget/update_checker/nupkg_fetcher.rb +0 -221
- data/lib/dependabot/nuget/update_checker/nuspec_fetcher.rb +0 -110
- data/lib/dependabot/nuget/update_checker/property_updater.rb +0 -196
- data/lib/dependabot/nuget/update_checker/repository_finder.rb +0 -466
- data/lib/dependabot/nuget/update_checker/tfm_comparer.rb +0 -34
- data/lib/dependabot/nuget/update_checker/tfm_finder.rb +0 -30
- data/lib/dependabot/nuget/update_checker/version_finder.rb +0 -449
@@ -342,106 +342,70 @@ public class MSBuildHelperTests : TestBase
|
|
342
342
|
[Fact]
|
343
343
|
public async Task GetAllPackageDependencies_NugetConfigInvalid_DoesNotThrow()
|
344
344
|
{
|
345
|
-
var
|
346
|
-
var nugetHttpCacheDirectory = Environment.GetEnvironmentVariable("NUGET_HTTP_CACHE_PATH");
|
347
|
-
|
348
|
-
try
|
349
|
-
{
|
350
|
-
using var temp = new TemporaryDirectory();
|
351
|
-
|
352
|
-
// It is important to have empty NuGet caches for this test, so override them with temp directories.
|
353
|
-
var tempNuGetPackagesDirectory = Path.Combine(temp.DirectoryPath, ".nuget", "packages");
|
354
|
-
Environment.SetEnvironmentVariable("NUGET_PACKAGES", tempNuGetPackagesDirectory);
|
355
|
-
var tempNuGetHttpCacheDirectory = Path.Combine(temp.DirectoryPath, ".nuget", "v3-cache");
|
356
|
-
Environment.SetEnvironmentVariable("NUGET_HTTP_CACHE_PATH", tempNuGetHttpCacheDirectory);
|
357
|
-
|
358
|
-
// Write the NuGet.config with a missing "/>"
|
359
|
-
await File.WriteAllTextAsync(
|
360
|
-
Path.Combine(temp.DirectoryPath, "NuGet.Config"), """
|
361
|
-
<?xml version="1.0" encoding="utf-8"?>
|
362
|
-
<configuration>
|
363
|
-
<packageSources>
|
364
|
-
<clear />
|
365
|
-
<add key="contoso" value="https://contoso.com/v3/index.json"
|
366
|
-
</packageSources>
|
367
|
-
</configuration>
|
368
|
-
""");
|
345
|
+
using var temp = new TemporaryDirectory();
|
369
346
|
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
347
|
+
// Write the NuGet.config with a missing "/>"
|
348
|
+
await File.WriteAllTextAsync(
|
349
|
+
Path.Combine(temp.DirectoryPath, "NuGet.Config"), """
|
350
|
+
<?xml version="1.0" encoding="utf-8"?>
|
351
|
+
<configuration>
|
352
|
+
<packageSources>
|
353
|
+
<clear />
|
354
|
+
<add key="contoso" value="https://contoso.com/v3/index.json"
|
355
|
+
</packageSources>
|
356
|
+
</configuration>
|
357
|
+
""");
|
358
|
+
|
359
|
+
// Asserting it didn't throw
|
360
|
+
var actualDependencies = await MSBuildHelper.GetAllPackageDependenciesAsync(
|
361
|
+
temp.DirectoryPath,
|
362
|
+
temp.DirectoryPath,
|
363
|
+
"net8.0",
|
364
|
+
[new Dependency("Some.Package", "4.5.11", DependencyType.Unknown)],
|
365
|
+
new TestLogger()
|
366
|
+
);
|
385
367
|
}
|
386
368
|
|
387
369
|
[Fact]
|
388
370
|
public async Task LocalPackageSourcesAreHonored()
|
389
371
|
{
|
390
|
-
var
|
391
|
-
var nugetHttpCacheDirectory = Environment.GetEnvironmentVariable("NUGET_HTTP_CACHE_PATH");
|
372
|
+
using var temp = new TemporaryDirectory();
|
392
373
|
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
MockNuGetPackage.CreateSimplePackage("Package.A", "1.0.0", "net8.0", [(null, [("Package.B", "2.0.0")])]).WriteToDirectory(localSource1);
|
413
|
-
MockNuGetPackage.CreateSimplePackage("Package.B", "2.0.0", "net8.0").WriteToDirectory(localSource2);
|
414
|
-
await File.WriteAllTextAsync(Path.Join(temp.DirectoryPath, "NuGet.Config"), """
|
415
|
-
<configuration>
|
416
|
-
<packageSources>
|
417
|
-
<add key="localSource1" value="local\source1" />
|
418
|
-
<add key="localSource2" value="local/source2" />
|
419
|
-
</packageSources>
|
420
|
-
</configuration>
|
421
|
-
""");
|
374
|
+
// create two local package sources with different packages available in each
|
375
|
+
string localSource1 = Path.Combine(temp.DirectoryPath, "local", "source1");
|
376
|
+
Directory.CreateDirectory(localSource1);
|
377
|
+
string localSource2 = Path.Combine(temp.DirectoryPath, "local", "source2");
|
378
|
+
Directory.CreateDirectory(localSource2);
|
379
|
+
|
380
|
+
// `Package.A` will only live in `local\source1` and uses Windows-style directory separators and will have
|
381
|
+
// a dependency on `Package.B` which is only available in `local/source2` and uses Unix-style directory
|
382
|
+
// separators.
|
383
|
+
MockNuGetPackage.CreateSimplePackage("Package.A", "1.0.0", "net8.0", [(null, [("Package.B", "2.0.0")])]).WriteToDirectory(localSource1);
|
384
|
+
MockNuGetPackage.CreateSimplePackage("Package.B", "2.0.0", "net8.0").WriteToDirectory(localSource2);
|
385
|
+
await File.WriteAllTextAsync(Path.Join(temp.DirectoryPath, "NuGet.Config"), """
|
386
|
+
<configuration>
|
387
|
+
<packageSources>
|
388
|
+
<add key="localSource1" value="local\source1" />
|
389
|
+
<add key="localSource2" value="local/source2" />
|
390
|
+
</packageSources>
|
391
|
+
</configuration>
|
392
|
+
""");
|
422
393
|
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
}
|
439
|
-
finally
|
440
|
-
{
|
441
|
-
// Restore the NuGet caches.
|
442
|
-
Environment.SetEnvironmentVariable("NUGET_PACKAGES", nugetPackagesDirectory);
|
443
|
-
Environment.SetEnvironmentVariable("NUGET_HTTP_CACHE_PATH", nugetHttpCacheDirectory);
|
444
|
-
}
|
394
|
+
Dependency[] expectedDependencies =
|
395
|
+
[
|
396
|
+
new("Package.A", "1.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"]),
|
397
|
+
new("Package.B", "2.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
|
398
|
+
];
|
399
|
+
|
400
|
+
Dependency[] actualDependencies = await MSBuildHelper.GetAllPackageDependenciesAsync(
|
401
|
+
temp.DirectoryPath,
|
402
|
+
temp.DirectoryPath,
|
403
|
+
"net8.0",
|
404
|
+
[new Dependency("Package.A", "1.0.0", DependencyType.Unknown)],
|
405
|
+
new TestLogger()
|
406
|
+
);
|
407
|
+
|
408
|
+
AssertEx.Equal(expectedDependencies, actualDependencies);
|
445
409
|
}
|
446
410
|
|
447
411
|
[Fact]
|
@@ -544,91 +508,75 @@ public class MSBuildHelperTests : TestBase
|
|
544
508
|
[Fact]
|
545
509
|
public async Task DependencyConflictsCanBeResolvedNewUpdatingTopLevelPackage()
|
546
510
|
{
|
547
|
-
var
|
511
|
+
using var tempDirectory = new TemporaryDirectory();
|
512
|
+
var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
|
513
|
+
await File.WriteAllTextAsync(projectPath, """
|
514
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
515
|
+
<PropertyGroup>
|
516
|
+
<TargetFramework>net8.0</TargetFramework>
|
517
|
+
</PropertyGroup>
|
518
|
+
<ItemGroup>
|
519
|
+
<PackageReference Include="CS-Script.Core" Version="1.3.1" />
|
520
|
+
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="3.4.0" />
|
521
|
+
<PackageReference Include="Microsoft.CodeAnalysis.Scripting.Common" Version="3.4.0" />
|
522
|
+
</ItemGroup>
|
523
|
+
</Project>
|
524
|
+
""");
|
548
525
|
|
549
|
-
|
526
|
+
var dependencies = new[]
|
550
527
|
{
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
<ItemGroup>
|
558
|
-
<PackageReference Include="CS-Script.Core" Version="1.3.1" />
|
559
|
-
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="3.4.0" />
|
560
|
-
<PackageReference Include="Microsoft.CodeAnalysis.Scripting.Common" Version="3.4.0" />
|
561
|
-
</ItemGroup>
|
562
|
-
</Project>
|
563
|
-
""");
|
564
|
-
|
565
|
-
var dependencies = new[]
|
566
|
-
{
|
567
|
-
// Add comment about root and dependencies
|
568
|
-
new Dependency("CS-Script.Core", "1.3.1", DependencyType.PackageReference),
|
569
|
-
new Dependency("Microsoft.CodeAnalysis.Common", "3.4.0", DependencyType.PackageReference),
|
570
|
-
new Dependency("Microsoft.CodeAnalysis.Scripting.Common", "3.4.0", DependencyType.PackageReference),
|
571
|
-
};
|
572
|
-
var update = new[]
|
573
|
-
{
|
574
|
-
new Dependency("CS-Script.Core", "2.0.0", DependencyType.PackageReference),
|
575
|
-
};
|
576
|
-
|
577
|
-
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "net8.0", dependencies, update, new TestLogger());
|
578
|
-
Assert.NotNull(resolvedDependencies);
|
579
|
-
Assert.Equal(3, resolvedDependencies.Length);
|
580
|
-
Assert.Equal("CS-Script.Core", resolvedDependencies[0].Name);
|
581
|
-
Assert.Equal("2.0.0", resolvedDependencies[0].Version);
|
582
|
-
Assert.Equal("Microsoft.CodeAnalysis.Common", resolvedDependencies[1].Name);
|
583
|
-
Assert.Equal("3.6.0", resolvedDependencies[1].Version);
|
584
|
-
Assert.Equal("Microsoft.CodeAnalysis.Scripting.Common", resolvedDependencies[2].Name);
|
585
|
-
Assert.Equal("3.6.0", resolvedDependencies[2].Version);
|
586
|
-
}
|
587
|
-
finally
|
528
|
+
// Add comment about root and dependencies
|
529
|
+
new Dependency("CS-Script.Core", "1.3.1", DependencyType.PackageReference),
|
530
|
+
new Dependency("Microsoft.CodeAnalysis.Common", "3.4.0", DependencyType.PackageReference),
|
531
|
+
new Dependency("Microsoft.CodeAnalysis.Scripting.Common", "3.4.0", DependencyType.PackageReference),
|
532
|
+
};
|
533
|
+
var update = new[]
|
588
534
|
{
|
589
|
-
|
590
|
-
}
|
535
|
+
new Dependency("CS-Script.Core", "2.0.0", DependencyType.PackageReference),
|
536
|
+
};
|
537
|
+
|
538
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(tempDirectory.DirectoryPath, projectPath, "net8.0", dependencies, update, new TestLogger());
|
539
|
+
Assert.NotNull(resolvedDependencies);
|
540
|
+
Assert.Equal(3, resolvedDependencies.Length);
|
541
|
+
Assert.Equal("CS-Script.Core", resolvedDependencies[0].Name);
|
542
|
+
Assert.Equal("2.0.0", resolvedDependencies[0].Version);
|
543
|
+
Assert.Equal("Microsoft.CodeAnalysis.Common", resolvedDependencies[1].Name);
|
544
|
+
Assert.Equal("3.6.0", resolvedDependencies[1].Version);
|
545
|
+
Assert.Equal("Microsoft.CodeAnalysis.Scripting.Common", resolvedDependencies[2].Name);
|
546
|
+
Assert.Equal("3.6.0", resolvedDependencies[2].Version);
|
591
547
|
}
|
592
548
|
|
593
549
|
// Updating a dependency (Microsoft.Bcl.AsyncInterfaces) of the root package (Azure.Core) will require the root package to also update, but since the dependency is not in the existing list, we do not include it
|
594
550
|
[Fact]
|
595
551
|
public async Task DependencyConflictsCanBeResolvedNewUpdatingNonExistingDependency()
|
596
552
|
{
|
597
|
-
var
|
553
|
+
using var tempDirectory = new TemporaryDirectory();
|
554
|
+
var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
|
555
|
+
await File.WriteAllTextAsync(projectPath, """
|
556
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
557
|
+
<PropertyGroup>
|
558
|
+
<TargetFramework>net8.0</TargetFramework>
|
559
|
+
</PropertyGroup>
|
560
|
+
<ItemGroup>
|
561
|
+
<PackageReference Include="Azure.Core" Version="1.21.0" />
|
562
|
+
</ItemGroup>
|
563
|
+
</Project>
|
564
|
+
""");
|
598
565
|
|
599
|
-
|
566
|
+
var dependencies = new[]
|
600
567
|
{
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
<PropertyGroup>
|
605
|
-
<TargetFramework>net8.0</TargetFramework>
|
606
|
-
</PropertyGroup>
|
607
|
-
<ItemGroup>
|
608
|
-
<PackageReference Include="Azure.Core" Version="1.21.0" />
|
609
|
-
</ItemGroup>
|
610
|
-
</Project>
|
611
|
-
""");
|
612
|
-
|
613
|
-
var dependencies = new[]
|
614
|
-
{
|
615
|
-
new Dependency("Azure.Core", "1.21.0", DependencyType.PackageReference)
|
616
|
-
};
|
617
|
-
var update = new[]
|
618
|
-
{
|
619
|
-
new Dependency("Microsoft.Bcl.AsyncInterfaces", "1.1.1", DependencyType.Unknown)
|
620
|
-
};
|
621
|
-
|
622
|
-
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "net8.0", dependencies, update, new TestLogger());
|
623
|
-
Assert.NotNull(resolvedDependencies);
|
624
|
-
Assert.Single(resolvedDependencies);
|
625
|
-
Assert.Equal("Azure.Core", resolvedDependencies[0].Name);
|
626
|
-
Assert.Equal("1.22.0", resolvedDependencies[0].Version);
|
627
|
-
}
|
628
|
-
finally
|
568
|
+
new Dependency("Azure.Core", "1.21.0", DependencyType.PackageReference)
|
569
|
+
};
|
570
|
+
var update = new[]
|
629
571
|
{
|
630
|
-
|
631
|
-
}
|
572
|
+
new Dependency("Microsoft.Bcl.AsyncInterfaces", "1.1.1", DependencyType.Unknown)
|
573
|
+
};
|
574
|
+
|
575
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(tempDirectory.DirectoryPath, projectPath, "net8.0", dependencies, update, new TestLogger());
|
576
|
+
Assert.NotNull(resolvedDependencies);
|
577
|
+
Assert.Single(resolvedDependencies);
|
578
|
+
Assert.Equal("Azure.Core", resolvedDependencies[0].Name);
|
579
|
+
Assert.Equal("1.22.0", resolvedDependencies[0].Version);
|
632
580
|
}
|
633
581
|
|
634
582
|
// Adding a reference
|
@@ -637,43 +585,35 @@ public class MSBuildHelperTests : TestBase
|
|
637
585
|
[Fact]
|
638
586
|
public async Task DependencyConflictsCanBeResolvedNewUpdatingNonExistentDependencyAndKeepingReference()
|
639
587
|
{
|
640
|
-
var
|
588
|
+
using var tempDirectory = new TemporaryDirectory();
|
589
|
+
var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
|
590
|
+
await File.WriteAllTextAsync(projectPath, """
|
591
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
592
|
+
<PropertyGroup>
|
593
|
+
<TargetFramework>net8.0</TargetFramework>
|
594
|
+
</PropertyGroup>
|
595
|
+
<ItemGroup>
|
596
|
+
<PackageReference Include="Newtonsoft.Json.Bson" Version="1.0.2" />
|
597
|
+
</ItemGroup>
|
598
|
+
</Project>
|
599
|
+
""");
|
641
600
|
|
642
|
-
|
601
|
+
var dependencies = new[]
|
643
602
|
{
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
<PropertyGroup>
|
648
|
-
<TargetFramework>net8.0</TargetFramework>
|
649
|
-
</PropertyGroup>
|
650
|
-
<ItemGroup>
|
651
|
-
<PackageReference Include="Newtonsoft.Json.Bson" Version="1.0.2" />
|
652
|
-
</ItemGroup>
|
653
|
-
</Project>
|
654
|
-
""");
|
655
|
-
|
656
|
-
var dependencies = new[]
|
657
|
-
{
|
658
|
-
new Dependency("Newtonsoft.Json.Bson", "1.0.2", DependencyType.PackageReference)
|
659
|
-
};
|
660
|
-
var update = new[]
|
661
|
-
{
|
662
|
-
new Dependency("Newtonsoft.Json", "13.0.1", DependencyType.Unknown)
|
663
|
-
};
|
664
|
-
|
665
|
-
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "net8.0", dependencies, update, new TestLogger());
|
666
|
-
Assert.NotNull(resolvedDependencies);
|
667
|
-
Assert.Equal(2, resolvedDependencies.Length);
|
668
|
-
Assert.Equal("Newtonsoft.Json.Bson", resolvedDependencies[0].Name);
|
669
|
-
Assert.Equal("1.0.2", resolvedDependencies[0].Version);
|
670
|
-
Assert.Equal("Newtonsoft.Json", resolvedDependencies[1].Name);
|
671
|
-
Assert.Equal("13.0.1", resolvedDependencies[1].Version);
|
672
|
-
}
|
673
|
-
finally
|
603
|
+
new Dependency("Newtonsoft.Json.Bson", "1.0.2", DependencyType.PackageReference)
|
604
|
+
};
|
605
|
+
var update = new[]
|
674
606
|
{
|
675
|
-
|
676
|
-
}
|
607
|
+
new Dependency("Newtonsoft.Json", "13.0.1", DependencyType.Unknown)
|
608
|
+
};
|
609
|
+
|
610
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(tempDirectory.DirectoryPath, projectPath, "net8.0", dependencies, update, new TestLogger());
|
611
|
+
Assert.NotNull(resolvedDependencies);
|
612
|
+
Assert.Equal(2, resolvedDependencies.Length);
|
613
|
+
Assert.Equal("Newtonsoft.Json.Bson", resolvedDependencies[0].Name);
|
614
|
+
Assert.Equal("1.0.2", resolvedDependencies[0].Version);
|
615
|
+
Assert.Equal("Newtonsoft.Json", resolvedDependencies[1].Name);
|
616
|
+
Assert.Equal("13.0.1", resolvedDependencies[1].Version);
|
677
617
|
}
|
678
618
|
|
679
619
|
// Updating unreferenced dependency
|
@@ -683,49 +623,41 @@ public class MSBuildHelperTests : TestBase
|
|
683
623
|
[Fact]
|
684
624
|
public async Task DependencyConflictsCanBeResolvedNewTransitiveDependencyNotExisting()
|
685
625
|
{
|
686
|
-
var
|
626
|
+
using var tempDirectory = new TemporaryDirectory();
|
627
|
+
var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
|
628
|
+
await File.WriteAllTextAsync(projectPath, """
|
629
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
630
|
+
<PropertyGroup>
|
631
|
+
<TargetFramework>net8.0</TargetFramework>
|
632
|
+
</PropertyGroup>
|
633
|
+
<ItemGroup>
|
634
|
+
<PackageReference Include="Microsoft.CodeAnalysis.Compilers" Version="4.9.2" />
|
635
|
+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" />
|
636
|
+
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="4.9.2" />
|
637
|
+
</ItemGroup>
|
638
|
+
</Project>
|
639
|
+
""");
|
687
640
|
|
688
|
-
|
641
|
+
var dependencies = new[]
|
689
642
|
{
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
</PropertyGroup>
|
696
|
-
<ItemGroup>
|
697
|
-
<PackageReference Include="Microsoft.CodeAnalysis.Compilers" Version="4.9.2" />
|
698
|
-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" />
|
699
|
-
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="4.9.2" />
|
700
|
-
</ItemGroup>
|
701
|
-
</Project>
|
702
|
-
""");
|
703
|
-
|
704
|
-
var dependencies = new[]
|
705
|
-
{
|
706
|
-
new Dependency("Microsoft.CodeAnalysis.Compilers", "4.9.2", DependencyType.PackageReference),
|
707
|
-
new Dependency("Microsoft.CodeAnalysis.CSharp", "4.9.2", DependencyType.PackageReference),
|
708
|
-
new Dependency("Microsoft.CodeAnalysis.VisualBasic", "4.9.2", DependencyType.PackageReference)
|
709
|
-
};
|
710
|
-
var update = new[]
|
711
|
-
{
|
712
|
-
new Dependency("Microsoft.CodeAnalysis.Common", "4.10.0", DependencyType.PackageReference)
|
713
|
-
};
|
714
|
-
|
715
|
-
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "net8.0", dependencies, update, new TestLogger());
|
716
|
-
Assert.NotNull(resolvedDependencies);
|
717
|
-
Assert.Equal(3, resolvedDependencies.Length);
|
718
|
-
Assert.Equal("Microsoft.CodeAnalysis.Compilers", resolvedDependencies[0].Name);
|
719
|
-
Assert.Equal("4.10.0", resolvedDependencies[0].Version);
|
720
|
-
Assert.Equal("Microsoft.CodeAnalysis.CSharp", resolvedDependencies[1].Name);
|
721
|
-
Assert.Equal("4.10.0", resolvedDependencies[1].Version);
|
722
|
-
Assert.Equal("Microsoft.CodeAnalysis.VisualBasic", resolvedDependencies[2].Name);
|
723
|
-
Assert.Equal("4.10.0", resolvedDependencies[2].Version);
|
724
|
-
}
|
725
|
-
finally
|
643
|
+
new Dependency("Microsoft.CodeAnalysis.Compilers", "4.9.2", DependencyType.PackageReference),
|
644
|
+
new Dependency("Microsoft.CodeAnalysis.CSharp", "4.9.2", DependencyType.PackageReference),
|
645
|
+
new Dependency("Microsoft.CodeAnalysis.VisualBasic", "4.9.2", DependencyType.PackageReference)
|
646
|
+
};
|
647
|
+
var update = new[]
|
726
648
|
{
|
727
|
-
|
728
|
-
}
|
649
|
+
new Dependency("Microsoft.CodeAnalysis.Common", "4.10.0", DependencyType.PackageReference)
|
650
|
+
};
|
651
|
+
|
652
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(tempDirectory.DirectoryPath, projectPath, "net8.0", dependencies, update, new TestLogger());
|
653
|
+
Assert.NotNull(resolvedDependencies);
|
654
|
+
Assert.Equal(3, resolvedDependencies.Length);
|
655
|
+
Assert.Equal("Microsoft.CodeAnalysis.Compilers", resolvedDependencies[0].Name);
|
656
|
+
Assert.Equal("4.10.0", resolvedDependencies[0].Version);
|
657
|
+
Assert.Equal("Microsoft.CodeAnalysis.CSharp", resolvedDependencies[1].Name);
|
658
|
+
Assert.Equal("4.10.0", resolvedDependencies[1].Version);
|
659
|
+
Assert.Equal("Microsoft.CodeAnalysis.VisualBasic", resolvedDependencies[2].Name);
|
660
|
+
Assert.Equal("4.10.0", resolvedDependencies[2].Version);
|
729
661
|
}
|
730
662
|
|
731
663
|
// Updating referenced dependency
|
@@ -733,53 +665,45 @@ public class MSBuildHelperTests : TestBase
|
|
733
665
|
[Fact]
|
734
666
|
public async Task DependencyConflictsCanBeResolvedNewSingleTransitiveDependencyExisting()
|
735
667
|
{
|
736
|
-
var
|
668
|
+
using var tempDirectory = new TemporaryDirectory();
|
669
|
+
var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
|
670
|
+
await File.WriteAllTextAsync(projectPath, """
|
671
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
672
|
+
<PropertyGroup>
|
673
|
+
<TargetFramework>net8.0</TargetFramework>
|
674
|
+
</PropertyGroup>
|
675
|
+
<ItemGroup>
|
676
|
+
<PackageReference Include="Microsoft.CodeAnalysis.Compilers" Version="4.9.2" />
|
677
|
+
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.9.2" />
|
678
|
+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" />
|
679
|
+
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="4.9.2" />
|
680
|
+
</ItemGroup>
|
681
|
+
</Project>
|
682
|
+
""");
|
737
683
|
|
738
|
-
|
684
|
+
var dependencies = new[]
|
739
685
|
{
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
<ItemGroup>
|
747
|
-
<PackageReference Include="Microsoft.CodeAnalysis.Compilers" Version="4.9.2" />
|
748
|
-
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.9.2" />
|
749
|
-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" />
|
750
|
-
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="4.9.2" />
|
751
|
-
</ItemGroup>
|
752
|
-
</Project>
|
753
|
-
""");
|
754
|
-
|
755
|
-
var dependencies = new[]
|
756
|
-
{
|
757
|
-
new Dependency("Microsoft.CodeAnalysis.Compilers", "4.9.2", DependencyType.PackageReference),
|
758
|
-
new Dependency("Microsoft.CodeAnalysis.Common", "4.9.2", DependencyType.PackageReference),
|
759
|
-
new Dependency("Microsoft.CodeAnalysis.CSharp", "4.9.2", DependencyType.PackageReference),
|
760
|
-
new Dependency("Microsoft.CodeAnalysis.VisualBasic", "4.9.2", DependencyType.PackageReference)
|
761
|
-
};
|
762
|
-
var update = new[]
|
763
|
-
{
|
764
|
-
new Dependency("Microsoft.CodeAnalysis.Common", "4.10.0", DependencyType.PackageReference)
|
765
|
-
};
|
766
|
-
|
767
|
-
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "net8.0", dependencies, update, new TestLogger());
|
768
|
-
Assert.NotNull(resolvedDependencies);
|
769
|
-
Assert.Equal(4, resolvedDependencies.Length);
|
770
|
-
Assert.Equal("Microsoft.CodeAnalysis.Compilers", resolvedDependencies[0].Name);
|
771
|
-
Assert.Equal("4.10.0", resolvedDependencies[0].Version);
|
772
|
-
Assert.Equal("Microsoft.CodeAnalysis.Common", resolvedDependencies[1].Name);
|
773
|
-
Assert.Equal("4.10.0", resolvedDependencies[1].Version);
|
774
|
-
Assert.Equal("Microsoft.CodeAnalysis.CSharp", resolvedDependencies[2].Name);
|
775
|
-
Assert.Equal("4.10.0", resolvedDependencies[2].Version);
|
776
|
-
Assert.Equal("Microsoft.CodeAnalysis.VisualBasic", resolvedDependencies[3].Name);
|
777
|
-
Assert.Equal("4.10.0", resolvedDependencies[3].Version);
|
778
|
-
}
|
779
|
-
finally
|
686
|
+
new Dependency("Microsoft.CodeAnalysis.Compilers", "4.9.2", DependencyType.PackageReference),
|
687
|
+
new Dependency("Microsoft.CodeAnalysis.Common", "4.9.2", DependencyType.PackageReference),
|
688
|
+
new Dependency("Microsoft.CodeAnalysis.CSharp", "4.9.2", DependencyType.PackageReference),
|
689
|
+
new Dependency("Microsoft.CodeAnalysis.VisualBasic", "4.9.2", DependencyType.PackageReference)
|
690
|
+
};
|
691
|
+
var update = new[]
|
780
692
|
{
|
781
|
-
|
782
|
-
}
|
693
|
+
new Dependency("Microsoft.CodeAnalysis.Common", "4.10.0", DependencyType.PackageReference)
|
694
|
+
};
|
695
|
+
|
696
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(tempDirectory.DirectoryPath, projectPath, "net8.0", dependencies, update, new TestLogger());
|
697
|
+
Assert.NotNull(resolvedDependencies);
|
698
|
+
Assert.Equal(4, resolvedDependencies.Length);
|
699
|
+
Assert.Equal("Microsoft.CodeAnalysis.Compilers", resolvedDependencies[0].Name);
|
700
|
+
Assert.Equal("4.10.0", resolvedDependencies[0].Version);
|
701
|
+
Assert.Equal("Microsoft.CodeAnalysis.Common", resolvedDependencies[1].Name);
|
702
|
+
Assert.Equal("4.10.0", resolvedDependencies[1].Version);
|
703
|
+
Assert.Equal("Microsoft.CodeAnalysis.CSharp", resolvedDependencies[2].Name);
|
704
|
+
Assert.Equal("4.10.0", resolvedDependencies[2].Version);
|
705
|
+
Assert.Equal("Microsoft.CodeAnalysis.VisualBasic", resolvedDependencies[3].Name);
|
706
|
+
Assert.Equal("4.10.0", resolvedDependencies[3].Version);
|
783
707
|
}
|
784
708
|
|
785
709
|
// A combination of the third and fourth test, to measure efficiency of updating separate families
|
@@ -788,56 +712,48 @@ public class MSBuildHelperTests : TestBase
|
|
788
712
|
[Fact]
|
789
713
|
public async Task DependencyConflictsCanBeResolvedNewSelectiveAdditionPackages()
|
790
714
|
{
|
791
|
-
var
|
715
|
+
using var tempDirectory = new TemporaryDirectory();
|
716
|
+
var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
|
717
|
+
await File.WriteAllTextAsync(projectPath, """
|
718
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
719
|
+
<PropertyGroup>
|
720
|
+
<TargetFramework>net8.0</TargetFramework>
|
721
|
+
</PropertyGroup>
|
722
|
+
<ItemGroup>
|
723
|
+
<PackageReference Include="Microsoft.CodeAnalysis.Compilers" Version="4.9.2" />
|
724
|
+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" />
|
725
|
+
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="4.9.2" />
|
726
|
+
<PackageReference Include="Newtonsoft.Json.Bson" Version="1.0.2" />
|
727
|
+
</ItemGroup>
|
728
|
+
</Project>
|
729
|
+
""");
|
792
730
|
|
793
|
-
|
731
|
+
var dependencies = new[]
|
794
732
|
{
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
<ItemGroup>
|
802
|
-
<PackageReference Include="Microsoft.CodeAnalysis.Compilers" Version="4.9.2" />
|
803
|
-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" />
|
804
|
-
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="4.9.2" />
|
805
|
-
<PackageReference Include="Newtonsoft.Json.Bson" Version="1.0.2" />
|
806
|
-
</ItemGroup>
|
807
|
-
</Project>
|
808
|
-
""");
|
809
|
-
|
810
|
-
var dependencies = new[]
|
811
|
-
{
|
812
|
-
new Dependency("Microsoft.CodeAnalysis.Compilers", "4.9.2", DependencyType.PackageReference),
|
813
|
-
new Dependency("Microsoft.CodeAnalysis.CSharp", "4.9.2", DependencyType.PackageReference),
|
814
|
-
new Dependency("Microsoft.CodeAnalysis.VisualBasic", "4.9.2", DependencyType.PackageReference),
|
815
|
-
new Dependency("Newtonsoft.Json.Bson", "1.0.2", DependencyType.PackageReference)
|
816
|
-
};
|
817
|
-
var update = new[]
|
818
|
-
{
|
819
|
-
new Dependency("Microsoft.CodeAnalysis.Common", "4.10.0", DependencyType.PackageReference),
|
820
|
-
new Dependency("Newtonsoft.Json", "13.0.1", DependencyType.Unknown)
|
821
|
-
};
|
822
|
-
|
823
|
-
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "net8.0", dependencies, update, new TestLogger());
|
824
|
-
Assert.NotNull(resolvedDependencies);
|
825
|
-
Assert.Equal(5, resolvedDependencies.Length);
|
826
|
-
Assert.Equal("Microsoft.CodeAnalysis.Compilers", resolvedDependencies[0].Name);
|
827
|
-
Assert.Equal("4.10.0", resolvedDependencies[0].Version);
|
828
|
-
Assert.Equal("Microsoft.CodeAnalysis.CSharp", resolvedDependencies[1].Name);
|
829
|
-
Assert.Equal("4.10.0", resolvedDependencies[1].Version);
|
830
|
-
Assert.Equal("Microsoft.CodeAnalysis.VisualBasic", resolvedDependencies[2].Name);
|
831
|
-
Assert.Equal("4.10.0", resolvedDependencies[2].Version);
|
832
|
-
Assert.Equal("Newtonsoft.Json.Bson", resolvedDependencies[3].Name);
|
833
|
-
Assert.Equal("1.0.2", resolvedDependencies[3].Version);
|
834
|
-
Assert.Equal("Newtonsoft.Json", resolvedDependencies[4].Name);
|
835
|
-
Assert.Equal("13.0.1", resolvedDependencies[4].Version);
|
836
|
-
}
|
837
|
-
finally
|
733
|
+
new Dependency("Microsoft.CodeAnalysis.Compilers", "4.9.2", DependencyType.PackageReference),
|
734
|
+
new Dependency("Microsoft.CodeAnalysis.CSharp", "4.9.2", DependencyType.PackageReference),
|
735
|
+
new Dependency("Microsoft.CodeAnalysis.VisualBasic", "4.9.2", DependencyType.PackageReference),
|
736
|
+
new Dependency("Newtonsoft.Json.Bson", "1.0.2", DependencyType.PackageReference)
|
737
|
+
};
|
738
|
+
var update = new[]
|
838
739
|
{
|
839
|
-
|
840
|
-
|
740
|
+
new Dependency("Microsoft.CodeAnalysis.Common", "4.10.0", DependencyType.PackageReference),
|
741
|
+
new Dependency("Newtonsoft.Json", "13.0.1", DependencyType.Unknown)
|
742
|
+
};
|
743
|
+
|
744
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(tempDirectory.DirectoryPath, projectPath, "net8.0", dependencies, update, new TestLogger());
|
745
|
+
Assert.NotNull(resolvedDependencies);
|
746
|
+
Assert.Equal(5, resolvedDependencies.Length);
|
747
|
+
Assert.Equal("Microsoft.CodeAnalysis.Compilers", resolvedDependencies[0].Name);
|
748
|
+
Assert.Equal("4.10.0", resolvedDependencies[0].Version);
|
749
|
+
Assert.Equal("Microsoft.CodeAnalysis.CSharp", resolvedDependencies[1].Name);
|
750
|
+
Assert.Equal("4.10.0", resolvedDependencies[1].Version);
|
751
|
+
Assert.Equal("Microsoft.CodeAnalysis.VisualBasic", resolvedDependencies[2].Name);
|
752
|
+
Assert.Equal("4.10.0", resolvedDependencies[2].Version);
|
753
|
+
Assert.Equal("Newtonsoft.Json.Bson", resolvedDependencies[3].Name);
|
754
|
+
Assert.Equal("1.0.2", resolvedDependencies[3].Version);
|
755
|
+
Assert.Equal("Newtonsoft.Json", resolvedDependencies[4].Name);
|
756
|
+
Assert.Equal("13.0.1", resolvedDependencies[4].Version);
|
841
757
|
}
|
842
758
|
|
843
759
|
// Two top level packages (Buildalyzer), (Microsoft.CodeAnalysis.CSharp.Scripting) that share a dependency (Microsoft.CodeAnalysis.Csharp)
|
@@ -848,54 +764,46 @@ public class MSBuildHelperTests : TestBase
|
|
848
764
|
[Fact]
|
849
765
|
public async Task DependencyConflictsCanBeResolvedNewSharingDependency()
|
850
766
|
{
|
851
|
-
var
|
767
|
+
using var tempDirectory = new TemporaryDirectory();
|
768
|
+
var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
|
769
|
+
await File.WriteAllTextAsync(projectPath, """
|
770
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
771
|
+
<PropertyGroup>
|
772
|
+
<TargetFramework>net8.0</TargetFramework>
|
773
|
+
</PropertyGroup>
|
774
|
+
<ItemGroup>
|
775
|
+
<PackageReference Include="Buildalyzer" Version="6.0.4" />
|
776
|
+
<PackageReference Include="Microsoft.CodeAnalysis.Csharp.Scripting" Version="3.10.0" />
|
777
|
+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.10.0" />
|
778
|
+
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="3.10.0" />
|
779
|
+
</ItemGroup>
|
780
|
+
</Project>
|
781
|
+
""");
|
852
782
|
|
853
|
-
|
783
|
+
var dependencies = new[]
|
854
784
|
{
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.10.0" />
|
865
|
-
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="3.10.0" />
|
866
|
-
</ItemGroup>
|
867
|
-
</Project>
|
868
|
-
""");
|
785
|
+
new Dependency("Buildalyzer", "6.0.4", DependencyType.PackageReference),
|
786
|
+
new Dependency("Microsoft.CodeAnalysis.CSharp.Scripting", "3.10.0", DependencyType.PackageReference),
|
787
|
+
new Dependency("Microsoft.CodeAnalysis.CSharp", "3.10.0", DependencyType.PackageReference),
|
788
|
+
new Dependency("Microsoft.CodeAnalysis.Common", "3.10.0", DependencyType.PackageReference),
|
789
|
+
};
|
790
|
+
var update = new[]
|
791
|
+
{
|
792
|
+
new Dependency("Buildalyzer", "7.0.1", DependencyType.PackageReference),
|
793
|
+
};
|
869
794
|
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "net8.0", dependencies, update, new TestLogger());
|
883
|
-
Assert.NotNull(resolvedDependencies);
|
884
|
-
Assert.Equal(4, resolvedDependencies.Length);
|
885
|
-
Assert.Equal("Buildalyzer", resolvedDependencies[0].Name);
|
886
|
-
Assert.Equal("7.0.1", resolvedDependencies[0].Version);
|
887
|
-
Assert.Equal("Microsoft.CodeAnalysis.CSharp.Scripting", resolvedDependencies[1].Name);
|
888
|
-
Assert.Equal("4.0.0", resolvedDependencies[1].Version);
|
889
|
-
Assert.Equal("Microsoft.CodeAnalysis.CSharp", resolvedDependencies[2].Name);
|
890
|
-
Assert.Equal("4.0.0", resolvedDependencies[2].Version);
|
891
|
-
Assert.Equal("Microsoft.CodeAnalysis.Common", resolvedDependencies[3].Name);
|
892
|
-
Assert.Equal("4.0.0", resolvedDependencies[3].Version);
|
893
|
-
}
|
894
|
-
finally
|
895
|
-
{
|
896
|
-
repoRoot.Delete(recursive: true);
|
897
|
-
}
|
898
|
-
}
|
795
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(tempDirectory.DirectoryPath, projectPath, "net8.0", dependencies, update, new TestLogger());
|
796
|
+
Assert.NotNull(resolvedDependencies);
|
797
|
+
Assert.Equal(4, resolvedDependencies.Length);
|
798
|
+
Assert.Equal("Buildalyzer", resolvedDependencies[0].Name);
|
799
|
+
Assert.Equal("7.0.1", resolvedDependencies[0].Version);
|
800
|
+
Assert.Equal("Microsoft.CodeAnalysis.CSharp.Scripting", resolvedDependencies[1].Name);
|
801
|
+
Assert.Equal("4.0.0", resolvedDependencies[1].Version);
|
802
|
+
Assert.Equal("Microsoft.CodeAnalysis.CSharp", resolvedDependencies[2].Name);
|
803
|
+
Assert.Equal("4.0.0", resolvedDependencies[2].Version);
|
804
|
+
Assert.Equal("Microsoft.CodeAnalysis.Common", resolvedDependencies[3].Name);
|
805
|
+
Assert.Equal("4.0.0", resolvedDependencies[3].Version);
|
806
|
+
}
|
899
807
|
|
900
808
|
// Updating two families at once to test efficiency
|
901
809
|
// First family: Direct dependency (Microsoft.CodeAnalysis.Common) needs to be updated, which will then need to update in the existing list its dependency (System.Collections.Immutable) and "parent" (Microsoft.CodeAnalysis.Csharp.Scripting)
|
@@ -903,114 +811,98 @@ public class MSBuildHelperTests : TestBase
|
|
903
811
|
[Fact]
|
904
812
|
public async Task DependencyConflictsCanBeResolvedNewUpdatingEntireFamily()
|
905
813
|
{
|
906
|
-
var
|
814
|
+
using var tempDirectory = new TemporaryDirectory();
|
815
|
+
var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
|
816
|
+
await File.WriteAllTextAsync(projectPath, """
|
817
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
818
|
+
<PropertyGroup>
|
819
|
+
<TargetFramework>net8.0</TargetFramework>
|
820
|
+
</PropertyGroup>
|
821
|
+
<ItemGroup>
|
822
|
+
<PackageReference Include="System.Collections.Immutable" Version="7.0.0" />
|
823
|
+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.8.0" />
|
824
|
+
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="1.0.0" />
|
825
|
+
<PackageReference Include="Azure.Core" Version="1.21.0" />
|
826
|
+
</ItemGroup>
|
827
|
+
</Project>
|
828
|
+
""");
|
907
829
|
|
908
|
-
|
830
|
+
var dependencies = new[]
|
909
831
|
{
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
<TargetFramework>net8.0</TargetFramework>
|
915
|
-
</PropertyGroup>
|
916
|
-
<ItemGroup>
|
917
|
-
<PackageReference Include="System.Collections.Immutable" Version="7.0.0" />
|
918
|
-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.8.0" />
|
919
|
-
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="1.0.0" />
|
920
|
-
<PackageReference Include="Azure.Core" Version="1.21.0" />
|
921
|
-
</ItemGroup>
|
922
|
-
</Project>
|
923
|
-
""");
|
924
|
-
|
925
|
-
var dependencies = new[]
|
926
|
-
{
|
927
|
-
new Dependency("System.Collections.Immutable", "7.0.0", DependencyType.PackageReference),
|
928
|
-
new Dependency("Microsoft.CodeAnalysis.CSharp.Scripting", "4.8.0", DependencyType.PackageReference),
|
929
|
-
new Dependency("Microsoft.Bcl.AsyncInterfaces", "1.0.0", DependencyType.Unknown),
|
930
|
-
new Dependency("Azure.Core", "1.21.0", DependencyType.PackageReference),
|
931
|
-
|
932
|
-
};
|
933
|
-
var update = new[]
|
934
|
-
{
|
935
|
-
new Dependency("Microsoft.CodeAnalysis.Common", "4.10.0", DependencyType.PackageReference),
|
936
|
-
new Dependency("Azure.Core", "1.22.0", DependencyType.PackageReference)
|
937
|
-
};
|
832
|
+
new Dependency("System.Collections.Immutable", "7.0.0", DependencyType.PackageReference),
|
833
|
+
new Dependency("Microsoft.CodeAnalysis.CSharp.Scripting", "4.8.0", DependencyType.PackageReference),
|
834
|
+
new Dependency("Microsoft.Bcl.AsyncInterfaces", "1.0.0", DependencyType.Unknown),
|
835
|
+
new Dependency("Azure.Core", "1.21.0", DependencyType.PackageReference),
|
938
836
|
|
939
|
-
|
940
|
-
|
941
|
-
Assert.Equal(4, resolvedDependencies.Length);
|
942
|
-
Assert.Equal("System.Collections.Immutable", resolvedDependencies[0].Name);
|
943
|
-
Assert.Equal("8.0.0", resolvedDependencies[0].Version);
|
944
|
-
Assert.Equal("Microsoft.CodeAnalysis.CSharp.Scripting", resolvedDependencies[1].Name);
|
945
|
-
Assert.Equal("4.10.0", resolvedDependencies[1].Version);
|
946
|
-
Assert.Equal("Microsoft.Bcl.AsyncInterfaces", resolvedDependencies[2].Name);
|
947
|
-
Assert.Equal("1.1.1", resolvedDependencies[2].Version);
|
948
|
-
Assert.Equal("Azure.Core", resolvedDependencies[3].Name);
|
949
|
-
Assert.Equal("1.22.0", resolvedDependencies[3].Version);
|
950
|
-
}
|
951
|
-
finally
|
837
|
+
};
|
838
|
+
var update = new[]
|
952
839
|
{
|
953
|
-
|
954
|
-
|
840
|
+
new Dependency("Microsoft.CodeAnalysis.Common", "4.10.0", DependencyType.PackageReference),
|
841
|
+
new Dependency("Azure.Core", "1.22.0", DependencyType.PackageReference)
|
842
|
+
};
|
843
|
+
|
844
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(tempDirectory.DirectoryPath, projectPath, "net8.0", dependencies, update, new TestLogger());
|
845
|
+
Assert.NotNull(resolvedDependencies);
|
846
|
+
Assert.Equal(4, resolvedDependencies.Length);
|
847
|
+
Assert.Equal("System.Collections.Immutable", resolvedDependencies[0].Name);
|
848
|
+
Assert.Equal("8.0.0", resolvedDependencies[0].Version);
|
849
|
+
Assert.Equal("Microsoft.CodeAnalysis.CSharp.Scripting", resolvedDependencies[1].Name);
|
850
|
+
Assert.Equal("4.10.0", resolvedDependencies[1].Version);
|
851
|
+
Assert.Equal("Microsoft.Bcl.AsyncInterfaces", resolvedDependencies[2].Name);
|
852
|
+
Assert.Equal("1.1.1", resolvedDependencies[2].Version);
|
853
|
+
Assert.Equal("Azure.Core", resolvedDependencies[3].Name);
|
854
|
+
Assert.Equal("1.22.0", resolvedDependencies[3].Version);
|
955
855
|
}
|
956
856
|
|
957
857
|
// Similar to the last test, except Microsoft.CodeAnalysis.Common is in the existing list
|
958
858
|
[Fact]
|
959
859
|
public async Task DependencyConflictsCanBeResolvedNewUpdatingTopLevelAndDependency()
|
960
860
|
{
|
961
|
-
var
|
861
|
+
using var tempDirectory = new TemporaryDirectory();
|
862
|
+
var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
|
863
|
+
await File.WriteAllTextAsync(projectPath, """
|
864
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
865
|
+
<PropertyGroup>
|
866
|
+
<TargetFramework>net8.0</TargetFramework>
|
867
|
+
</PropertyGroup>
|
868
|
+
<ItemGroup>
|
869
|
+
<PackageReference Include="System.Collections.Immutable" Version="7.0.0" />
|
870
|
+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.8.0" />
|
871
|
+
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.8.0" />
|
872
|
+
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="1.0.0" />
|
873
|
+
<PackageReference Include="Azure.Core" Version="1.21.0" />
|
874
|
+
</ItemGroup>
|
875
|
+
</Project>
|
876
|
+
""");
|
962
877
|
|
963
|
-
|
878
|
+
var dependencies = new[]
|
964
879
|
{
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
</PropertyGroup>
|
971
|
-
<ItemGroup>
|
972
|
-
<PackageReference Include="System.Collections.Immutable" Version="7.0.0" />
|
973
|
-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.8.0" />
|
974
|
-
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.8.0" />
|
975
|
-
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="1.0.0" />
|
976
|
-
<PackageReference Include="Azure.Core" Version="1.21.0" />
|
977
|
-
</ItemGroup>
|
978
|
-
</Project>
|
979
|
-
""");
|
980
|
-
|
981
|
-
var dependencies = new[]
|
982
|
-
{
|
983
|
-
new Dependency("System.Collections.Immutable", "7.0.0", DependencyType.PackageReference),
|
984
|
-
new Dependency("Microsoft.CodeAnalysis.CSharp.Scripting", "4.8.0", DependencyType.PackageReference),
|
985
|
-
new Dependency("Microsoft.CodeAnalysis.Common", "4.8.0", DependencyType.PackageReference),
|
986
|
-
new Dependency("Microsoft.Bcl.AsyncInterfaces", "1.0.0", DependencyType.Unknown),
|
987
|
-
new Dependency("Azure.Core", "1.21.0", DependencyType.PackageReference),
|
988
|
-
|
989
|
-
};
|
990
|
-
var update = new[]
|
991
|
-
{
|
992
|
-
new Dependency("Microsoft.CodeAnalysis.Common", "4.10.0", DependencyType.PackageReference),
|
993
|
-
new Dependency("Azure.Core", "1.22.0", DependencyType.PackageReference)
|
994
|
-
};
|
880
|
+
new Dependency("System.Collections.Immutable", "7.0.0", DependencyType.PackageReference),
|
881
|
+
new Dependency("Microsoft.CodeAnalysis.CSharp.Scripting", "4.8.0", DependencyType.PackageReference),
|
882
|
+
new Dependency("Microsoft.CodeAnalysis.Common", "4.8.0", DependencyType.PackageReference),
|
883
|
+
new Dependency("Microsoft.Bcl.AsyncInterfaces", "1.0.0", DependencyType.Unknown),
|
884
|
+
new Dependency("Azure.Core", "1.21.0", DependencyType.PackageReference),
|
995
885
|
|
996
|
-
|
997
|
-
|
998
|
-
Assert.Equal(5, resolvedDependencies.Length);
|
999
|
-
Assert.Equal("System.Collections.Immutable", resolvedDependencies[0].Name);
|
1000
|
-
Assert.Equal("8.0.0", resolvedDependencies[0].Version);
|
1001
|
-
Assert.Equal("Microsoft.CodeAnalysis.CSharp.Scripting", resolvedDependencies[1].Name);
|
1002
|
-
Assert.Equal("4.10.0", resolvedDependencies[1].Version);
|
1003
|
-
Assert.Equal("Microsoft.CodeAnalysis.Common", resolvedDependencies[2].Name);
|
1004
|
-
Assert.Equal("4.10.0", resolvedDependencies[2].Version);
|
1005
|
-
Assert.Equal("Microsoft.Bcl.AsyncInterfaces", resolvedDependencies[3].Name);
|
1006
|
-
Assert.Equal("1.1.1", resolvedDependencies[3].Version);
|
1007
|
-
Assert.Equal("Azure.Core", resolvedDependencies[4].Name);
|
1008
|
-
Assert.Equal("1.22.0", resolvedDependencies[4].Version);
|
1009
|
-
}
|
1010
|
-
finally
|
886
|
+
};
|
887
|
+
var update = new[]
|
1011
888
|
{
|
1012
|
-
|
1013
|
-
|
889
|
+
new Dependency("Microsoft.CodeAnalysis.Common", "4.10.0", DependencyType.PackageReference),
|
890
|
+
new Dependency("Azure.Core", "1.22.0", DependencyType.PackageReference)
|
891
|
+
};
|
892
|
+
|
893
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(tempDirectory.DirectoryPath, projectPath, "net8.0", dependencies, update, new TestLogger());
|
894
|
+
Assert.NotNull(resolvedDependencies);
|
895
|
+
Assert.Equal(5, resolvedDependencies.Length);
|
896
|
+
Assert.Equal("System.Collections.Immutable", resolvedDependencies[0].Name);
|
897
|
+
Assert.Equal("8.0.0", resolvedDependencies[0].Version);
|
898
|
+
Assert.Equal("Microsoft.CodeAnalysis.CSharp.Scripting", resolvedDependencies[1].Name);
|
899
|
+
Assert.Equal("4.10.0", resolvedDependencies[1].Version);
|
900
|
+
Assert.Equal("Microsoft.CodeAnalysis.Common", resolvedDependencies[2].Name);
|
901
|
+
Assert.Equal("4.10.0", resolvedDependencies[2].Version);
|
902
|
+
Assert.Equal("Microsoft.Bcl.AsyncInterfaces", resolvedDependencies[3].Name);
|
903
|
+
Assert.Equal("1.1.1", resolvedDependencies[3].Version);
|
904
|
+
Assert.Equal("Azure.Core", resolvedDependencies[4].Name);
|
905
|
+
Assert.Equal("1.22.0", resolvedDependencies[4].Version);
|
1014
906
|
}
|
1015
907
|
|
1016
908
|
// Out of scope test: AutoMapper.Extensions.Microsoft.DependencyInjection's versions are not yet compatible
|
@@ -1019,94 +911,78 @@ public class MSBuildHelperTests : TestBase
|
|
1019
911
|
[Fact]
|
1020
912
|
public async Task DependencyConflictsCanBeResolvedNewOutOfScope()
|
1021
913
|
{
|
1022
|
-
var
|
914
|
+
using var tempDirectory = new TemporaryDirectory();
|
915
|
+
var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
|
916
|
+
await File.WriteAllTextAsync(projectPath, """
|
917
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
918
|
+
<PropertyGroup>
|
919
|
+
<TargetFramework>net8.0</TargetFramework>
|
920
|
+
</PropertyGroup>
|
921
|
+
<ItemGroup>
|
922
|
+
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
|
923
|
+
<PackageReference Include="AutoMapper" Version="12.0.1" />
|
924
|
+
<PackageReference Include="AutoMapper.Collection" Version="9.0.0" />
|
925
|
+
</ItemGroup>
|
926
|
+
</Project>
|
927
|
+
""");
|
1023
928
|
|
1024
|
-
|
929
|
+
var dependencies = new[]
|
1025
930
|
{
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
</PropertyGroup>
|
1032
|
-
<ItemGroup>
|
1033
|
-
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
|
1034
|
-
<PackageReference Include="AutoMapper" Version="12.0.1" />
|
1035
|
-
<PackageReference Include="AutoMapper.Collection" Version="9.0.0" />
|
1036
|
-
</ItemGroup>
|
1037
|
-
</Project>
|
1038
|
-
""");
|
1039
|
-
|
1040
|
-
var dependencies = new[]
|
1041
|
-
{
|
1042
|
-
new Dependency("AutoMapper.Extensions.Microsoft.DependencyInjection", "12.0.1", DependencyType.PackageReference),
|
1043
|
-
new Dependency("AutoMapper", "12.0.1", DependencyType.PackageReference),
|
1044
|
-
new Dependency("AutoMapper.Collection", "9.0.0", DependencyType.PackageReference)
|
1045
|
-
};
|
1046
|
-
var update = new[]
|
1047
|
-
{
|
1048
|
-
new Dependency("AutoMapper.Collection", "10.0.0", DependencyType.PackageReference)
|
1049
|
-
};
|
1050
|
-
|
1051
|
-
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "net8.0", dependencies, update, new TestLogger());
|
1052
|
-
Assert.NotNull(resolvedDependencies);
|
1053
|
-
Assert.Equal(3, resolvedDependencies.Length);
|
1054
|
-
Assert.Equal("AutoMapper.Extensions.Microsoft.DependencyInjection", resolvedDependencies[0].Name);
|
1055
|
-
Assert.Equal("12.0.1", resolvedDependencies[0].Version);
|
1056
|
-
Assert.Equal("AutoMapper", resolvedDependencies[1].Name);
|
1057
|
-
Assert.Equal("12.0.1", resolvedDependencies[1].Version);
|
1058
|
-
Assert.Equal("AutoMapper.Collection", resolvedDependencies[2].Name);
|
1059
|
-
Assert.Equal("9.0.0", resolvedDependencies[2].Version);
|
1060
|
-
}
|
1061
|
-
finally
|
931
|
+
new Dependency("AutoMapper.Extensions.Microsoft.DependencyInjection", "12.0.1", DependencyType.PackageReference),
|
932
|
+
new Dependency("AutoMapper", "12.0.1", DependencyType.PackageReference),
|
933
|
+
new Dependency("AutoMapper.Collection", "9.0.0", DependencyType.PackageReference)
|
934
|
+
};
|
935
|
+
var update = new[]
|
1062
936
|
{
|
1063
|
-
|
1064
|
-
}
|
937
|
+
new Dependency("AutoMapper.Collection", "10.0.0", DependencyType.PackageReference)
|
938
|
+
};
|
939
|
+
|
940
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(tempDirectory.DirectoryPath, projectPath, "net8.0", dependencies, update, new TestLogger());
|
941
|
+
Assert.NotNull(resolvedDependencies);
|
942
|
+
Assert.Equal(3, resolvedDependencies.Length);
|
943
|
+
Assert.Equal("AutoMapper.Extensions.Microsoft.DependencyInjection", resolvedDependencies[0].Name);
|
944
|
+
Assert.Equal("12.0.1", resolvedDependencies[0].Version);
|
945
|
+
Assert.Equal("AutoMapper", resolvedDependencies[1].Name);
|
946
|
+
Assert.Equal("12.0.1", resolvedDependencies[1].Version);
|
947
|
+
Assert.Equal("AutoMapper.Collection", resolvedDependencies[2].Name);
|
948
|
+
Assert.Equal("9.0.0", resolvedDependencies[2].Version);
|
1065
949
|
}
|
1066
950
|
|
1067
951
|
// Two dependencies (Microsoft.Extensions.Caching.Memory), (Microsoft.EntityFrameworkCore.Analyzers) used by the same parent (Microsoft.EntityFrameworkCore), updating one of the dependencies
|
1068
952
|
[Fact]
|
1069
953
|
public async Task DependencyConflictsCanBeResolvedNewTwoDependenciesShareSameParent()
|
1070
954
|
{
|
1071
|
-
var
|
955
|
+
using var tempDirectory = new TemporaryDirectory();
|
956
|
+
var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
|
957
|
+
await File.WriteAllTextAsync(projectPath, """
|
958
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
959
|
+
<PropertyGroup>
|
960
|
+
<TargetFramework>net8.0</TargetFramework>
|
961
|
+
</PropertyGroup>
|
962
|
+
<ItemGroup>
|
963
|
+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.11" />
|
964
|
+
<PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" Version="7.0.11" />
|
965
|
+
</ItemGroup>
|
966
|
+
</Project>
|
967
|
+
""");
|
1072
968
|
|
1073
|
-
|
969
|
+
var dependencies = new[]
|
1074
970
|
{
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
<TargetFramework>net8.0</TargetFramework>
|
1080
|
-
</PropertyGroup>
|
1081
|
-
<ItemGroup>
|
1082
|
-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.11" />
|
1083
|
-
<PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" Version="7.0.11" />
|
1084
|
-
</ItemGroup>
|
1085
|
-
</Project>
|
1086
|
-
""");
|
1087
|
-
|
1088
|
-
var dependencies = new[]
|
1089
|
-
{
|
1090
|
-
new Dependency("Microsoft.EntityFrameworkCore", "7.0.11", DependencyType.PackageReference),
|
1091
|
-
new Dependency("Microsoft.EntityFrameworkCore.Analyzers", "7.0.11", DependencyType.PackageReference)
|
1092
|
-
};
|
1093
|
-
var update = new[]
|
1094
|
-
{
|
1095
|
-
new Dependency("Microsoft.Extensions.Caching.Memory", "8.0.0", DependencyType.PackageReference)
|
1096
|
-
};
|
1097
|
-
|
1098
|
-
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "net8.0", dependencies, update, new TestLogger());
|
1099
|
-
Assert.NotNull(resolvedDependencies);
|
1100
|
-
Assert.Equal(2, resolvedDependencies.Length);
|
1101
|
-
Assert.Equal("Microsoft.EntityFrameworkCore", resolvedDependencies[0].Name);
|
1102
|
-
Assert.Equal("8.0.0", resolvedDependencies[0].Version);
|
1103
|
-
Assert.Equal("Microsoft.EntityFrameworkCore.Analyzers", resolvedDependencies[1].Name);
|
1104
|
-
Assert.Equal("8.0.0", resolvedDependencies[1].Version);
|
1105
|
-
}
|
1106
|
-
finally
|
971
|
+
new Dependency("Microsoft.EntityFrameworkCore", "7.0.11", DependencyType.PackageReference),
|
972
|
+
new Dependency("Microsoft.EntityFrameworkCore.Analyzers", "7.0.11", DependencyType.PackageReference)
|
973
|
+
};
|
974
|
+
var update = new[]
|
1107
975
|
{
|
1108
|
-
|
1109
|
-
}
|
976
|
+
new Dependency("Microsoft.Extensions.Caching.Memory", "8.0.0", DependencyType.PackageReference)
|
977
|
+
};
|
978
|
+
|
979
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(tempDirectory.DirectoryPath, projectPath, "net8.0", dependencies, update, new TestLogger());
|
980
|
+
Assert.NotNull(resolvedDependencies);
|
981
|
+
Assert.Equal(2, resolvedDependencies.Length);
|
982
|
+
Assert.Equal("Microsoft.EntityFrameworkCore", resolvedDependencies[0].Name);
|
983
|
+
Assert.Equal("8.0.0", resolvedDependencies[0].Version);
|
984
|
+
Assert.Equal("Microsoft.EntityFrameworkCore.Analyzers", resolvedDependencies[1].Name);
|
985
|
+
Assert.Equal("8.0.0", resolvedDependencies[1].Version);
|
1110
986
|
}
|
1111
987
|
|
1112
988
|
// Updating referenced package
|
@@ -1114,53 +990,45 @@ public class MSBuildHelperTests : TestBase
|
|
1114
990
|
[Fact]
|
1115
991
|
public async Task DependencyConflictsCanBeResolvedNewFamilyOfFourExisting()
|
1116
992
|
{
|
1117
|
-
var
|
993
|
+
using var tempDirectory = new TemporaryDirectory();
|
994
|
+
var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
|
995
|
+
await File.WriteAllTextAsync(projectPath, """
|
996
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
997
|
+
<PropertyGroup>
|
998
|
+
<TargetFramework>net8.0</TargetFramework>
|
999
|
+
</PropertyGroup>
|
1000
|
+
<ItemGroup>
|
1001
|
+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.0" />
|
1002
|
+
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.0" />
|
1003
|
+
<PackageReference Include= "Microsoft.EntityFrameworkCore" Version="7.0.0" />
|
1004
|
+
<PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" Version="7.0.0" />
|
1005
|
+
</ItemGroup>
|
1006
|
+
</Project>
|
1007
|
+
""");
|
1118
1008
|
|
1119
|
-
|
1009
|
+
var dependencies = new[]
|
1120
1010
|
{
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
<ItemGroup>
|
1128
|
-
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.0" />
|
1129
|
-
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.0" />
|
1130
|
-
<PackageReference Include= "Microsoft.EntityFrameworkCore" Version="7.0.0" />
|
1131
|
-
<PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" Version="7.0.0" />
|
1132
|
-
</ItemGroup>
|
1133
|
-
</Project>
|
1134
|
-
""");
|
1135
|
-
|
1136
|
-
var dependencies = new[]
|
1137
|
-
{
|
1138
|
-
new Dependency("Microsoft.EntityFrameworkCore.Design", "7.0.0", DependencyType.PackageReference),
|
1139
|
-
new Dependency("Microsoft.EntityFrameworkCore.Relational", "7.0.0", DependencyType.PackageReference),
|
1140
|
-
new Dependency("Microsoft.EntityFrameworkCore", "7.0.0", DependencyType.PackageReference),
|
1141
|
-
new Dependency("Microsoft.EntityFrameworkCore.Analyzers", "7.0.0", DependencyType.PackageReference)
|
1142
|
-
};
|
1143
|
-
var update = new[]
|
1144
|
-
{
|
1145
|
-
new Dependency("Microsoft.EntityFrameworkCore.Analyzers", "8.0.0", DependencyType.PackageReference)
|
1146
|
-
};
|
1147
|
-
|
1148
|
-
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "net8.0", dependencies, update, new TestLogger());
|
1149
|
-
Assert.NotNull(resolvedDependencies);
|
1150
|
-
Assert.Equal(4, resolvedDependencies.Length);
|
1151
|
-
Assert.Equal("Microsoft.EntityFrameworkCore.Design", resolvedDependencies[0].Name);
|
1152
|
-
Assert.Equal("7.0.0", resolvedDependencies[0].Version);
|
1153
|
-
Assert.Equal("Microsoft.EntityFrameworkCore.Relational", resolvedDependencies[1].Name);
|
1154
|
-
Assert.Equal("7.0.0", resolvedDependencies[1].Version);
|
1155
|
-
Assert.Equal("Microsoft.EntityFrameworkCore", resolvedDependencies[2].Name);
|
1156
|
-
Assert.Equal("7.0.0", resolvedDependencies[2].Version);
|
1157
|
-
Assert.Equal("Microsoft.EntityFrameworkCore.Analyzers", resolvedDependencies[3].Name);
|
1158
|
-
Assert.Equal("8.0.0", resolvedDependencies[3].Version);
|
1159
|
-
}
|
1160
|
-
finally
|
1011
|
+
new Dependency("Microsoft.EntityFrameworkCore.Design", "7.0.0", DependencyType.PackageReference),
|
1012
|
+
new Dependency("Microsoft.EntityFrameworkCore.Relational", "7.0.0", DependencyType.PackageReference),
|
1013
|
+
new Dependency("Microsoft.EntityFrameworkCore", "7.0.0", DependencyType.PackageReference),
|
1014
|
+
new Dependency("Microsoft.EntityFrameworkCore.Analyzers", "7.0.0", DependencyType.PackageReference)
|
1015
|
+
};
|
1016
|
+
var update = new[]
|
1161
1017
|
{
|
1162
|
-
|
1163
|
-
}
|
1018
|
+
new Dependency("Microsoft.EntityFrameworkCore.Analyzers", "8.0.0", DependencyType.PackageReference)
|
1019
|
+
};
|
1020
|
+
|
1021
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(tempDirectory.DirectoryPath, projectPath, "net8.0", dependencies, update, new TestLogger());
|
1022
|
+
Assert.NotNull(resolvedDependencies);
|
1023
|
+
Assert.Equal(4, resolvedDependencies.Length);
|
1024
|
+
Assert.Equal("Microsoft.EntityFrameworkCore.Design", resolvedDependencies[0].Name);
|
1025
|
+
Assert.Equal("7.0.0", resolvedDependencies[0].Version);
|
1026
|
+
Assert.Equal("Microsoft.EntityFrameworkCore.Relational", resolvedDependencies[1].Name);
|
1027
|
+
Assert.Equal("7.0.0", resolvedDependencies[1].Version);
|
1028
|
+
Assert.Equal("Microsoft.EntityFrameworkCore", resolvedDependencies[2].Name);
|
1029
|
+
Assert.Equal("7.0.0", resolvedDependencies[2].Version);
|
1030
|
+
Assert.Equal("Microsoft.EntityFrameworkCore.Analyzers", resolvedDependencies[3].Name);
|
1031
|
+
Assert.Equal("8.0.0", resolvedDependencies[3].Version);
|
1164
1032
|
}
|
1165
1033
|
|
1166
1034
|
// Updating unreferenced package
|
@@ -1168,49 +1036,41 @@ public class MSBuildHelperTests : TestBase
|
|
1168
1036
|
[Fact]
|
1169
1037
|
public async Task DependencyConflictsCanBeResolvedNewFamilyOfFourNotInExisting()
|
1170
1038
|
{
|
1171
|
-
var
|
1039
|
+
using var tempDirectory = new TemporaryDirectory();
|
1040
|
+
var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
|
1041
|
+
await File.WriteAllTextAsync(projectPath, """
|
1042
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
1043
|
+
<PropertyGroup>
|
1044
|
+
<TargetFramework>net8.0</TargetFramework>
|
1045
|
+
</PropertyGroup>
|
1046
|
+
<ItemGroup>
|
1047
|
+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.0" />
|
1048
|
+
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.0" />
|
1049
|
+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0" />
|
1050
|
+
</ItemGroup>
|
1051
|
+
</Project>
|
1052
|
+
""");
|
1172
1053
|
|
1173
|
-
|
1054
|
+
var dependencies = new[]
|
1174
1055
|
{
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
</PropertyGroup>
|
1181
|
-
<ItemGroup>
|
1182
|
-
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.0" />
|
1183
|
-
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.0" />
|
1184
|
-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0" />
|
1185
|
-
</ItemGroup>
|
1186
|
-
</Project>
|
1187
|
-
""");
|
1188
|
-
|
1189
|
-
var dependencies = new[]
|
1190
|
-
{
|
1191
|
-
new Dependency("Microsoft.EntityFrameworkCore.Design", "7.0.0", DependencyType.PackageReference),
|
1192
|
-
new Dependency("Microsoft.EntityFrameworkCore.Relational", "7.0.0", DependencyType.PackageReference),
|
1193
|
-
new Dependency("Microsoft.EntityFrameworkCore", "7.0.0", DependencyType.PackageReference),
|
1194
|
-
};
|
1195
|
-
var update = new[]
|
1196
|
-
{
|
1197
|
-
new Dependency("Microsoft.EntityFrameworkCore.Analyzers", "8.0.0", DependencyType.PackageReference)
|
1198
|
-
};
|
1199
|
-
|
1200
|
-
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "net8.0", dependencies, update, new TestLogger());
|
1201
|
-
Assert.NotNull(resolvedDependencies);
|
1202
|
-
Assert.Equal(3, resolvedDependencies.Length);
|
1203
|
-
Assert.Equal("Microsoft.EntityFrameworkCore.Design", resolvedDependencies[0].Name);
|
1204
|
-
Assert.Equal("8.0.0", resolvedDependencies[0].Version);
|
1205
|
-
Assert.Equal("Microsoft.EntityFrameworkCore.Relational", resolvedDependencies[1].Name);
|
1206
|
-
Assert.Equal("8.0.0", resolvedDependencies[1].Version);
|
1207
|
-
Assert.Equal("Microsoft.EntityFrameworkCore", resolvedDependencies[2].Name);
|
1208
|
-
Assert.Equal("8.0.0", resolvedDependencies[2].Version);
|
1209
|
-
}
|
1210
|
-
finally
|
1056
|
+
new Dependency("Microsoft.EntityFrameworkCore.Design", "7.0.0", DependencyType.PackageReference),
|
1057
|
+
new Dependency("Microsoft.EntityFrameworkCore.Relational", "7.0.0", DependencyType.PackageReference),
|
1058
|
+
new Dependency("Microsoft.EntityFrameworkCore", "7.0.0", DependencyType.PackageReference),
|
1059
|
+
};
|
1060
|
+
var update = new[]
|
1211
1061
|
{
|
1212
|
-
|
1213
|
-
}
|
1062
|
+
new Dependency("Microsoft.EntityFrameworkCore.Analyzers", "8.0.0", DependencyType.PackageReference)
|
1063
|
+
};
|
1064
|
+
|
1065
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(tempDirectory.DirectoryPath, projectPath, "net8.0", dependencies, update, new TestLogger());
|
1066
|
+
Assert.NotNull(resolvedDependencies);
|
1067
|
+
Assert.Equal(3, resolvedDependencies.Length);
|
1068
|
+
Assert.Equal("Microsoft.EntityFrameworkCore.Design", resolvedDependencies[0].Name);
|
1069
|
+
Assert.Equal("8.0.0", resolvedDependencies[0].Version);
|
1070
|
+
Assert.Equal("Microsoft.EntityFrameworkCore.Relational", resolvedDependencies[1].Name);
|
1071
|
+
Assert.Equal("8.0.0", resolvedDependencies[1].Version);
|
1072
|
+
Assert.Equal("Microsoft.EntityFrameworkCore", resolvedDependencies[2].Name);
|
1073
|
+
Assert.Equal("8.0.0", resolvedDependencies[2].Version);
|
1214
1074
|
}
|
1215
1075
|
|
1216
1076
|
// Updating a referenced transitive dependency
|
@@ -1218,103 +1078,87 @@ public class MSBuildHelperTests : TestBase
|
|
1218
1078
|
[Fact]
|
1219
1079
|
public async Task DependencyConflictsCanBeResolvedNewFamilyOfFourSpecificExisting()
|
1220
1080
|
{
|
1221
|
-
var
|
1081
|
+
using var tempDirectory = new TemporaryDirectory();
|
1082
|
+
var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
|
1083
|
+
await File.WriteAllTextAsync(projectPath, """
|
1084
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
1085
|
+
<PropertyGroup>
|
1086
|
+
<TargetFramework>net8.0</TargetFramework>
|
1087
|
+
</PropertyGroup>
|
1088
|
+
<ItemGroup>
|
1089
|
+
<PackageReference Include="System.Collections.Immutable" Version="7.0.0" />
|
1090
|
+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.8.0" />
|
1091
|
+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
|
1092
|
+
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.8.0" />
|
1093
|
+
</ItemGroup>
|
1094
|
+
</Project>
|
1095
|
+
""");
|
1222
1096
|
|
1223
|
-
|
1097
|
+
var dependencies = new[]
|
1224
1098
|
{
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
<ItemGroup>
|
1232
|
-
<PackageReference Include="System.Collections.Immutable" Version="7.0.0" />
|
1233
|
-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.8.0" />
|
1234
|
-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
|
1235
|
-
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.8.0" />
|
1236
|
-
</ItemGroup>
|
1237
|
-
</Project>
|
1238
|
-
""");
|
1239
|
-
|
1240
|
-
var dependencies = new[]
|
1241
|
-
{
|
1242
|
-
new Dependency("System.Collections.Immutable", "7.0.0", DependencyType.PackageReference),
|
1243
|
-
new Dependency("Microsoft.CodeAnalysis.CSharp.Workspaces", "4.8.0", DependencyType.PackageReference),
|
1244
|
-
new Dependency("Microsoft.CodeAnalysis.CSharp", "4.8.0", DependencyType.PackageReference),
|
1245
|
-
new Dependency("Microsoft.CodeAnalysis.Common", "4.8.0", DependencyType.PackageReference),
|
1246
|
-
};
|
1247
|
-
var update = new[]
|
1248
|
-
{
|
1249
|
-
new Dependency("System.Collections.Immutable", "8.0.0", DependencyType.PackageReference),
|
1250
|
-
};
|
1251
|
-
|
1252
|
-
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "net8.0", dependencies, update, new TestLogger());
|
1253
|
-
Assert.NotNull(resolvedDependencies);
|
1254
|
-
Assert.Equal(4, resolvedDependencies.Length);
|
1255
|
-
Assert.Equal("System.Collections.Immutable", resolvedDependencies[0].Name);
|
1256
|
-
Assert.Equal("8.0.0", resolvedDependencies[0].Version);
|
1257
|
-
Assert.Equal("Microsoft.CodeAnalysis.CSharp.Workspaces", resolvedDependencies[1].Name);
|
1258
|
-
Assert.Equal("4.8.0", resolvedDependencies[1].Version);
|
1259
|
-
Assert.Equal("Microsoft.CodeAnalysis.CSharp", resolvedDependencies[2].Name);
|
1260
|
-
Assert.Equal("4.8.0", resolvedDependencies[2].Version);
|
1261
|
-
Assert.Equal("Microsoft.CodeAnalysis.Common", resolvedDependencies[3].Name);
|
1262
|
-
Assert.Equal("4.8.0", resolvedDependencies[3].Version);
|
1263
|
-
}
|
1264
|
-
finally
|
1099
|
+
new Dependency("System.Collections.Immutable", "7.0.0", DependencyType.PackageReference),
|
1100
|
+
new Dependency("Microsoft.CodeAnalysis.CSharp.Workspaces", "4.8.0", DependencyType.PackageReference),
|
1101
|
+
new Dependency("Microsoft.CodeAnalysis.CSharp", "4.8.0", DependencyType.PackageReference),
|
1102
|
+
new Dependency("Microsoft.CodeAnalysis.Common", "4.8.0", DependencyType.PackageReference),
|
1103
|
+
};
|
1104
|
+
var update = new[]
|
1265
1105
|
{
|
1266
|
-
|
1267
|
-
}
|
1106
|
+
new Dependency("System.Collections.Immutable", "8.0.0", DependencyType.PackageReference),
|
1107
|
+
};
|
1108
|
+
|
1109
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(tempDirectory.DirectoryPath, projectPath, "net8.0", dependencies, update, new TestLogger());
|
1110
|
+
Assert.NotNull(resolvedDependencies);
|
1111
|
+
Assert.Equal(4, resolvedDependencies.Length);
|
1112
|
+
Assert.Equal("System.Collections.Immutable", resolvedDependencies[0].Name);
|
1113
|
+
Assert.Equal("8.0.0", resolvedDependencies[0].Version);
|
1114
|
+
Assert.Equal("Microsoft.CodeAnalysis.CSharp.Workspaces", resolvedDependencies[1].Name);
|
1115
|
+
Assert.Equal("4.8.0", resolvedDependencies[1].Version);
|
1116
|
+
Assert.Equal("Microsoft.CodeAnalysis.CSharp", resolvedDependencies[2].Name);
|
1117
|
+
Assert.Equal("4.8.0", resolvedDependencies[2].Version);
|
1118
|
+
Assert.Equal("Microsoft.CodeAnalysis.Common", resolvedDependencies[3].Name);
|
1119
|
+
Assert.Equal("4.8.0", resolvedDependencies[3].Version);
|
1268
1120
|
}
|
1269
1121
|
|
1270
1122
|
// Similar to the last test, with the "grandchild" (System.Collections.Immutable) not in the existing list
|
1271
1123
|
[Fact]
|
1272
1124
|
public async Task DependencyConflictsCanBeResolvedNewFamilyOfFourSpecificNotInExisting()
|
1273
1125
|
{
|
1274
|
-
var
|
1126
|
+
using var tempDirectory = new TemporaryDirectory();
|
1127
|
+
var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
|
1128
|
+
await File.WriteAllTextAsync(projectPath, """
|
1129
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
1130
|
+
<PropertyGroup>
|
1131
|
+
<TargetFramework>net8.0</TargetFramework>
|
1132
|
+
</PropertyGroup>
|
1133
|
+
<ItemGroup>
|
1134
|
+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.8.0" />
|
1135
|
+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
|
1136
|
+
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.8.0" />
|
1137
|
+
</ItemGroup>
|
1138
|
+
</Project>
|
1139
|
+
""");
|
1275
1140
|
|
1276
|
-
|
1141
|
+
var dependencies = new[]
|
1277
1142
|
{
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
<PropertyGroup>
|
1282
|
-
<TargetFramework>net8.0</TargetFramework>
|
1283
|
-
</PropertyGroup>
|
1284
|
-
<ItemGroup>
|
1285
|
-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.8.0" />
|
1286
|
-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
|
1287
|
-
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.8.0" />
|
1288
|
-
</ItemGroup>
|
1289
|
-
</Project>
|
1290
|
-
""");
|
1143
|
+
new Dependency("Microsoft.CodeAnalysis.CSharp.Workspaces", "4.8.0", DependencyType.PackageReference),
|
1144
|
+
new Dependency("Microsoft.CodeAnalysis.CSharp", "4.8.0", DependencyType.PackageReference),
|
1145
|
+
new Dependency("Microsoft.CodeAnalysis.Common", "4.8.0", DependencyType.PackageReference),
|
1291
1146
|
|
1292
|
-
|
1293
|
-
|
1294
|
-
new Dependency("Microsoft.CodeAnalysis.CSharp.Workspaces", "4.8.0", DependencyType.PackageReference),
|
1295
|
-
new Dependency("Microsoft.CodeAnalysis.CSharp", "4.8.0", DependencyType.PackageReference),
|
1296
|
-
new Dependency("Microsoft.CodeAnalysis.Common", "4.8.0", DependencyType.PackageReference),
|
1297
|
-
|
1298
|
-
};
|
1299
|
-
var update = new[]
|
1300
|
-
{
|
1301
|
-
new Dependency("System.Collections.Immutable", "8.0.0", DependencyType.PackageReference),
|
1302
|
-
};
|
1303
|
-
|
1304
|
-
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "net8.0", dependencies, update, new TestLogger());
|
1305
|
-
Assert.NotNull(resolvedDependencies);
|
1306
|
-
Assert.Equal(3, resolvedDependencies.Length);
|
1307
|
-
Assert.Equal("Microsoft.CodeAnalysis.CSharp.Workspaces", resolvedDependencies[0].Name);
|
1308
|
-
Assert.Equal("4.9.2", resolvedDependencies[0].Version);
|
1309
|
-
Assert.Equal("Microsoft.CodeAnalysis.CSharp", resolvedDependencies[1].Name);
|
1310
|
-
Assert.Equal("4.9.2", resolvedDependencies[1].Version);
|
1311
|
-
Assert.Equal("Microsoft.CodeAnalysis.Common", resolvedDependencies[2].Name);
|
1312
|
-
Assert.Equal("4.9.2", resolvedDependencies[2].Version);
|
1313
|
-
}
|
1314
|
-
finally
|
1147
|
+
};
|
1148
|
+
var update = new[]
|
1315
1149
|
{
|
1316
|
-
|
1317
|
-
}
|
1150
|
+
new Dependency("System.Collections.Immutable", "8.0.0", DependencyType.PackageReference),
|
1151
|
+
};
|
1152
|
+
|
1153
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(tempDirectory.DirectoryPath, projectPath, "net8.0", dependencies, update, new TestLogger());
|
1154
|
+
Assert.NotNull(resolvedDependencies);
|
1155
|
+
Assert.Equal(3, resolvedDependencies.Length);
|
1156
|
+
Assert.Equal("Microsoft.CodeAnalysis.CSharp.Workspaces", resolvedDependencies[0].Name);
|
1157
|
+
Assert.Equal("4.9.2", resolvedDependencies[0].Version);
|
1158
|
+
Assert.Equal("Microsoft.CodeAnalysis.CSharp", resolvedDependencies[1].Name);
|
1159
|
+
Assert.Equal("4.9.2", resolvedDependencies[1].Version);
|
1160
|
+
Assert.Equal("Microsoft.CodeAnalysis.Common", resolvedDependencies[2].Name);
|
1161
|
+
Assert.Equal("4.9.2", resolvedDependencies[2].Version);
|
1318
1162
|
}
|
1319
1163
|
#endregion
|
1320
1164
|
|