dependabot-nuget 0.258.0 → 0.260.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/helpers/lib/NuGetUpdater/Directory.Packages.props +2 -0
  3. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/DiscoverCommand.cs +2 -2
  4. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Discover.cs +255 -191
  5. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Update.cs +63 -35
  6. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs +107 -14
  7. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +9 -5
  8. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/PathHelper.cs +18 -0
  9. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTestBase.cs +6 -1
  10. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.DotNetToolsJson.cs +6 -2
  11. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.GlobalJson.cs +6 -2
  12. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.PackagesConfig.cs +11 -21
  13. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Proj.cs +95 -0
  14. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Project.cs +204 -62
  15. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs +64 -45
  16. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/MockNuGetPackage.cs +419 -0
  17. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/NuGetUpdater.Core.Test.csproj +1 -0
  18. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TemporaryDirectory.cs +7 -2
  19. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +77 -19
  20. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DirsProj.cs +120 -91
  21. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DotNetTools.cs +132 -97
  22. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.GlobalJson.cs +93 -75
  23. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Mixed.cs +45 -42
  24. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs +1089 -956
  25. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Sdk.cs +1624 -1291
  26. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +296 -293
  27. data/helpers/lib/NuGetUpdater/global.json +6 -0
  28. data/lib/dependabot/nuget/file_parser.rb +4 -5
  29. data/lib/dependabot/nuget/file_updater.rb +1 -1
  30. data/lib/dependabot/nuget/update_checker/dependency_finder.rb +7 -2
  31. data/lib/dependabot/nuget/update_checker/property_updater.rb +1 -0
  32. data/lib/dependabot/nuget/update_checker/version_finder.rb +2 -3
  33. data/lib/dependabot/nuget/update_checker.rb +1 -0
  34. metadata +8 -5
@@ -1,5 +1,9 @@
1
1
  using System.Collections.Immutable;
2
2
 
3
+ using NuGet.Build.Tasks;
4
+
5
+ using NuGetUpdater.Core.Test.Update;
6
+
3
7
  using Xunit;
4
8
 
5
9
  namespace NuGetUpdater.Core.Test.Utilities;
@@ -15,10 +19,10 @@ public class MSBuildHelperTests : TestBase
15
19
  var projectContents = """
16
20
  <Project>
17
21
  <PropertyGroup>
18
- <TargetFramework>netstandard2.0</TargetFramework>
22
+ <TargetFramework>net8.0</TargetFramework>
19
23
  </PropertyGroup>
20
24
  <ItemGroup>
21
- <PackageReference Include="Newtonsoft.Json" Version="$(PackageVersion1)" />
25
+ <PackageReference Include="Some.Package" Version="$(PackageVersion1)" />
22
26
  </ItemGroup>
23
27
  </Project>
24
28
  """;
@@ -36,10 +40,10 @@ public class MSBuildHelperTests : TestBase
36
40
  Assert.Equal("""
37
41
  <Project>
38
42
  <PropertyGroup>
39
- <TargetFramework>netstandard2.0</TargetFramework>
43
+ <TargetFramework>net8.0</TargetFramework>
40
44
  </PropertyGroup>
41
45
  <ItemGroup>
42
- <PackageReference Include="Newtonsoft.Json" Version="1.1.1" />
46
+ <PackageReference Include="Some.Package" Version="1.1.1" />
43
47
  </ItemGroup>
44
48
  </Project>
45
49
  """, evaluatedValue);
@@ -52,10 +56,10 @@ public class MSBuildHelperTests : TestBase
52
56
  var projectContents = """
53
57
  <Project>
54
58
  <PropertyGroup>
55
- <TargetFramework>netstandard2.0</TargetFramework>
59
+ <TargetFramework>net8.0</TargetFramework>
56
60
  </PropertyGroup>
57
61
  <ItemGroup>
58
- <PackageReference Include="Newtonsoft.Json" Version="$(PackageVersion1)" />
62
+ <PackageReference Include="Some.Package" Version="$(PackageVersion1)" />
59
63
  </ItemGroup>
60
64
  </Project>
61
65
  """;
@@ -125,10 +129,13 @@ public class MSBuildHelperTests : TestBase
125
129
 
126
130
  [Theory]
127
131
  [MemberData(nameof(GetTopLevelPackageDependencyInfosTestData))]
