dependabot-nuget 0.251.0 → 0.253.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/helpers/lib/NuGetUpdater/Directory.Common.props +1 -0
  3. data/helpers/lib/NuGetUpdater/Directory.Packages.props +26 -0
  4. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/DiscoverCommand.cs +35 -0
  5. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/NuGetUpdater.Cli.csproj +1 -1
  6. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Program.cs +4 -7
  7. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Discover.cs +251 -0
  8. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Update.cs +27 -9
  9. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/NuGetUpdater.Cli.Test.csproj +3 -3
  10. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Dependency.cs +56 -1
  11. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/DependencyType.cs +1 -1
  12. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DirectoryPackagesPropsDiscovery.cs +69 -0
  13. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DirectoryPackagesPropsDiscoveryResult.cs +11 -0
  14. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs +217 -0
  15. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DotNetToolsJsonDiscovery.cs +30 -0
  16. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DotNetToolsJsonDiscoveryResult.cs +10 -0
  17. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/GlobalJsonDiscovery.cs +30 -0
  18. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/GlobalJsonDiscoveryResult.cs +10 -0
  19. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/IDiscoveryResult.cs +14 -0
  20. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/PackagesConfigDiscovery.cs +29 -0
  21. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/PackagesConfigDiscoveryResult.cs +10 -0
  22. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/ProjectDiscoveryResult.cs +13 -0
  23. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/SdkProjectDiscovery.cs +128 -0
  24. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/WorkspaceDiscoveryResult.cs +13 -0
  25. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/EvaluationResult.cs +8 -0
  26. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/EvaluationResultType.cs +9 -0
  27. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/BuildFile.cs +6 -8
  28. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/DotNetToolsJsonBuildFile.cs +4 -7
  29. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/GlobalJsonBuildFile.cs +24 -17
  30. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/JsonBuildFile.cs +2 -2
  31. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/PackagesConfigBuildFile.cs +8 -13
  32. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/ProjectBuildFile.cs +100 -19
  33. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/XmlBuildFile.cs +2 -2
  34. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/NuGetUpdater.Core.csproj +6 -6
  35. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Property.cs +6 -0
  36. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/DotNetToolsJsonUpdater.cs +23 -36
  37. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/GlobalJsonUpdater.cs +5 -10
  38. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/SdkPackageUpdater.cs +59 -26
  39. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs +5 -20
  40. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/HashSetExtensions.cs +14 -0
  41. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ImmutableArrayExtensions.cs +18 -0
  42. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/JsonHelper.cs +0 -1
  43. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +281 -140
  44. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/NuGetHelper.cs +27 -4
  45. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/PathHelper.cs +18 -13
  46. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTestBase.cs +135 -0
  47. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.DotNetToolsJson.cs +91 -0
  48. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.GlobalJson.cs +71 -0
  49. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.PackagesConfig.cs +67 -0
  50. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Project.cs +405 -0
  51. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs +306 -0
  52. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/ExpectedDiscoveryResults.cs +36 -0
  53. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/DotNetToolsJsonBuildFileTests.cs +1 -2
  54. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/GlobalJsonBuildFileTests.cs +2 -3
  55. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/PackagesConfigBuildFileTests.cs +4 -6
  56. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/ProjectBuildFileTests.cs +6 -5
  57. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/NuGetUpdater.Core.Test.csproj +4 -3
  58. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TemporaryDirectory.cs +38 -6
  59. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TestBase.cs +10 -0
  60. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/PackagesConfigUpdaterTests.cs +1 -8
  61. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +13 -41
  62. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DirsProj.cs +0 -5
  63. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DotNetTools.cs +0 -5
  64. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.GlobalJson.cs +0 -5
  65. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Mixed.cs +0 -5
  66. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs +0 -5
  67. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Sdk.cs +30 -23
  68. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/AssertEx.cs +272 -0
  69. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/DiffUtil.cs +266 -0
  70. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +239 -161
  71. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/SdkPackageUpdaterHelperTests.cs +7 -11
  72. data/lib/dependabot/nuget/discovery/dependency_details.rb +95 -0
  73. data/lib/dependabot/nuget/discovery/dependency_file_discovery.rb +126 -0
  74. data/lib/dependabot/nuget/discovery/directory_packages_props_discovery.rb +43 -0
  75. data/lib/dependabot/nuget/discovery/discovery_json_reader.rb +83 -0
  76. data/lib/dependabot/nuget/discovery/evaluation_details.rb +63 -0
  77. data/lib/dependabot/nuget/discovery/project_discovery.rb +71 -0
  78. data/lib/dependabot/nuget/discovery/property_details.rb +43 -0
  79. data/lib/dependabot/nuget/discovery/workspace_discovery.rb +66 -0
  80. data/lib/dependabot/nuget/file_parser.rb +19 -128
  81. data/lib/dependabot/nuget/file_updater.rb +28 -60
  82. data/lib/dependabot/nuget/native_helpers.rb +55 -0
  83. data/lib/dependabot/nuget/update_checker/compatibility_checker.rb +3 -8
  84. data/lib/dependabot/nuget/update_checker/dependency_finder.rb +1 -0
  85. data/lib/dependabot/nuget/update_checker/property_updater.rb +1 -0
  86. data/lib/dependabot/nuget/update_checker/tfm_finder.rb +17 -152
  87. data/lib/dependabot/nuget/update_checker/version_finder.rb +1 -6
  88. data/lib/dependabot/nuget/update_checker.rb +4 -1
  89. metadata +44 -25
  90. data/lib/dependabot/nuget/file_parser/dotnet_tools_json_parser.rb +0 -71
  91. data/lib/dependabot/nuget/file_parser/global_json_parser.rb +0 -68
  92. data/lib/dependabot/nuget/file_parser/packages_config_parser.rb +0 -92
  93. data/lib/dependabot/nuget/file_parser/project_file_parser.rb +0 -620
  94. data/lib/dependabot/nuget/file_parser/property_value_finder.rb +0 -225
  95. data/lib/dependabot/nuget/file_updater/property_value_updater.rb +0 -81
@@ -1,21 +1,13 @@
1
- using System;
2
- using System.Collections.Generic;
3
1
  using System.Collections.Immutable;
4
- using System.IO;
5
- using System.Linq;
6
- using System.Threading.Tasks;
7
2
 
8
3
  using Xunit;
9
4
 
10
5
  namespace NuGetUpdater.Core.Test.Utilities;
11
6
 
12
- public class MSBuildHelperTests
13
- {
14
- public MSBuildHelperTests()
15
- {
16
- MSBuildHelper.RegisterMSBuild();
17
- }
7
+ using TestFile = (string Path, string Content);
18
8
 
9
+ public class MSBuildHelperTests : TestBase
10
+ {
19
11
  [Fact]
20
12
  public void GetRootedValue_FindsValue()
21
13
  {
@@ -30,15 +22,15 @@ public class MSBuildHelperTests
30
22
  </ItemGroup>
31
23
  </Project>
32
24
  """;
33
- var propertyInfo = new Dictionary<string, string>
25
+ var propertyInfo = new Dictionary<string, Property>
34
26
  {
35
- { "PackageVersion1", "1.1.1" },
27
+ { "PackageVersion1", new("PackageVersion1", "1.1.1", "Packages.props") },
36
28
  };
37
29
 
38
30
  // Act
39
- var (resultType, evaluatedValue, _) = MSBuildHelper.GetEvaluatedValue(projectContents, propertyInfo);
31
+ var (resultType, _, evaluatedValue, _, _) = MSBuildHelper.GetEvaluatedValue(projectContents, propertyInfo);
40
32
 
41
- Assert.Equal(MSBuildHelper.EvaluationResultType.Success, resultType);
33
+ Assert.Equal(EvaluationResultType.Success, resultType);
42
34
 
43
35
  // Assert
44
36
  Assert.Equal("""
@@ -67,19 +59,19 @@ public class MSBuildHelperTests
67
59
  </ItemGroup>
68
60
  </Project>
69
61
  """;
70
- var propertyInfo = new Dictionary<string, string>
62
+ var propertyInfo = new Dictionary<string, Property>
71
63
  {
72
- { "PackageVersion1", "$(PackageVersion2)" },
73
- { "PackageVersion2", "$(PackageVersion1)" }
64
+ { "PackageVersion1", new("PackageVersion1", "$(PackageVersion2)", "Packages.props") },
65
+ { "PackageVersion2", new("PackageVersion2", "$(PackageVersion1)", "Packages.props") }
74
66
  };
75
67
  // This is needed to make the timeout work. Without that we could get caugth in an infinite loop.
76
68
  await Task.Delay(1);
77
69
 
78
70
  // Act
79
- var (resultType, _, errorMessage) = MSBuildHelper.GetEvaluatedValue(projectContents, propertyInfo);
71
+ var (resultType, _, _, _, errorMessage) = MSBuildHelper.GetEvaluatedValue(projectContents, propertyInfo);
80
72
 
81
73
  // Assert
82
- Assert.Equal(MSBuildHelper.EvaluationResultType.CircularReference, resultType);
74
+ Assert.Equal(EvaluationResultType.CircularReference, resultType);
83
75
  Assert.Equal("Property 'PackageVersion1' has a circular reference.", errorMessage);
84
76
  }
85
77
 
@@ -100,7 +92,7 @@ public class MSBuildHelperTests
100
92
  expectedPaths = expectedPaths.Select(p => p.Replace("/", "\\")).ToArray();
101
93
  }
102
94
 
103
- Assert.Equal(expectedPaths, actualProjectSubPaths);
95
+ AssertEx.Equal(expectedPaths, actualProjectSubPaths);
104
96
  }
105
97
  finally
106
98
  {
@@ -113,16 +105,17 @@ public class MSBuildHelperTests
113
105
  [InlineData("<Project><PropertyGroup><TargetFrameworks>netstandard2.0</TargetFrameworks></PropertyGroup></Project>", "netstandard2.0", null)]
114
106
  [InlineData("<Project><PropertyGroup><TargetFrameworks> ; netstandard2.0 ; </TargetFrameworks></PropertyGroup></Project>", "netstandard2.0", null)]
115
107
  [InlineData("<Project><PropertyGroup><TargetFrameworks>netstandard2.0 ; netstandard2.1 ; </TargetFrameworks></PropertyGroup></Project>", "netstandard2.0", "netstandard2.1")]
116
- public void TfmsCanBeDeterminedFromProjectContents(string projectContents, string? expectedTfm1, string? expectedTfm2)
108
+ [InlineData("<Project><PropertyGroup><TargetFramework>netstandard2.0</TargetFramework><TargetFrameworkVersion Condition='False'>v4.7.2</TargetFrameworkVersion></PropertyGroup></Project>", "netstandard2.0", null)]
109
+ [InlineData("<Project><PropertyGroup><TargetFramework>$(PropertyThatCannotBeResolved)</TargetFramework></PropertyGroup></Project>", null, null)]
110
+ public async Task TfmsCanBeDeterminedFromProjectContents(string projectContents, string? expectedTfm1, string? expectedTfm2)
117
111
  {
118
112
  var projectPath = Path.GetTempFileName();
119
113
  try
120
114
  {
121
115
  File.WriteAllText(projectPath, projectContents);
122
116
  var expectedTfms = new[] { expectedTfm1, expectedTfm2 }.Where(tfm => tfm is not null).ToArray();
123
- var buildFile = ProjectBuildFile.Open(Path.GetDirectoryName(projectPath)!, projectPath);
124
- var actualTfms = MSBuildHelper.GetTargetFrameworkMonikers(ImmutableArray.Create(buildFile));
125
- Assert.Equal(expectedTfms, actualTfms);
117
+ var (_buildFiles, actualTfms) = await MSBuildHelper.LoadBuildFilesAndTargetFrameworksAsync(Path.GetDirectoryName(projectPath)!, projectPath);
118
+ AssertEx.Equal(expectedTfms, actualTfms);
126
119
  }
127
120
  finally
128
121
  {
@@ -132,7 +125,7 @@ public class MSBuildHelperTests
132
125
 
133
126
  [Theory]
134
127
  [MemberData(nameof(GetTopLevelPackageDependencyInfosTestData))]
135
- public async Task TopLevelPackageDependenciesCanBeDetermined((string Path, string Content)[] buildFileContents, Dependency[] expectedTopLevelDependencies)
128
+ public async Task TopLevelPackageDependenciesCanBeDetermined(TestFile[] buildFileContents, Dependency[] expectedTopLevelDependencies)
136
129
  {
137
130
  using var testDirectory = new TemporaryDirectory();
138
131
  var buildFiles = new List<ProjectBuildFile>();
@@ -144,7 +137,7 @@ public class MSBuildHelperTests
144
137
  }
145
138
 
146
139
  var actualTopLevelDependencies = MSBuildHelper.GetTopLevelPackageDependencyInfos(buildFiles.ToImmutableArray());
147
- Assert.Equal(expectedTopLevelDependencies, actualTopLevelDependencies);
140
+ AssertEx.Equal(expectedTopLevelDependencies, actualTopLevelDependencies);
148
141
  }
149
142
 
150
143
  [Fact]
@@ -153,29 +146,29 @@ public class MSBuildHelperTests
153
146
  using var temp = new TemporaryDirectory();
154
147
  var expectedDependencies = new Dependency[]
155
148
  {
156
- new("Microsoft.Bcl.AsyncInterfaces", "7.0.0", DependencyType.Unknown),
157
- new("Microsoft.Extensions.DependencyInjection", "7.0.0", DependencyType.Unknown),
158
- new("Microsoft.Extensions.DependencyInjection.Abstractions", "7.0.0", DependencyType.Unknown),
159
- new("Microsoft.Extensions.Http", "7.0.0", DependencyType.Unknown),
160
- new("Microsoft.Extensions.Logging", "7.0.0", DependencyType.Unknown),
161
- new("Microsoft.Extensions.Logging.Abstractions", "7.0.0", DependencyType.Unknown),
162
- new("Microsoft.Extensions.Options", "7.0.0", DependencyType.Unknown),
163
- new("Microsoft.Extensions.Primitives", "7.0.0", DependencyType.Unknown),
164
- new("System.Buffers", "4.5.1", DependencyType.Unknown),
165
- new("System.ComponentModel.Annotations", "5.0.0", DependencyType.Unknown),
166
- new("System.Diagnostics.DiagnosticSource", "7.0.0", DependencyType.Unknown),
167
- new("System.Memory", "4.5.5", DependencyType.Unknown),
168
- new("System.Numerics.Vectors", "4.4.0", DependencyType.Unknown),
169
- new("System.Runtime.CompilerServices.Unsafe", "6.0.0", DependencyType.Unknown),
170
- new("System.Threading.Tasks.Extensions", "4.5.4", DependencyType.Unknown),
171
- new("NETStandard.Library", "2.0.3", DependencyType.Unknown),
149
+ new("Microsoft.Bcl.AsyncInterfaces", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
150
+ new("Microsoft.Extensions.DependencyInjection", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
151
+ new("Microsoft.Extensions.DependencyInjection.Abstractions", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
152
+ new("Microsoft.Extensions.Http", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"]),
153
+ new("Microsoft.Extensions.Logging", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
154
+ new("Microsoft.Extensions.Logging.Abstractions", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
155
+ new("Microsoft.Extensions.Options", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
156
+ new("Microsoft.Extensions.Primitives", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
157
+ new("System.Buffers", "4.5.1", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
158
+ new("System.ComponentModel.Annotations", "5.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
159
+ new("System.Diagnostics.DiagnosticSource", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
160
+ new("System.Memory", "4.5.5", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
161
+ new("System.Numerics.Vectors", "4.4.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
162
+ new("System.Runtime.CompilerServices.Unsafe", "6.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
163
+ new("System.Threading.Tasks.Extensions", "4.5.4", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
164
+ new("NETStandard.Library", "2.0.3", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
172
165
  };
173
166
  var actualDependencies = await MSBuildHelper.GetAllPackageDependenciesAsync(
174
167
  temp.DirectoryPath,
175
168
  temp.DirectoryPath,
176
169
  "netstandard2.0",
177
170
  [new Dependency("Microsoft.Extensions.Http", "7.0.0", DependencyType.Unknown)]);
178
- Assert.Equal(expectedDependencies, actualDependencies);
171
+ AssertEx.Equal(expectedDependencies, actualDependencies);
179
172
  }
180
173
 
181
174
  [Fact]
@@ -184,79 +177,79 @@ public class MSBuildHelperTests
184
177
  using var temp = new TemporaryDirectory();
185
178
  var expectedDependencies = new Dependency[]
186
179
  {
187
- new("Castle.Core", "4.4.1", DependencyType.Unknown),
188
- new("Microsoft.ApplicationInsights", "2.10.0", DependencyType.Unknown),
189
- new("Microsoft.ApplicationInsights.Agent.Intercept", "2.4.0", DependencyType.Unknown),
190
- new("Microsoft.ApplicationInsights.DependencyCollector", "2.10.0", DependencyType.Unknown),
191
- new("Microsoft.ApplicationInsights.PerfCounterCollector", "2.10.0", DependencyType.Unknown),
192
- new("Microsoft.ApplicationInsights.WindowsServer", "2.10.0", DependencyType.Unknown),
193
- new("Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel", "2.10.0", DependencyType.Unknown),
194
- new("Microsoft.AspNet.TelemetryCorrelation", "1.0.5", DependencyType.Unknown),
195
- new("Microsoft.Bcl.AsyncInterfaces", "7.0.0", DependencyType.Unknown),
196
- new("Microsoft.Extensions.Caching.Abstractions", "1.0.0", DependencyType.Unknown),
197
- new("Microsoft.Extensions.Caching.Memory", "1.0.0", DependencyType.Unknown),
198
- new("Microsoft.Extensions.DependencyInjection", "7.0.0", DependencyType.Unknown),
199
- new("Microsoft.Extensions.DependencyInjection.Abstractions", "7.0.0", DependencyType.Unknown),
200
- new("Microsoft.Extensions.DiagnosticAdapter", "1.1.0", DependencyType.Unknown),
201
- new("Microsoft.Extensions.Http", "7.0.0", DependencyType.Unknown),
202
- new("Microsoft.Extensions.Logging", "7.0.0", DependencyType.Unknown),
203
- new("Microsoft.Extensions.Logging.Abstractions", "7.0.0", DependencyType.Unknown),
204
- new("Microsoft.Extensions.Options", "7.0.0", DependencyType.Unknown),
205
- new("Microsoft.Extensions.PlatformAbstractions", "1.1.0", DependencyType.Unknown),
206
- new("Microsoft.Extensions.Primitives", "7.0.0", DependencyType.Unknown),
207
- new("Moq", "4.16.1", DependencyType.Unknown),
208
- new("MSTest.TestFramework", "2.1.0", DependencyType.Unknown),
209
- new("Newtonsoft.Json", "12.0.1", DependencyType.Unknown),
210
- new("System", "4.1.311.2", DependencyType.Unknown),
211
- new("System.Buffers", "4.5.1", DependencyType.Unknown),
212
- new("System.Collections.Concurrent", "4.3.0", DependencyType.Unknown),
213
- new("System.Collections.Immutable", "1.3.0", DependencyType.Unknown),
214
- new("System.Collections.NonGeneric", "4.3.0", DependencyType.Unknown),
215
- new("System.Collections.Specialized", "4.3.0", DependencyType.Unknown),
216
- new("System.ComponentModel", "4.3.0", DependencyType.Unknown),
217
- new("System.ComponentModel.Annotations", "5.0.0", DependencyType.Unknown),
218
- new("System.ComponentModel.Primitives", "4.3.0", DependencyType.Unknown),
219
- new("System.ComponentModel.TypeConverter", "4.3.0", DependencyType.Unknown),
220
- new("System.Core", "3.5.21022.801", DependencyType.Unknown),
221
- new("System.Data.Common", "4.3.0", DependencyType.Unknown),
222
- new("System.Diagnostics.DiagnosticSource", "7.0.0", DependencyType.Unknown),
223
- new("System.Diagnostics.PerformanceCounter", "4.5.0", DependencyType.Unknown),
224
- new("System.Diagnostics.StackTrace", "4.3.0", DependencyType.Unknown),
225
- new("System.Dynamic.Runtime", "4.3.0", DependencyType.Unknown),
226
- new("System.IO.FileSystem.Primitives", "4.3.0", DependencyType.Unknown),
227
- new("System.Linq", "4.3.0", DependencyType.Unknown),
228
- new("System.Linq.Expressions", "4.3.0", DependencyType.Unknown),
229
- new("System.Memory", "4.5.5", DependencyType.Unknown),
230
- new("System.Net.WebHeaderCollection", "4.3.0", DependencyType.Unknown),
231
- new("System.Numerics.Vectors", "4.4.0", DependencyType.Unknown),
232
- new("System.ObjectModel", "4.3.0", DependencyType.Unknown),
233
- new("System.Private.DataContractSerialization", "4.3.0", DependencyType.Unknown),
234
- new("System.Reflection.Emit", "4.3.0", DependencyType.Unknown),
235
- new("System.Reflection.Emit.ILGeneration", "4.3.0", DependencyType.Unknown),
236
- new("System.Reflection.Emit.Lightweight", "4.3.0", DependencyType.Unknown),
237
- new("System.Reflection.Metadata", "1.4.1", DependencyType.Unknown),
238
- new("System.Reflection.TypeExtensions", "4.3.0", DependencyType.Unknown),
239
- new("System.Runtime.CompilerServices.Unsafe", "6.0.0", DependencyType.Unknown),
240
- new("System.Runtime.InteropServices.RuntimeInformation", "4.3.0", DependencyType.Unknown),
241
- new("System.Runtime.Numerics", "4.3.0", DependencyType.Unknown),
242
- new("System.Runtime.Serialization.Json", "4.3.0", DependencyType.Unknown),
243
- new("System.Runtime.Serialization.Primitives", "4.3.0", DependencyType.Unknown),
244
- new("System.Security.Claims", "4.3.0", DependencyType.Unknown),
245
- new("System.Security.Cryptography.OpenSsl", "4.3.0", DependencyType.Unknown),
246
- new("System.Security.Cryptography.Primitives", "4.3.0", DependencyType.Unknown),
247
- new("System.Security.Principal", "4.3.0", DependencyType.Unknown),
248
- new("System.Text.RegularExpressions", "4.3.0", DependencyType.Unknown),
249
- new("System.Threading", "4.3.0", DependencyType.Unknown),
250
- new("System.Threading.Tasks.Extensions", "4.5.4", DependencyType.Unknown),
251
- new("System.Threading.Thread", "4.3.0", DependencyType.Unknown),
252
- new("System.Threading.ThreadPool", "4.3.0", DependencyType.Unknown),
253
- new("System.Xml.ReaderWriter", "4.3.0", DependencyType.Unknown),
254
- new("System.Xml.XDocument", "4.3.0", DependencyType.Unknown),
255
- new("System.Xml.XmlDocument", "4.3.0", DependencyType.Unknown),
256
- new("System.Xml.XmlSerializer", "4.3.0", DependencyType.Unknown),
257
- new("Microsoft.ApplicationInsights.Web", "2.10.0", DependencyType.Unknown),
258
- new("MSTest.TestAdapter", "2.1.0", DependencyType.Unknown),
259
- new("NETStandard.Library", "2.0.3", DependencyType.Unknown),
180
+ new("Castle.Core", "4.4.1", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"]),
181
+ new("Microsoft.ApplicationInsights", "2.10.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"]),
182
+ new("Microsoft.ApplicationInsights.Agent.Intercept", "2.4.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"]),
183
+ new("Microsoft.ApplicationInsights.DependencyCollector", "2.10.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"]),
184
+ new("Microsoft.ApplicationInsights.PerfCounterCollector", "2.10.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"]),
185
+ new("Microsoft.ApplicationInsights.WindowsServer", "2.10.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"]),
186
+ new("Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel", "2.10.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"]),
187
+ new("Microsoft.AspNet.TelemetryCorrelation", "1.0.5", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
188
+ new("Microsoft.Bcl.AsyncInterfaces", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
189
+ new("Microsoft.Extensions.Caching.Abstractions", "1.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
190
+ new("Microsoft.Extensions.Caching.Memory", "1.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
191
+ new("Microsoft.Extensions.DependencyInjection", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
192
+ new("Microsoft.Extensions.DependencyInjection.Abstractions", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
193
+ new("Microsoft.Extensions.DiagnosticAdapter", "1.1.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
194
+ new("Microsoft.Extensions.Http", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"]),
195
+ new("Microsoft.Extensions.Logging", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
196
+ new("Microsoft.Extensions.Logging.Abstractions", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
197
+ new("Microsoft.Extensions.Options", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
198
+ new("Microsoft.Extensions.PlatformAbstractions", "1.1.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
199
+ new("Microsoft.Extensions.Primitives", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
200
+ new("Moq", "4.16.1", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"]),
201
+ new("MSTest.TestFramework", "2.1.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"]),
202
+ new("Newtonsoft.Json", "12.0.1", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"]),
203
+ new("System", "4.1.311.2", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"]),
204
+ new("System.Buffers", "4.5.1", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
205
+ new("System.Collections.Concurrent", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
206
+ new("System.Collections.Immutable", "1.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
207
+ new("System.Collections.NonGeneric", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
208
+ new("System.Collections.Specialized", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
209
+ new("System.ComponentModel", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
210
+ new("System.ComponentModel.Annotations", "5.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
211
+ new("System.ComponentModel.Primitives", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
212
+ new("System.ComponentModel.TypeConverter", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
213
+ new("System.Core", "3.5.21022.801", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"]),
214
+ new("System.Data.Common", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
215
+ new("System.Diagnostics.DiagnosticSource", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
216
+ new("System.Diagnostics.PerformanceCounter", "4.5.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
217
+ new("System.Diagnostics.StackTrace", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
218
+ new("System.Dynamic.Runtime", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
219
+ new("System.IO.FileSystem.Primitives", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
220
+ new("System.Linq", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
221
+ new("System.Linq.Expressions", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
222
+ new("System.Memory", "4.5.5", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
223
+ new("System.Net.WebHeaderCollection", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
224
+ new("System.Numerics.Vectors", "4.4.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
225
+ new("System.ObjectModel", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
226
+ new("System.Private.DataContractSerialization", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
227
+ new("System.Reflection.Emit", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
228
+ new("System.Reflection.Emit.ILGeneration", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
229
+ new("System.Reflection.Emit.Lightweight", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
230
+ new("System.Reflection.Metadata", "1.4.1", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
231
+ new("System.Reflection.TypeExtensions", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
232
+ new("System.Runtime.CompilerServices.Unsafe", "6.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
233
+ new("System.Runtime.InteropServices.RuntimeInformation", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
234
+ new("System.Runtime.Numerics", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
235
+ new("System.Runtime.Serialization.Json", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
236
+ new("System.Runtime.Serialization.Primitives", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
237
+ new("System.Security.Claims", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
238
+ new("System.Security.Cryptography.OpenSsl", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
239
+ new("System.Security.Cryptography.Primitives", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
240
+ new("System.Security.Principal", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
241
+ new("System.Text.RegularExpressions", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
242
+ new("System.Threading", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
243
+ new("System.Threading.Tasks.Extensions", "4.5.4", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
244
+ new("System.Threading.Thread", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
245
+ new("System.Threading.ThreadPool", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
246
+ new("System.Xml.ReaderWriter", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
247
+ new("System.Xml.XDocument", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
248
+ new("System.Xml.XmlDocument", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
249
+ new("System.Xml.XmlSerializer", "4.3.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
250
+ new("Microsoft.ApplicationInsights.Web", "2.10.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"]),
251
+ new("MSTest.TestAdapter", "2.1.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"]),
252
+ new("NETStandard.Library", "2.0.3", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
260
253
  };
261
254
  var packages = new[]
262
255
  {
@@ -284,7 +277,7 @@ public class MSBuildHelperTests
284
277
  Assert.Equal(ed, ad);
285
278
  }
286
279
 
287
- Assert.Equal(expectedDependencies, actualDependencies);
280
+ AssertEx.Equal(expectedDependencies, actualDependencies);
288
281
  }
289
282
 
290
283
  [Fact]
@@ -293,22 +286,22 @@ public class MSBuildHelperTests
293
286
  using var temp = new TemporaryDirectory();
294
287
  var expectedDependencies = new Dependency[]
295
288
  {
296
- new("Microsoft.Bcl.AsyncInterfaces", "7.0.0", DependencyType.Unknown),
297
- new("Microsoft.Extensions.DependencyInjection", "7.0.0", DependencyType.Unknown),
298
- new("Microsoft.Extensions.DependencyInjection.Abstractions", "7.0.0", DependencyType.Unknown),
299
- new("Microsoft.Extensions.Http", "7.0.0", DependencyType.Unknown),
300
- new("Microsoft.Extensions.Logging", "7.0.0", DependencyType.Unknown),
301
- new("Microsoft.Extensions.Logging.Abstractions", "7.0.0", DependencyType.Unknown),
302
- new("Microsoft.Extensions.Options", "7.0.0", DependencyType.Unknown),
303
- new("Microsoft.Extensions.Primitives", "7.0.0", DependencyType.Unknown),
304
- new("System.Buffers", "4.5.1", DependencyType.Unknown),
305
- new("System.ComponentModel.Annotations", "5.0.0", DependencyType.Unknown),
306
- new("System.Diagnostics.DiagnosticSource", "7.0.0", DependencyType.Unknown),
307
- new("System.Memory", "4.5.5", DependencyType.Unknown),
308
- new("System.Numerics.Vectors", "4.4.0", DependencyType.Unknown),
309
- new("System.Runtime.CompilerServices.Unsafe", "6.0.0", DependencyType.Unknown),
310
- new("System.Threading.Tasks.Extensions", "4.5.4", DependencyType.Unknown),
311
- new("NETStandard.Library", "2.0.3", DependencyType.Unknown),
289
+ new("Microsoft.Bcl.AsyncInterfaces", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
290
+ new("Microsoft.Extensions.DependencyInjection", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
291
+ new("Microsoft.Extensions.DependencyInjection.Abstractions", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
292
+ new("Microsoft.Extensions.Http", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"]),
293
+ new("Microsoft.Extensions.Logging", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
294
+ new("Microsoft.Extensions.Logging.Abstractions", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
295
+ new("Microsoft.Extensions.Options", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
296
+ new("Microsoft.Extensions.Primitives", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
297
+ new("System.Buffers", "4.5.1", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
298
+ new("System.ComponentModel.Annotations", "5.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
299
+ new("System.Diagnostics.DiagnosticSource", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
300
+ new("System.Memory", "4.5.5", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
301
+ new("System.Numerics.Vectors", "4.4.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
302
+ new("System.Runtime.CompilerServices.Unsafe", "6.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
303
+ new("System.Threading.Tasks.Extensions", "4.5.4", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
304
+ new("NETStandard.Library", "2.0.3", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
312
305
  };
313
306
  var packages = new[]
314
307
  {
@@ -316,7 +309,7 @@ public class MSBuildHelperTests
316
309
  new Dependency("Newtonsoft.Json", "12.0.1", DependencyType.Unknown, IsUpdate: true)
317
310
  };
318
311
  var actualDependencies = await MSBuildHelper.GetAllPackageDependenciesAsync(temp.DirectoryPath, temp.DirectoryPath, "netstandard2.0", packages);
319
- Assert.Equal(expectedDependencies, actualDependencies);
312
+ AssertEx.Equal(expectedDependencies, actualDependencies);
320
313
  }
321
314
 
322
315
  [Fact]
@@ -409,8 +402,8 @@ public class MSBuildHelperTests
409
402
  """);
410
403
  var expectedDependencies = new Dependency[]
411
404
  {
412
- new("Newtonsoft.Json", "4.5.11", DependencyType.Unknown),
413
- new("NETStandard.Library", "2.0.3", DependencyType.Unknown),
405
+ new("Newtonsoft.Json", "4.5.11", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"]),
406
+ new("NETStandard.Library", "2.0.3", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
414
407
  };
415
408
  var actualDependencies = await MSBuildHelper.GetAllPackageDependenciesAsync(
416
409
  temp.DirectoryPath,
@@ -419,7 +412,7 @@ public class MSBuildHelperTests
419
412
  [new Dependency("Newtonsoft.Json", "4.5.11", DependencyType.Unknown)]
420
413
  );
421
414
  Assert.False(Directory.Exists(tempNuGetHttpCacheDirectory), "The .nuget/.v3-cache directory was created, meaning http was used.");
422
- Assert.Equal(expectedDependencies, actualDependencies);
415
+ AssertEx.Equal(expectedDependencies, actualDependencies);
423
416
  }
424
417
  finally
425
418
  {
@@ -468,17 +461,17 @@ public class MSBuildHelperTests
468
461
 
469
462
  var expectedDependencies = new Dependency[]
470
463
  {
471
- new("Microsoft.CodeAnalysis.Common", "4.8.0-3.23457.5", DependencyType.Unknown),
472
- new("System.Buffers", "4.5.1", DependencyType.Unknown),
473
- new("System.Collections.Immutable", "7.0.0", DependencyType.Unknown),
474
- new("System.Memory", "4.5.5", DependencyType.Unknown),
475
- new("System.Numerics.Vectors", "4.4.0", DependencyType.Unknown),
476
- new("System.Reflection.Metadata", "7.0.0", DependencyType.Unknown),
477
- new("System.Runtime.CompilerServices.Unsafe", "6.0.0", DependencyType.Unknown),
478
- new("System.Text.Encoding.CodePages", "7.0.0", DependencyType.Unknown),
479
- new("System.Threading.Tasks.Extensions", "4.5.4", DependencyType.Unknown),
480
- new("Microsoft.CodeAnalysis.Analyzers", "3.3.4", DependencyType.Unknown),
481
- new("NETStandard.Library", "2.0.3", DependencyType.Unknown),
464
+ new("Microsoft.CodeAnalysis.Common", "4.8.0-3.23457.5", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"]),
465
+ new("System.Buffers", "4.5.1", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
466
+ new("System.Collections.Immutable", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
467
+ new("System.Memory", "4.5.5", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
468
+ new("System.Numerics.Vectors", "4.4.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
469
+ new("System.Reflection.Metadata", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
470
+ new("System.Runtime.CompilerServices.Unsafe", "6.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
471
+ new("System.Text.Encoding.CodePages", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
472
+ new("System.Threading.Tasks.Extensions", "4.5.4", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
473
+ new("Microsoft.CodeAnalysis.Analyzers", "3.3.4", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
474
+ new("NETStandard.Library", "2.0.3", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
482
475
  };
483
476
  var actualDependencies = await MSBuildHelper.GetAllPackageDependenciesAsync(
484
477
  temp.DirectoryPath,
@@ -486,7 +479,7 @@ public class MSBuildHelperTests
486
479
  "netstandard2.0",
487
480
  [new Dependency("Microsoft.CodeAnalysis.Common", "4.8.0-3.23457.5", DependencyType.Unknown)]
488
481
  );
489
- Assert.Equal(expectedDependencies, actualDependencies);
482
+ AssertEx.Equal(expectedDependencies, actualDependencies);
490
483
  }
491
484
  finally
492
485
  {
@@ -496,6 +489,45 @@ public class MSBuildHelperTests
496
489
  }
497
490
  }
498
491
 
492
+ [Fact]
493
+ public async Task DependencyConflictsCanBeResolved()
494
+ {
495
+ // the package `SpecFlow` was already updated from 3.3.30 to 3.4.3, but this causes a conflict with
496
+ // `SpecFlow.Tools.MsBuild.Generation` that needs to be resolved
497
+ var repoRoot = Directory.CreateTempSubdirectory($"test_{nameof(DependencyConflictsCanBeResolved)}_");
498
+ try
499
+ {
500
+ var projectPath = Path.Join(repoRoot.FullName, "project.csproj");
501
+ await File.WriteAllTextAsync(projectPath, """
502
+ <Project Sdk="Microsoft.NET.Sdk">
503
+ <PropertyGroup>
504
+ <TargetFramework>netstandard2.0</TargetFramework>
505
+ </PropertyGroup>
506
+ <ItemGroup>
507
+ <PackageReference Include="SpecFlow" Version="3.4.3" />
508
+ <PackageReference Include="SpecFlow.Tools.MsBuild.Generation" Version="3.3.30" />
509
+ </ItemGroup>
510
+ </Project>
511
+ """);
512
+ var dependencies = new[]
513
+ {
514
+ new Dependency("SpecFlow", "3.4.3", DependencyType.PackageReference),
515
+ new Dependency("SpecFlow.Tools.MsBuild.Generation", "3.3.30", DependencyType.PackageReference),
516
+ };
517
+ var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "netstandard2.0", dependencies, new Logger(true));
518
+ Assert.NotNull(resolvedDependencies);
519
+ Assert.Equal(2, resolvedDependencies.Length);
520
+ Assert.Equal("SpecFlow", resolvedDependencies[0].Name);
521
+ Assert.Equal("3.4.3", resolvedDependencies[0].Version);
522
+ Assert.Equal("SpecFlow.Tools.MsBuild.Generation", resolvedDependencies[1].Name);
523
+ Assert.Equal("3.4.3", resolvedDependencies[1].Version);
524
+ }
525
+ finally
526
+ {
527
+ repoRoot.Delete(recursive: true);
528
+ }
529
+ }
530
+
499
531
  public static IEnumerable<object[]> GetTopLevelPackageDependencyInfosTestData()
500
532
  {
501
533
  // simple case
@@ -515,7 +547,11 @@ public class MSBuildHelperTests
515
547
  // expected dependencies
516
548
  new Dependency[]
517
549
  {
518
- new("Newtonsoft.Json", "12.0.1", DependencyType.Unknown)
550
+ new(
551
+ "Newtonsoft.Json",
552
+ "12.0.1",
553
+ DependencyType.PackageReference,
554
+ EvaluationResult: new(EvaluationResultType.Success, "12.0.1", "12.0.1", null, null))
519
555
  }
520
556
  ];
521
557
 
@@ -538,7 +574,11 @@ public class MSBuildHelperTests
538
574
  // expected dependencies
539
575
  new Dependency[]
540
576
  {
541
- new("Newtonsoft.Json", "12.0.1", DependencyType.Unknown)
577
+ new(
578
+ "Newtonsoft.Json",
579
+ "12.0.1",
580
+ DependencyType.PackageReference,
581
+ EvaluationResult: new(EvaluationResultType.Success, "12.0.1", "12.0.1", null, null))
542
582
  }
543
583
  ];
544
584
 
@@ -562,7 +602,11 @@ public class MSBuildHelperTests
562
602
  // expected dependencies
563
603
  new Dependency[]
564
604
  {
565
- new("Newtonsoft.Json", "12.0.1", DependencyType.Unknown)
605
+ new(
606
+ "Newtonsoft.Json",
607
+ "12.0.1",
608
+ DependencyType.PackageReference,
609
+ new(EvaluationResultType.Success, "$(NewtonsoftJsonVersion)", "12.0.1", "NewtonsoftJsonVersion", null))
566
610
  }
567
611
  ];
568
612
 
@@ -588,7 +632,11 @@ public class MSBuildHelperTests
588
632
  // expected dependencies
589
633
  new Dependency[]
590
634
  {
591
- new("Newtonsoft.Json", "12.0.1", DependencyType.Unknown)
635
+ new(
636
+ "Newtonsoft.Json",
637
+ "12.0.1",
638
+ DependencyType.PackageReference,
639
+ new(EvaluationResultType.Success, "$(NewtonsoftJsonVersion)", "12.0.1", "NewtonsoftJsonVersion", null))
592
640
  }
593
641
  ];
594
642
 
@@ -614,7 +662,11 @@ public class MSBuildHelperTests
614
662
  // expected dependencies
615
663
  new Dependency[]
616
664
  {
617
- new("Newtonsoft.Json", "12.0.1", DependencyType.Unknown)
665
+ new(
666
+ "Newtonsoft.Json",
667
+ "12.0.1",
668
+ DependencyType.PackageReference,
669
+ new(EvaluationResultType.Success, "$(NewtonsoftJsonVersion)", "12.0.1", "NewtonsoftJsonVersion", null))
618
670
  }
619
671
  };
620
672
 
@@ -640,7 +692,11 @@ public class MSBuildHelperTests
640
692
  // expected dependencies
641
693
  new Dependency[]
642
694
  {
643
- new("Newtonsoft.Json", "12.0.1", DependencyType.Unknown)
695
+ new(
696
+ "Newtonsoft.Json",
697
+ "12.0.1",
698
+ DependencyType.PackageReference,
699
+ new(EvaluationResultType.Success, "$(NewtonsoftJsonVersion)", "12.0.1", "NewtonsoftJsonVersion", null))
644
700
  }
645
701
  ];
646
702
 
@@ -666,7 +722,11 @@ public class MSBuildHelperTests
666
722
  // expected dependencies
667
723
  new Dependency[]
668
724
  {
669
- new("Newtonsoft.Json", "12.0.1", DependencyType.Unknown)
725
+ new(
726
+ "Newtonsoft.Json",
727
+ "12.0.1",
728
+ DependencyType.PackageReference,
729
+ new(EvaluationResultType.Success, "$(NewtonsoftJsonVersion)", "12.0.1", "NewtonsoftJsonVersion", null))
670
730
  }
671
731
  };
672
732
 
@@ -698,8 +758,17 @@ public class MSBuildHelperTests
698
758
  // expected dependencies
699
759
  new Dependency[]
700
760
  {
701
- new("Azure.Identity", "1.6.0", DependencyType.Unknown),
702
- new("Microsoft.Data.SqlClient", "5.1.4", DependencyType.Unknown, IsUpdate: true)
761
+ new(
762
+ "Azure.Identity",
763
+ "1.6.0",
764
+ DependencyType.PackageReference,
765
+ EvaluationResult: new(EvaluationResultType.Success, "1.6.0", "1.6.0", null, null)),
766
+ new(
767
+ "Microsoft.Data.SqlClient",
768
+ "5.1.4",
769
+ DependencyType.PackageReference,
770
+ EvaluationResult: new(EvaluationResultType.Success, "5.1.4", "5.1.4", null, null),
771
+ IsUpdate: true),
703
772
  }
704
773
  ];
705
774
 
@@ -731,8 +800,17 @@ public class MSBuildHelperTests
731
800
  // expected dependencies
732
801
  new Dependency[]
733
802
  {
734
- new("Azure.Identity", "1.6.0", DependencyType.Unknown),
735
- new("Microsoft.Data.SqlClient", "5.1.4", DependencyType.Unknown, IsUpdate: true)
803
+ new(
804
+ "Azure.Identity",
805
+ "1.6.0",
806
+ DependencyType.PackageReference,
807
+ EvaluationResult: new(EvaluationResultType.Success, "1.6.0", "1.6.0", null, null)),
808
+ new(
809
+ "Microsoft.Data.SqlClient",
810
+ "5.1.4",
811
+ DependencyType.PackageReference,
812
+ EvaluationResult: new(EvaluationResultType.Success, "5.1.4", "5.1.4", null, null),
813
+ IsUpdate: true),
736
814
  }
737
815
  ];
738
816
  }