128
- public async Task TopLevelPackageDependenciesCanBeDetermined(TestFile[] buildFileContents, Dependency[] expectedTopLevelDependencies)
132
+ public async Task TopLevelPackageDependenciesCanBeDetermined(TestFile[] buildFileContents, Dependency[] expectedTopLevelDependencies, MockNuGetPackage[] testPackages)
129
133
  {
130
134
  using var testDirectory = new TemporaryDirectory();
131
135
  var buildFiles = new List<ProjectBuildFile>();
136
+
137
+ await UpdateWorkerTestBase.MockNuGetPackagesInDirectory(testPackages, testDirectory.DirectoryPath);
138
+
132
139
  foreach (var (path, content) in buildFileContents)
133
140
  {
134
141
  var fullPath = Path.Combine(testDirectory.DirectoryPath, path);
@@ -144,30 +151,29 @@ public class MSBuildHelperTests : TestBase
144
151
  public async Task AllPackageDependenciesCanBeTraversed()
145
152
  {
146
153
  using var temp = new TemporaryDirectory();
147
- var expectedDependencies = new Dependency[]
148
- {
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),
154
+ MockNuGetPackage[] testPackages =
155
+ [
156
+ MockNuGetPackage.CreateSimplePackage("Package.A", "1.0.0", "netstandard2.0", [(null, [("Package.B", "2.0.0")])]),
157
+ MockNuGetPackage.CreateSimplePackage("Package.B", "2.0.0", "netstandard2.0", [(null, [("Package.C", "3.0.0")])]),
158
+ MockNuGetPackage.CreateSimplePackage("Package.C", "3.0.0", "netstandard2.0", [(null, [("Package.D", "4.0.0")])]),
159
+ MockNuGetPackage.CreateSimplePackage("Package.D", "4.0.0", "netstandard2.0"),
160
+ ];
161
+ await UpdateWorkerTestBase.MockNuGetPackagesInDirectory(testPackages, temp.DirectoryPath);
162
+
163
+ Dependency[] expectedDependencies =
164
+ [
164
165
  new("NETStandard.Library", "2.0.3", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
165
- };
166
- var actualDependencies = await MSBuildHelper.GetAllPackageDependenciesAsync(
166
+ new("Package.A", "1.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"]),
167
+ new("Package.B", "2.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
168
+ new("Package.C", "3.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
169
+ new("Package.D", "4.0.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
170
+ ];
171
+ Dependency[] actualDependencies = await MSBuildHelper.GetAllPackageDependenciesAsync(
167
172
  temp.DirectoryPath,
168
173
  temp.DirectoryPath,
169
174
  "netstandard2.0",
170
- [new Dependency("Microsoft.Extensions.Http", "7.0.0", DependencyType.Unknown)]);
175
+ [new Dependency("Package.A", "1.0.0", DependencyType.Unknown)]
176
+ );
171
177
  AssertEx.Equal(expectedDependencies, actualDependencies);
172
178
  }
173
179
 
@@ -175,101 +181,126 @@ public class MSBuildHelperTests : TestBase
175
181
  public async Task AllPackageDependencies_DoNotTruncateLongDependencyLists()
176
182
  {
177
183
  using var temp = new TemporaryDirectory();
178
- var expectedDependencies = new Dependency[]
179
- {
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),
253
- };
184
+ MockNuGetPackage[] testPackages =
185
+ [
186
+ MockNuGetPackage.CreateSimplePackage("Package.1A", "1.0.0", "net8.0", [(null, [("Package.1B", "2.0.0")])]),
187
+ MockNuGetPackage.CreateSimplePackage("Package.1B", "2.0.0", "net8.0", [(null, [("Package.1C", "3.0.0")])]),
188
+ MockNuGetPackage.CreateSimplePackage("Package.1C", "3.0.0", "net8.0", [(null, [("Package.1D", "4.0.0")])]),
189
+ MockNuGetPackage.CreateSimplePackage("Package.1D", "4.0.0", "net8.0", [(null, [("Package.1E", "5.0.0")])]),
190
+ MockNuGetPackage.CreateSimplePackage("Package.1E", "5.0.0", "net8.0", [(null, [("Package.1F", "6.0.0")])]),
191
+ MockNuGetPackage.CreateSimplePackage("Package.1F", "6.0.0", "net8.0", [(null, [("Package.1G", "7.0.0")])]),
192
+ MockNuGetPackage.CreateSimplePackage("Package.1G", "7.0.0", "net8.0", [(null, [("Package.1H", "8.0.0")])]),
193
+ MockNuGetPackage.CreateSimplePackage("Package.1H", "8.0.0", "net8.0", [(null, [("Package.1I", "9.0.0")])]),
194
+ MockNuGetPackage.CreateSimplePackage("Package.1I", "9.0.0", "net8.0", [(null, [("Package.1J", "10.0.0")])]),
195
+ MockNuGetPackage.CreateSimplePackage("Package.1J", "10.0.0", "net8.0", [(null, [("Package.1K", "11.0.0")])]),
196
+ MockNuGetPackage.CreateSimplePackage("Package.1K", "11.0.0", "net8.0", [(null, [("Package.1L", "12.0.0")])]),
197
+ MockNuGetPackage.CreateSimplePackage("Package.1L", "12.0.0", "net8.0", [(null, [("Package.1M", "13.0.0")])]),
198
+ MockNuGetPackage.CreateSimplePackage("Package.1M", "13.0.0", "net8.0", [(null, [("Package.1N", "14.0.0")])]),
199
+ MockNuGetPackage.CreateSimplePackage("Package.1N", "14.0.0", "net8.0", [(null, [("Package.1O", "15.0.0")])]),
200
+ MockNuGetPackage.CreateSimplePackage("Package.1O", "15.0.0", "net8.0", [(null, [("Package.1P", "16.0.0")])]),
201
+ MockNuGetPackage.CreateSimplePackage("Package.1P", "16.0.0", "net8.0", [(null, [("Package.1Q", "17.0.0")])]),
202
+ MockNuGetPackage.CreateSimplePackage("Package.1Q", "17.0.0", "net8.0", [(null, [("Package.1R", "18.0.0")])]),
203
+ MockNuGetPackage.CreateSimplePackage("Package.1R", "18.0.0", "net8.0", [(null, [("Package.1S", "19.0.0")])]),
204
+ MockNuGetPackage.CreateSimplePackage("Package.1S", "19.0.0", "net8.0", [(null, [("Package.1T", "20.0.0")])]),
205
+ MockNuGetPackage.CreateSimplePackage("Package.1T", "20.0.0", "net8.0", [(null, [("Package.1U", "21.0.0")])]),
206
+ MockNuGetPackage.CreateSimplePackage("Package.1U", "21.0.0", "net8.0", [(null, [("Package.1V", "22.0.0")])]),
207
+ MockNuGetPackage.CreateSimplePackage("Package.1V", "22.0.0", "net8.0", [(null, [("Package.1W", "23.0.0")])]),
208
+ MockNuGetPackage.CreateSimplePackage("Package.1W", "23.0.0", "net8.0", [(null, [("Package.1X", "24.0.0")])]),
209
+ MockNuGetPackage.CreateSimplePackage("Package.1X", "24.0.0", "net8.0", [(null, [("Package.1Y", "25.0.0")])]),
210
+ MockNuGetPackage.CreateSimplePackage("Package.1Y", "25.0.0", "net8.0", [(null, [("Package.1Z", "26.0.0")])]),
211
+ MockNuGetPackage.CreateSimplePackage("Package.1Z", "26.0.0", "net8.0", [(null, [("Package.2A", "1.0.0")])]),
212
+ MockNuGetPackage.CreateSimplePackage("Package.2A", "1.0.0", "net8.0", [(null, [("Package.2B", "2.0.0")])]),
213
+ MockNuGetPackage.CreateSimplePackage("Package.2B", "2.0.0", "net8.0", [(null, [("Package.2C", "3.0.0")])]),
214
+ MockNuGetPackage.CreateSimplePackage("Package.2C", "3.0.0", "net8.0", [(null, [("Package.2D", "4.0.0")])]),
215
+ MockNuGetPackage.CreateSimplePackage("Package.2D", "4.0.0", "net8.0", [(null, [("Package.2E", "5.0.0")])]),
216
+ MockNuGetPackage.CreateSimplePackage("Package.2E", "5.0.0", "net8.0", [(null, [("Package.2F", "6.0.0")])]),
217
+ MockNuGetPackage.CreateSimplePackage("Package.2F", "6.0.0", "net8.0", [(null, [("Package.2G", "7.0.0")])]),
218
+ MockNuGetPackage.CreateSimplePackage("Package.2G", "7.0.0", "net8.0", [(null, [("Package.2H", "8.0.0")])]),
219
+ MockNuGetPackage.CreateSimplePackage("Package.2H", "8.0.0", "net8.0", [(null, [("Package.2I", "9.0.0")])]),
220
+ MockNuGetPackage.CreateSimplePackage("Package.2I", "9.0.0", "net8.0", [(null, [("Package.2J", "10.0.0")])]),
221
+ MockNuGetPackage.CreateSimplePackage("Package.2J", "10.0.0", "net8.0", [(null, [("Package.2K", "11.0.0")])]),
222
+ MockNuGetPackage.CreateSimplePackage("Package.2K", "11.0.0", "net8.0", [(null, [("Package.2L", "12.0.0")])]),
223
+ MockNuGetPackage.CreateSimplePackage("Package.2L", "12.0.0", "net8.0", [(null, [("Package.2M", "13.0.0")])]),
224
+ MockNuGetPackage.CreateSimplePackage("Package.2M", "13.0.0", "net8.0", [(null, [("Package.2N", "14.0.0")])]),
225
+ MockNuGetPackage.CreateSimplePackage("Package.2N", "14.0.0", "net8.0", [(null, [("Package.2O", "15.0.0")])]),
226
+ MockNuGetPackage.CreateSimplePackage("Package.2O", "15.0.0", "net8.0", [(null, [("Package.2P", "16.0.0")])]),
227
+ MockNuGetPackage.CreateSimplePackage("Package.2P", "16.0.0", "net8.0", [(null, [("Package.2Q", "17.0.0")])]),
228
+ MockNuGetPackage.CreateSimplePackage("Package.2Q", "17.0.0", "net8.0", [(null, [("Package.2R", "18.0.0")])]),
229
+ MockNuGetPackage.CreateSimplePackage("Package.2R", "18.0.0", "net8.0", [(null, [("Package.2S", "19.0.0")])]),
230
+ MockNuGetPackage.CreateSimplePackage("Package.2S", "19.0.0", "net8.0", [(null, [("Package.2T", "20.0.0")])]),
231
+ MockNuGetPackage.CreateSimplePackage("Package.2T", "20.0.0", "net8.0", [(null, [("Package.2U", "21.0.0")])]),
232
+ MockNuGetPackage.CreateSimplePackage("Package.2U", "21.0.0", "net8.0", [(null, [("Package.2V", "22.0.0")])]),
233
+ MockNuGetPackage.CreateSimplePackage("Package.2V", "22.0.0", "net8.0", [(null, [("Package.2W", "23.0.0")])]),
234
+ MockNuGetPackage.CreateSimplePackage("Package.2W", "23.0.0", "net8.0", [(null, [("Package.2X", "24.0.0")])]),
235
+ MockNuGetPackage.CreateSimplePackage("Package.2X", "24.0.0", "net8.0", [(null, [("Package.2Y", "25.0.0")])]),
236
+ MockNuGetPackage.CreateSimplePackage("Package.2Y", "25.0.0", "net8.0", [(null, [("Package.2Z", "26.0.0")])]),
237
+ MockNuGetPackage.CreateSimplePackage("Package.2Z", "26.0.0", "net8.0"),
238
+ ];
239
+ await UpdateWorkerTestBase.MockNuGetPackagesInDirectory(testPackages, temp.DirectoryPath);
240
+
241
+ Dependency[] expectedDependencies =
242
+ [
243
+ new("Package.1A", "1.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"]),
244
+ new("Package.1B", "2.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
245
+ new("Package.1C", "3.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
246
+ new("Package.1D", "4.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
247
+ new("Package.1E", "5.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
248
+ new("Package.1F", "6.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
249
+ new("Package.1G", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
250
+ new("Package.1H", "8.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
251
+ new("Package.1I", "9.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
252
+ new("Package.1J", "10.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
253
+ new("Package.1K", "11.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
254
+ new("Package.1L", "12.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
255
+ new("Package.1M", "13.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
256
+ new("Package.1N", "14.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
257
+ new("Package.1O", "15.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
258
+ new("Package.1P", "16.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
259
+ new("Package.1Q", "17.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
260
+ new("Package.1R", "18.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"]),
261
+ new("Package.1S", "19.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
262
+ new("Package.1T", "20.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
263
+ new("Package.1U", "21.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
264
+ new("Package.1V", "22.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
265
+ new("Package.1W", "23.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
266
+ new("Package.1X", "24.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
267
+ new("Package.1Y", "25.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
268
+ new("Package.1Z", "26.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
269
+ new("Package.2A", "1.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"]),
270
+ new("Package.2B", "2.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
271
+ new("Package.2C", "3.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
272
+ new("Package.2D", "4.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
273
+ new("Package.2E", "5.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
274
+ new("Package.2F", "6.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
275
+ new("Package.2G", "7.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
276
+ new("Package.2H", "8.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
277
+ new("Package.2I", "9.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
278
+ new("Package.2J", "10.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
279
+ new("Package.2K", "11.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
280
+ new("Package.2L", "12.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
281
+ new("Package.2M", "13.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
282
+ new("Package.2N", "14.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
283
+ new("Package.2O", "15.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
284
+ new("Package.2P", "16.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
285
+ new("Package.2Q", "17.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
286
+ new("Package.2R", "18.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"]),
287
+ new("Package.2S", "19.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
288
+ new("Package.2T", "20.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
289
+ new("Package.2U", "21.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
290
+ new("Package.2V", "22.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
291
+ new("Package.2W", "23.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
292
+ new("Package.2X", "24.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
293
+ new("Package.2Y", "25.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
294
+ new("Package.2Z", "26.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
295
+ ];
254
296
  var packages = new[]
255
297
  {
256
- new Dependency("System", "4.1.311.2", DependencyType.Unknown),
257
- new Dependency("System.Core", "3.5.21022.801", DependencyType.Unknown),
258
- new Dependency("Moq", "4.16.1", DependencyType.Unknown),
259
- new Dependency("Castle.Core", "4.4.1", DependencyType.Unknown),
260
- new Dependency("MSTest.TestAdapter", "2.1.0", DependencyType.Unknown),
261
- new Dependency("MSTest.TestFramework", "2.1.0", DependencyType.Unknown),
262
- new Dependency("Microsoft.ApplicationInsights", "2.10.0", DependencyType.Unknown),
263
- new Dependency("Microsoft.ApplicationInsights.Agent.Intercept", "2.4.0", DependencyType.Unknown),
264
- new Dependency("Microsoft.ApplicationInsights.DependencyCollector", "2.10.0", DependencyType.Unknown),
265
- new Dependency("Microsoft.ApplicationInsights.PerfCounterCollector", "2.10.0", DependencyType.Unknown),
266
- new Dependency("Microsoft.ApplicationInsights.Web", "2.10.0", DependencyType.Unknown),
267
- new Dependency("Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel", "2.10.0", DependencyType.Unknown),
268
- new Dependency("Microsoft.ApplicationInsights.WindowsServer", "2.10.0", DependencyType.Unknown),
269
- new Dependency("Microsoft.Extensions.Http", "7.0.0", DependencyType.Unknown),
270
- new Dependency("Newtonsoft.Json", "12.0.1", DependencyType.Unknown)
298
+ new Dependency("Package.1A", "1.0.0", DependencyType.Unknown),
299
+ new Dependency("Package.1R", "18.0.0", DependencyType.Unknown),
300
+ new Dependency("Package.2A", "1.0.0", DependencyType.Unknown),
301
+ new Dependency("Package.2R", "18.0.0", DependencyType.Unknown),
271
302
  };
272
- var actualDependencies = await MSBuildHelper.GetAllPackageDependenciesAsync(temp.DirectoryPath, temp.DirectoryPath, "netstandard2.0", packages);
303
+ var actualDependencies = await MSBuildHelper.GetAllPackageDependenciesAsync(temp.DirectoryPath, temp.DirectoryPath, "net8.0", packages);
273
304
  for (int i = 0; i < actualDependencies.Length; i++)
274
305
  {
275
306
  var ad = actualDependencies[i];
@@ -284,31 +315,26 @@ public class MSBuildHelperTests : TestBase
284
315
  public async Task AllPackageDependencies_DoNotIncludeUpdateOnlyPackages()
285
316
  {
286
317
  using var temp = new TemporaryDirectory();
287
- var expectedDependencies = new Dependency[]
288
- {
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),
305
- };
318
+ MockNuGetPackage[] testPackages =
319
+ [
320
+ MockNuGetPackage.CreateSimplePackage("Package.A", "1.0.0", "net8.0"),
321
+ MockNuGetPackage.CreateSimplePackage("Package.B", "2.0.0", "net8.0"),
322
+ MockNuGetPackage.CreateSimplePackage("Package.C", "3.0.0", "net8.0"),
323
+ ];
324
+ await UpdateWorkerTestBase.MockNuGetPackagesInDirectory(testPackages, temp.DirectoryPath);
325
+
326
+ Dependency[] expectedDependencies =
327
+ [
328
+ new("Package.A", "1.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"]),
329
+ new("Package.B", "2.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"]),
330
+ ];
306
331
  var packages = new[]
307
332
  {
308
- new Dependency("Microsoft.Extensions.Http", "7.0.0", DependencyType.Unknown),
309
- new Dependency("Newtonsoft.Json", "12.0.1", DependencyType.Unknown, IsUpdate: true)
333
+ new Dependency("Package.A", "1.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"]),
334
+ new Dependency("Package.B", "2.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"]),
335
+ new Dependency("Package.C", "3.0.0", DependencyType.Unknown, IsUpdate: true)
310
336
  };
311
- var actualDependencies = await MSBuildHelper.GetAllPackageDependenciesAsync(temp.DirectoryPath, temp.DirectoryPath, "netstandard2.0", packages);
337
+ var actualDependencies = await MSBuildHelper.GetAllPackageDependenciesAsync(temp.DirectoryPath, temp.DirectoryPath, "net8.0", packages);
312
338
  AssertEx.Equal(expectedDependencies, actualDependencies);
313
339
  }
314
340
 
@@ -344,8 +370,8 @@ public class MSBuildHelperTests : TestBase
344
370
  var actualDependencies = await MSBuildHelper.GetAllPackageDependenciesAsync(
345
371
  temp.DirectoryPath,
346
372
  temp.DirectoryPath,
347
- "netstandard2.0",
348
- [new Dependency("Newtonsoft.Json", "4.5.11", DependencyType.Unknown)]
373
+ "net8.0",
374
+ [new Dependency("Some.Package", "4.5.11", DependencyType.Unknown)]
349
375
  );
350
376
  }
351
377
  finally
@@ -356,72 +382,6 @@ public class MSBuildHelperTests : TestBase
356
382
  }
357
383
  }
358
384
 
359
- [Fact]
360
- public async Task GetAllPackageDependencies_LocalNuGetRepos_AreCopiedToTempProject()
361
- {
362
- // If we end up using this EnvVar pattern again I think it'd be worth it to abstract it out into an IDisposable.
363
- var nugetPackagesDirectory = Environment.GetEnvironmentVariable("NUGET_PACKAGES");
364
- var nugetHttpCacheDirectory = Environment.GetEnvironmentVariable("NUGET_HTTP_CACHE_PATH");
365
- var logger = new Logger(verbose: true);
366
- try
367
- {
368
- // First create a fake local nuget repository
369
- using var restoreDir = new TemporaryDirectory();
370
-
371
- var restoreNuGetPackagesDirectory = Path.Combine(restoreDir.DirectoryPath, ".nuget", "packages");
372
- Environment.SetEnvironmentVariable("NUGET_PACKAGES", restoreNuGetPackagesDirectory);
373
- var restoreNuGetHttpCacheDirectory = Path.Combine(restoreDir.DirectoryPath, ".nuget", "v3-cache");
374
- Environment.SetEnvironmentVariable("NUGET_HTTP_CACHE_PATH", restoreNuGetHttpCacheDirectory);
375
-
376
- using var temp = new TemporaryDirectory();
377
- using (var restoreProjectTemp = new TemporaryDirectory())
378
- {
379
- // dotnet restore .csproj with things we want
380
- await MSBuildHelper.DependenciesAreCoherentAsync(restoreProjectTemp.DirectoryPath, restoreProjectTemp.DirectoryPath, "netstandard2.0",
381
- [new Dependency("Newtonsoft.Json", "4.5.11", DependencyType.Unknown)], logger);
382
- Assert.True(Directory.Exists(restoreNuGetPackagesDirectory), "packages directory didn't exist");
383
- PathHelper.CopyDirectory(restoreNuGetPackagesDirectory, Path.Combine(temp.DirectoryPath, "local_repo"));
384
- }
385
-
386
- // It is important to have empty NuGet caches for this test, so override them with temp directories.
387
- var tempNuGetPackagesDirectory = Path.Combine(temp.DirectoryPath, ".nuget", "packages");
388
- Environment.SetEnvironmentVariable("NUGET_PACKAGES", tempNuGetPackagesDirectory);
389
- var tempNuGetHttpCacheDirectory = Path.Combine(temp.DirectoryPath, ".nuget", "v3-cache");
390
- Environment.SetEnvironmentVariable("NUGET_HTTP_CACHE_PATH", tempNuGetHttpCacheDirectory);
391
-
392
- // Write the NuGet.config.
393
- await File.WriteAllTextAsync(
394
- Path.Combine(temp.DirectoryPath, "NuGet.Config"), """
395
- <?xml version="1.0" encoding="utf-8"?>
396
- <configuration>
397
- <packageSources>
398
- <clear />
399
- <add key="local-repo" value="local_repo" />
400
- </packageSources>
401
- </configuration>
402
- """);
403
- var expectedDependencies = new Dependency[]
404
- {
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),
407
- };
408
- var actualDependencies = await MSBuildHelper.GetAllPackageDependenciesAsync(
409
- temp.DirectoryPath,
410
- temp.DirectoryPath,
411
- "netstandard2.0",
412
- [new Dependency("Newtonsoft.Json", "4.5.11", DependencyType.Unknown)]
413
- );
414
- Assert.False(Directory.Exists(tempNuGetHttpCacheDirectory), "The .nuget/.v3-cache directory was created, meaning http was used.");
415
- AssertEx.Equal(expectedDependencies, actualDependencies);
416
- }
417
- finally
418
- {
419
- // Restore the NuGet caches.
420
- Environment.SetEnvironmentVariable("NUGET_PACKAGES", nugetPackagesDirectory);
421
- Environment.SetEnvironmentVariable("NUGET_HTTP_CACHE_PATH", nugetHttpCacheDirectory);
422
- }
423
- }
424
-
425
385
  [Fact]
426
386
  public async Task AllPackageDependenciesCanBeFoundWithNuGetConfig()
427
387
  {
@@ -438,47 +398,38 @@ public class MSBuildHelperTests : TestBase
438
398
  var tempNuGetHttpCacheDirectory = Path.Combine(temp.DirectoryPath, ".nuget", "v3-cache");
439
399
  Environment.SetEnvironmentVariable("NUGET_HTTP_CACHE_PATH", tempNuGetHttpCacheDirectory);
440
400
 
441
- // First validate that we are unable to find dependencies for the package version without a NuGet.config.
442
- var dependenciesNoNuGetConfig = await MSBuildHelper.GetAllPackageDependenciesAsync(
443
- temp.DirectoryPath,
444
- temp.DirectoryPath,
445
- "netstandard2.0",
446
- [new Dependency("Microsoft.CodeAnalysis.Common", "4.8.0-3.23457.5", DependencyType.Unknown)]);
447
- Assert.Equal([], dependenciesNoNuGetConfig);
448
-
449
- // Write the NuGet.config and try again.
450
- await File.WriteAllTextAsync(
451
- Path.Combine(temp.DirectoryPath, "NuGet.Config"), """
452
- <?xml version="1.0" encoding="utf-8"?>
401
+ // create two local package sources with different packages available in each
402
+ string localSource1 = Path.Combine(temp.DirectoryPath, "localSource1");
403
+ Directory.CreateDirectory(localSource1);
404
+ string localSource2 = Path.Combine(temp.DirectoryPath, "localSource2");
405
+ Directory.CreateDirectory(localSource2);
406
+
407
+ // `Package.A` will only live in `localSource1` and will have a dependency on `Package.B` which is only
408
+ // available in `localSource2`
409
+ MockNuGetPackage.CreateSimplePackage("Package.A", "1.0.0", "net8.0", [(null, [("Package.B", "2.0.0")])]).WriteToDirectory(localSource1);
410
+ MockNuGetPackage.CreateSimplePackage("Package.B", "2.0.0", "net8.0").WriteToDirectory(localSource2);
411
+ await File.WriteAllTextAsync(Path.Join(temp.DirectoryPath, "NuGet.Config"), """
453
412
  <configuration>
454
413
  <packageSources>
455
- <clear />
456
- <add key="dotnet-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
457
- <add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" />
414
+ <add key="localSource1" value="./localSource1" />
415
+ <add key="localSource2" value="./localSource2" />
458
416
  </packageSources>
459
417
  </configuration>
460
418
  """);
461
419
 
462
- var expectedDependencies = new Dependency[]
463
- {
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),
475
- };
476
- var actualDependencies = await MSBuildHelper.GetAllPackageDependenciesAsync(
420
+ Dependency[] expectedDependencies =
421
+ [
422
+ new("Package.A", "1.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"]),
423
+ new("Package.B", "2.0.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
424
+ ];
425
+
426
+ Dependency[] actualDependencies = await MSBuildHelper.GetAllPackageDependenciesAsync(
477
427
  temp.DirectoryPath,
478
428
  temp.DirectoryPath,
479
- "netstandard2.0",
480
- [new Dependency("Microsoft.CodeAnalysis.Common", "4.8.0-3.23457.5", DependencyType.Unknown)]
429
+ "net8.0",
430
+ [new Dependency("Package.A", "1.0.0", DependencyType.Unknown)]
481
431
  );
432
+
482
433
  AssertEx.Equal(expectedDependencies, actualDependencies);
483
434
  }
484
435
  finally
@@ -492,35 +443,48 @@ public class MSBuildHelperTests : TestBase
492
443
  [Fact]
493
444
  public async Task DependencyConflictsCanBeResolved()
494
445
  {
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
446
  var repoRoot = Directory.CreateTempSubdirectory($"test_{nameof(DependencyConflictsCanBeResolved)}_");
447
+ MockNuGetPackage[] testPackages =
448
+ [
449
+ // some base packages
450
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "1.0.0", "net8.0"),
451
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "1.1.0", "net8.0"),
452
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "1.2.0", "net8.0"),
453
+ // some packages that are hard-locked to specific versions of the previous package
454
+ MockNuGetPackage.CreateSimplePackage("Some.Other.Package", "1.0.0", "net8.0", [(null, [("Some.Package", "[1.0.0]")])]),
455
+ MockNuGetPackage.CreateSimplePackage("Some.Other.Package", "1.1.0", "net8.0", [(null, [("Some.Package", "[1.1.0]")])]),
456
+ MockNuGetPackage.CreateSimplePackage("Some.Other.Package", "1.2.0", "net8.0", [(null, [("Some.Package", "[1.2.0]")])]),
457
+ ];
458
+ await UpdateWorkerTestBase.MockNuGetPackagesInDirectory(testPackages, repoRoot.FullName);
459
+
460
+ // the package `Some.Package` was already updated from 1.0.0 to 1.2.0, but this causes a conflict with
461
+ // `Some.Other.Package` that needs to be resolved
498
462
  try
499
463
  {
500
464
  var projectPath = Path.Join(repoRoot.FullName, "project.csproj");
501
465
  await File.WriteAllTextAsync(projectPath, """
502
466
  <Project Sdk="Microsoft.NET.Sdk">
503
467
  <PropertyGroup>
504
- <TargetFramework>netstandard2.0</TargetFramework>
468
+ <TargetFramework>net8.0</TargetFramework>
505
469
  </PropertyGroup>
506
470
  <ItemGroup>
507
- <PackageReference Include="SpecFlow" Version="3.4.3" />
508
- <PackageReference Include="SpecFlow.Tools.MsBuild.Generation" Version="3.3.30" />
471
+ <PackageReference Include="Some.Package" Version="1.2.0" />
472
+ <PackageReference Include="Some.Other.Package" Version="1.0.0" />
509
473
  </ItemGroup>
510
474
  </Project>
511
475
  """);
512
476
  var dependencies = new[]
513
477
  {
514
- new Dependency("SpecFlow", "3.4.3", DependencyType.PackageReference),
515
- new Dependency("SpecFlow.Tools.MsBuild.Generation", "3.3.30", DependencyType.PackageReference),
478
+ new Dependency("Some.Package", "1.2.0", DependencyType.PackageReference),
479
+ new Dependency("Some.Other.Package", "1.0.0", DependencyType.PackageReference),
516
480
  };
517
- var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "netstandard2.0", dependencies, new Logger(true));
481
+ var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "net8.0", dependencies, new Logger(true));
518
482
  Assert.NotNull(resolvedDependencies);
519
483
  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);
484
+ Assert.Equal("Some.Package", resolvedDependencies[0].Name);
485
+ Assert.Equal("1.2.0", resolvedDependencies[0].Version);
486
+ Assert.Equal("Some.Other.Package", resolvedDependencies[1].Name);
487
+ Assert.Equal("1.2.0", resolvedDependencies[1].Version);
524
488
  }
525
489
  finally
526
490
  {
@@ -539,7 +503,7 @@ public class MSBuildHelperTests : TestBase
539
503
  ("project.csproj", """
540
504
  <Project Sdk="Microsoft.NET.Sdk">
541
505
  <ItemGroup>
542
- <PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
506
+ <PackageReference Include="Some.Package" Version="12.0.1" />
543
507
  </ItemGroup>
544
508
  </Project>
545
509
  """)
@@ -548,10 +512,14 @@ public class MSBuildHelperTests : TestBase
548
512
  new Dependency[]
549
513
  {
550
514
  new(
551
- "Newtonsoft.Json",
515
+ "Some.Package",
552
516
  "12.0.1",
553
517
  DependencyType.PackageReference,
554
518
  EvaluationResult: new(EvaluationResultType.Success, "12.0.1", "12.0.1", null, null))
519
+ },
520
+ new MockNuGetPackage[]
521
+ {
522
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "12.0.1", "net8.0")
555
523
  }
556
524
  ];
557
525
 
@@ -564,7 +532,7 @@ public class MSBuildHelperTests : TestBase
564
532
  ("project.csproj", """
565
533
  <Project Sdk="Microsoft.NET.Sdk">
566
534
  <ItemGroup>
567
- <PackageReference Include="Newtonsoft.Json">
535
+ <PackageReference Include="Some.Package">
568
536
  <Version>12.0.1</Version>
569
537
  </PackageReference>
570
538
  </ItemGroup>
@@ -575,10 +543,14 @@ public class MSBuildHelperTests : TestBase
575
543
  new Dependency[]
576
544
  {
577
545
  new(
578
- "Newtonsoft.Json",
546
+ "Some.Package",
579
547
  "12.0.1",
580
548
  DependencyType.PackageReference,
581
549
  EvaluationResult: new(EvaluationResultType.Success, "12.0.1", "12.0.1", null, null))
550
+ },
551
+ new MockNuGetPackage[]
552
+ {
553
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "12.0.1", "net8.0")
582
554
  }
583
555
  ];
584
556
 
@@ -591,10 +563,10 @@ public class MSBuildHelperTests : TestBase
591
563
  ("project.csproj", """
592
564
  <Project Sdk="Microsoft.NET.Sdk">
593
565
  <PropertyGroup>
594
- <NewtonsoftJsonVersion>12.0.1</NewtonsoftJsonVersion>
566
+ <SomePackageVersion>12.0.1</SomePackageVersion>
595
567
  </PropertyGroup>
596
568
  <ItemGroup>
597
- <PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" />
569
+ <PackageReference Include="Some.Package" Version="$(SomePackageVersion)" />
598
570
  </ItemGroup>
599
571
  </Project>
600
572
  """)
@@ -603,10 +575,14 @@ public class MSBuildHelperTests : TestBase
603
575
  new Dependency[]
604
576
  {
605
577
  new(
606
- "Newtonsoft.Json",
578
+ "Some.Package",
607
579
  "12.0.1",
608
580
  DependencyType.PackageReference,
609
- new(EvaluationResultType.Success, "$(NewtonsoftJsonVersion)", "12.0.1", "NewtonsoftJsonVersion", null))
581
+ new(EvaluationResultType.Success, "$(SomePackageVersion)", "12.0.1", "SomePackageVersion", null))
582
+ },
583
+ new MockNuGetPackage[]
584
+ {
585
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "12.0.1", "net8.0")
610
586
  }
611
587
  ];
612
588
 
@@ -620,11 +596,11 @@ public class MSBuildHelperTests : TestBase
620
596
  <Project Sdk="Microsoft.NET.Sdk">
621
597
  <PropertyGroup>
622
598
  <TargetFramework>netstandard2.0</TargetFramework>
623
- <NewtonsoftJsonVersion>12.0.1</NewtonsoftJsonVersion>
624
- <NewtonsoftJsonVersion Condition="$(PropertyThatDoesNotExist) == 'true'">13.0.1</NewtonsoftJsonVersion>
599
+ <SomePackageVersion>12.0.1</SomePackageVersion>
600
+ <SomePackageVersion Condition="$(PropertyThatDoesNotExist) == 'true'">13.0.1</SomePackageVersion>
625
601
  </PropertyGroup>
626
602
  <ItemGroup>
627
- <PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" />
603
+ <PackageReference Include="Some.Package" Version="$(SomePackageVersion)" />
628
604
  </ItemGroup>
629
605
  </Project>
630
606
  """)
@@ -633,10 +609,14 @@ public class MSBuildHelperTests : TestBase
633
609
  new Dependency[]
634
610
  {
635
611
  new(
636
- "Newtonsoft.Json",
612
+ "Some.Package",
637
613
  "12.0.1",
638
614
  DependencyType.PackageReference,
639
- new(EvaluationResultType.Success, "$(NewtonsoftJsonVersion)", "12.0.1", "NewtonsoftJsonVersion", null))
615
+ new(EvaluationResultType.Success, "$(SomePackageVersion)", "12.0.1", "SomePackageVersion", null))
616
+ },
617
+ new MockNuGetPackage[]
618
+ {
619
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "12.0.1", "net8.0")
640
620
  }
641
621
  ];
642
622
 
@@ -650,11 +630,11 @@ public class MSBuildHelperTests : TestBase
650
630
  <Project Sdk="Microsoft.NET.Sdk">
651
631
  <PropertyGroup>
652
632
  <TargetFramework>netstandard2.0</TargetFramework>
653
- <NewtonsoftJsonVersion>12.0.1</NewtonsoftJsonVersion>
654
- <NewtonsoftJsonVersion Condition="'$(PropertyThatDoesNotExist)' == 'true'">13.0.1</NewtonsoftJsonVersion>
633
+ <SomePackageVersion>12.0.1</SomePackageVersion>
634
+ <SomePackageVersion Condition="'$(PropertyThatDoesNotExist)' == 'true'">13.0.1</SomePackageVersion>
655
635
  </PropertyGroup>
656
636
  <ItemGroup>
657
- <PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" />
637
+ <PackageReference Include="Some.Package" Version="$(SomePackageVersion)" />
658
638
  </ItemGroup>
659
639
  </Project>
660
640
  """)
@@ -663,10 +643,14 @@ public class MSBuildHelperTests : TestBase
663
643
  new Dependency[]
664
644
  {
665
645
  new(
666
- "Newtonsoft.Json",
646
+ "Some.Package",
667
647
  "12.0.1",
668
648
  DependencyType.PackageReference,
669
- new(EvaluationResultType.Success, "$(NewtonsoftJsonVersion)", "12.0.1", "NewtonsoftJsonVersion", null))
649
+ new(EvaluationResultType.Success, "$(SomePackageVersion)", "12.0.1", "SomePackageVersion", null))
650
+ },
651
+ new MockNuGetPackage[]
652
+ {
653
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "12.0.1", "net8.0")
670
654
  }
671
655
  };
672
656
 
@@ -680,11 +664,11 @@ public class MSBuildHelperTests : TestBase
680
664
  <Project Sdk="Microsoft.NET.Sdk">
681
665
  <PropertyGroup>
682
666
  <TargetFramework>netstandard2.0</TargetFramework>
683
- <NewtonsoftJsonVersion Condition="$(NewtonsoftJsonVersion) == ''">12.0.1</NewtonsoftJsonVersion>
684
- <NewtonsoftJsonVersion Condition="$(PropertyThatDoesNotExist) == 'true'">13.0.1</NewtonsoftJsonVersion>
667
+ <SomePackageVersion Condition="$(SomePackageVersion) == ''">12.0.1</SomePackageVersion>
668
+ <SomePackageVersion Condition="$(PropertyThatDoesNotExist) == 'true'">13.0.1</SomePackageVersion>
685
669
  </PropertyGroup>
686
670
  <ItemGroup>
687
- <PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" />
671
+ <PackageReference Include="Some.Package" Version="$(SomePackageVersion)" />
688
672
  </ItemGroup>
689
673
  </Project>
690
674
  """)
@@ -693,10 +677,14 @@ public class MSBuildHelperTests : TestBase
693
677
  new Dependency[]
694
678
  {
695
679
  new(
696
- "Newtonsoft.Json",
680
+ "Some.Package",
697
681
  "12.0.1",
698
682
  DependencyType.PackageReference,
699
- new(EvaluationResultType.Success, "$(NewtonsoftJsonVersion)", "12.0.1", "NewtonsoftJsonVersion", null))
683
+ new(EvaluationResultType.Success, "$(SomePackageVersion)", "12.0.1", "SomePackageVersion", null))
684
+ },
685
+ new MockNuGetPackage[]
686
+ {
687
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "12.0.1", "net8.0")
700
688
  }
701
689
  ];
702
690
 
@@ -710,11 +698,11 @@ public class MSBuildHelperTests : TestBase
710
698
  <Project Sdk="Microsoft.NET.Sdk">
711
699
  <PropertyGroup>
712
700
  <TargetFramework>netstandard2.0</TargetFramework>
713
- <NewtonsoftJsonVersion Condition="'$(NewtonsoftJsonVersion)' == ''">12.0.1</NewtonsoftJsonVersion>
714
- <NewtonsoftJsonVersion Condition="'$(PropertyThatDoesNotExist)' == 'true'">13.0.1</NewtonsoftJsonVersion>
701
+ <SomePackageVersion Condition="'$(SomePackageVersion)' == ''">12.0.1</SomePackageVersion>
702
+ <SomePackageVersion Condition="'$(PropertyThatDoesNotExist)' == 'true'">13.0.1</SomePackageVersion>
715
703
  </PropertyGroup>
716
704
  <ItemGroup>
717
- <PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" />
705
+ <PackageReference Include="Some.Package" Version="$(SomePackageVersion)" />
718
706
  </ItemGroup>
719
707
  </Project>
720
708
  """)
@@ -723,10 +711,14 @@ public class MSBuildHelperTests : TestBase
723
711
  new Dependency[]
724
712
  {
725
713
  new(
726
- "Newtonsoft.Json",
714
+ "Some.Package",
727
715
  "12.0.1",
728
716
  DependencyType.PackageReference,
729
- new(EvaluationResultType.Success, "$(NewtonsoftJsonVersion)", "12.0.1", "NewtonsoftJsonVersion", null))
717
+ new(EvaluationResultType.Success, "$(SomePackageVersion)", "12.0.1", "SomePackageVersion", null))
718
+ },
719
+ new MockNuGetPackage[]
720
+ {
721
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "12.0.1", "net8.0")
730
722
  }
731
723
  };
732
724
 
@@ -739,18 +731,18 @@ public class MSBuildHelperTests : TestBase
739
731
  ("Packages.props", """
740
732
  <Project>
741
733
  <ItemGroup>
742
- <PackageReference Update="Azure.Identity" Version="1.6.0" />
743
- <PackageReference Update="Microsoft.Data.SqlClient" Version="5.1.4" />
734
+ <PackageReference Update="Package.A" Version="1.6.0" />
735
+ <PackageReference Update="Package.B" Version="5.1.4" />
744
736
  </ItemGroup>
745
737
  </Project>
746
738
  """),
747
739
  ("project.csproj", """
748
740
  <Project Sdk="Microsoft.NET.Sdk">
749
741
  <PropertyGroup>
750
- <TargetFramework>netstandard2.0</TargetFramework>
742
+ <TargetFramework>net8.0</TargetFramework>
751
743
  </PropertyGroup>
752
744
  <ItemGroup>
753
- <PackageReference Include="Azure.Identity" Version="1.6.1" />
745
+ <PackageReference Include="Package.A" Version="1.6.1" />
754
746
  </ItemGroup>
755
747
  </Project>
756
748
  """)
@@ -759,16 +751,22 @@ public class MSBuildHelperTests : TestBase
759
751
  new Dependency[]
760
752
  {
761
753
  new(
762
- "Azure.Identity",
754
+ "Package.A",
763
755
  "1.6.0",
764
756
  DependencyType.PackageReference,
765
757
  EvaluationResult: new(EvaluationResultType.Success, "1.6.0", "1.6.0", null, null)),
766
758
  new(
767
- "Microsoft.Data.SqlClient",
759
+ "Package.B",
768
760
  "5.1.4",
769
761
  DependencyType.PackageReference,
770
762
  EvaluationResult: new(EvaluationResultType.Success, "5.1.4", "5.1.4", null, null),
771
763
  IsUpdate: true),
764
+ },
765
+ new MockNuGetPackage[]
766
+ {
767
+ MockNuGetPackage.CreateSimplePackage("Package.A", "1.6.0", "net8.0"),
768
+ MockNuGetPackage.CreateSimplePackage("Package.A", "1.6.1", "net8.0"),
769
+ MockNuGetPackage.CreateSimplePackage("Package.B", "5.1.4", "net8.0"),
772
770
  }
773
771
  ];
774
772
 
@@ -781,18 +779,18 @@ public class MSBuildHelperTests : TestBase
781
779
  ("project.csproj", """
782
780
  <Project Sdk="Microsoft.NET.Sdk">
783
781
  <PropertyGroup>
784
- <TargetFramework>netstandard2.0</TargetFramework>
782
+ <TargetFramework>net8.0</TargetFramework>
785
783
  </PropertyGroup>
786
784
  <ItemGroup>
787
- <PackageReference Include="Azure.Identity" />
785
+ <PackageReference Include="Package.A" />
788
786
  </ItemGroup>
789
787
  </Project>
790
788
  """),
791
789
  ("Packages.props", """
792
790
  <Project>
793
791
  <ItemGroup>
794
- <PackageReference Update="Azure.Identity" Version="1.6.0" />
795
- <PackageReference Update="Microsoft.Data.SqlClient" Version="5.1.4" />
792
+ <PackageReference Update="Package.A" Version="1.6.0" />
793
+ <PackageReference Update="Package.B" Version="5.1.4" />
796
794
  </ItemGroup>
797
795
  </Project>
798
796
  """)
@@ -801,16 +799,21 @@ public class MSBuildHelperTests : TestBase
801
799
  new Dependency[]
802
800
  {
803
801
  new(
804
- "Azure.Identity",
802
+ "Package.A",
805
803
  "1.6.0",
806
804
  DependencyType.PackageReference,
807
805
  EvaluationResult: new(EvaluationResultType.Success, "1.6.0", "1.6.0", null, null)),
808
806
  new(
809
- "Microsoft.Data.SqlClient",
807
+ "Package.B",
810
808
  "5.1.4",
811
809
  DependencyType.PackageReference,
812
810
  EvaluationResult: new(EvaluationResultType.Success, "5.1.4", "5.1.4", null, null),
813
811
  IsUpdate: true),
812
+ },
813
+ new MockNuGetPackage[]
814
+ {
815
+ MockNuGetPackage.CreateSimplePackage("Package.A", "1.6.0", "net8.0"),
816
+ MockNuGetPackage.CreateSimplePackage("Package.B", "5.1.4", "net8.0"),
814
817
  }
815
818
  ];
816
819
  }