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.
- checksums.yaml +4 -4
- data/helpers/lib/NuGetUpdater/Directory.Packages.props +2 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/DiscoverCommand.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Discover.cs +255 -191
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Update.cs +63 -35
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs +107 -14
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +9 -5
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/PathHelper.cs +18 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTestBase.cs +6 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.DotNetToolsJson.cs +6 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.GlobalJson.cs +6 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.PackagesConfig.cs +11 -21
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Proj.cs +95 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Project.cs +204 -62
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs +64 -45
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/MockNuGetPackage.cs +419 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/NuGetUpdater.Core.Test.csproj +1 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TemporaryDirectory.cs +7 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +77 -19
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DirsProj.cs +120 -91
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DotNetTools.cs +132 -97
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.GlobalJson.cs +93 -75
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Mixed.cs +45 -42
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs +1089 -956
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Sdk.cs +1624 -1291
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +296 -293
- data/helpers/lib/NuGetUpdater/global.json +6 -0
- data/lib/dependabot/nuget/file_parser.rb +4 -5
- data/lib/dependabot/nuget/file_updater.rb +1 -1
- data/lib/dependabot/nuget/update_checker/dependency_finder.rb +7 -2
- data/lib/dependabot/nuget/update_checker/property_updater.rb +1 -0
- data/lib/dependabot/nuget/update_checker/version_finder.rb +2 -3
- data/lib/dependabot/nuget/update_checker.rb +1 -0
- metadata +8 -5
data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Project.cs
CHANGED
@@ -10,29 +10,27 @@ public partial class DiscoveryWorkerTests
|
|
10
10
|
public async Task ReturnsPackageReferencesMissingVersions()
|
11
11
|
{
|
12
12
|
await TestDiscoveryAsync(
|
13
|
+
packages: [],
|
13
14
|
workspacePath: "",
|
14
15
|
files: [
|
15
16
|
("myproj.csproj", """
|
16
17
|
<Project Sdk="Microsoft.NET.Sdk">
|
17
18
|
<PropertyGroup>
|
18
19
|
<Description>Nancy is a lightweight web framework for the .Net platform, inspired by Sinatra. Nancy aim at delivering a low ceremony approach to building light, fast web applications.</Description>
|
19
|
-
<TargetFrameworks>
|
20
|
+
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
|
20
21
|
</PropertyGroup>
|
21
22
|
|
22
23
|
<ItemGroup>
|
23
24
|
<EmbeddedResource Include="ErrorHandling\Resources\**\*.*;Diagnostics\Resources\**\*.*;Diagnostics\Views\**\*.*" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" />
|
24
25
|
</ItemGroup>
|
25
26
|
|
26
|
-
<ItemGroup Condition=" '$(TargetFramework)' == '
|
27
|
-
<PackageReference Include="
|
28
|
-
<PackageReference Include="
|
29
|
-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="" />
|
30
|
-
<PackageReference Include="Microsoft.Extensions.PlatformAbstractions" version="1.1.0"></PackageReference>
|
31
|
-
<PackageReference Include="System.Collections.Specialized"><Version>4.3.0</Version></PackageReference>
|
27
|
+
<ItemGroup Condition=" '$(TargetFramework)' == 'net7.0' ">
|
28
|
+
<PackageReference Include="Package.A" Version="1.1.1" />
|
29
|
+
<PackageReference Include="Package.B" />
|
32
30
|
</ItemGroup>
|
33
31
|
|
34
|
-
<ItemGroup Condition=" '$(TargetFramework)' == '
|
35
|
-
<Reference Include="
|
32
|
+
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
|
33
|
+
<Reference Include="Package.C" />
|
36
34
|
</ItemGroup>
|
37
35
|
</Project>
|
38
36
|
""")
|
@@ -44,44 +42,43 @@ public partial class DiscoveryWorkerTests
|
|
44
42
|
new()
|
45
43
|
{
|
46
44
|
FilePath = "myproj.csproj",
|
47
|
-
ExpectedDependencyCount =
|
45
|
+
ExpectedDependencyCount = 3,
|
48
46
|
Dependencies = [
|
49
|
-
new("Microsoft.Extensions.DependencyModel", "1.1.1", DependencyType.PackageReference, TargetFrameworks: ["net462", "netstandard1.6"], IsDirect: true),
|
50
|
-
new("Microsoft.AspNetCore.App", "", DependencyType.PackageReference, TargetFrameworks: ["net462", "netstandard1.6"], IsDirect: true),
|
51
|
-
new("Microsoft.NET.Test.Sdk", "", DependencyType.PackageReference, TargetFrameworks: ["net462", "netstandard1.6"], IsDirect: true),
|
52
47
|
new("Microsoft.NET.Sdk", null, DependencyType.MSBuildSdk),
|
53
|
-
new("
|
54
|
-
new("
|
48
|
+
new("Package.A", "1.1.1", DependencyType.PackageReference, TargetFrameworks: ["net7.0", "net8.0"], IsDirect: true),
|
49
|
+
new("Package.B", "", DependencyType.PackageReference, TargetFrameworks: ["net7.0", "net8.0"], IsDirect: true),
|
55
50
|
],
|
56
51
|
Properties = [
|
57
52
|
new("Description", "Nancy is a lightweight web framework for the .Net platform, inspired by Sinatra. Nancy aim at delivering a low ceremony approach to building light, fast web applications.", "myproj.csproj"),
|
58
|
-
new("TargetFrameworks", "
|
53
|
+
new("TargetFrameworks", "net7.0;net8.0", "myproj.csproj"),
|
59
54
|
],
|
60
|
-
TargetFrameworks = ["
|
55
|
+
TargetFrameworks = ["net7.0", "net8.0"],
|
61
56
|
ReferencedProjectPaths = [],
|
62
57
|
}
|
63
58
|
],
|
64
|
-
}
|
59
|
+
}
|
60
|
+
);
|
65
61
|
}
|
66
62
|
|
67
63
|
[Fact]
|
68
64
|
public async Task WithDirectoryPackagesProps()
|
69
65
|
{
|
70
66
|
await TestDiscoveryAsync(
|
67
|
+
packages: [],
|
71
68
|
workspacePath: "",
|
72
69
|
files: [
|
73
70
|
("myproj.csproj", """
|
74
71
|
<Project Sdk="Microsoft.NET.Sdk">
|
75
72
|
<PropertyGroup>
|
76
73
|
<Description>Nancy is a lightweight web framework for the .Net platform, inspired by Sinatra. Nancy aim at delivering a low ceremony approach to building light, fast web applications.</Description>
|
77
|
-
<TargetFrameworks>
|
74
|
+
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
|
78
75
|
</PropertyGroup>
|
79
76
|
|
80
77
|
<ItemGroup>
|
81
78
|
<EmbeddedResource Include="ErrorHandling\Resources\**\*.*;Diagnostics\Resources\**\*.*;Diagnostics\Views\**\*.*" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" />
|
82
79
|
</ItemGroup>
|
83
80
|
|
84
|
-
<ItemGroup Condition=" '$(TargetFramework)' == '
|
81
|
+
<ItemGroup Condition=" '$(TargetFramework)' == 'net7.0' ">
|
85
82
|
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="1.1.1" />
|
86
83
|
<PackageReference Include="Microsoft.AspNetCore.App" />
|
87
84
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="" />
|
@@ -89,11 +86,12 @@ public partial class DiscoveryWorkerTests
|
|
89
86
|
<PackageReference Include="System.Collections.Specialized"><Version>4.3.0</Version></PackageReference>
|
90
87
|
</ItemGroup>
|
91
88
|
|
92
|
-
<ItemGroup Condition=" '$(TargetFramework)' == '
|
89
|
+
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
|
93
90
|
<Reference Include="System.Xml" />
|
94
91
|
</ItemGroup>
|
95
92
|
</Project>
|
96
93
|
"""),
|
94
|
+
("Directory.Build.props", "<Project />"),
|
97
95
|
("Directory.Packages.props", """
|
98
96
|
<Project Sdk="Microsoft.NET.Sdk">
|
99
97
|
<PropertyGroup>
|
@@ -111,25 +109,26 @@ public partial class DiscoveryWorkerTests
|
|
111
109
|
expectedResult: new()
|
112
110
|
{
|
113
111
|
FilePath = "",
|
112
|
+
ExpectedProjectCount = 2,
|
114
113
|
Projects = [
|
115
114
|
new()
|
116
115
|
{
|
117
116
|
FilePath = "myproj.csproj",
|
118
|
-
ExpectedDependencyCount =
|
117
|
+
ExpectedDependencyCount = 6,
|
119
118
|
Dependencies = [
|
120
|
-
new("Microsoft.Extensions.DependencyModel", "1.1.1", DependencyType.PackageReference, TargetFrameworks: ["
|
121
|
-
new("Microsoft.AspNetCore.App", "", DependencyType.PackageReference, TargetFrameworks: ["
|
122
|
-
new("Microsoft.NET.Test.Sdk", "", DependencyType.PackageReference, TargetFrameworks: ["
|
119
|
+
new("Microsoft.Extensions.DependencyModel", "1.1.1", DependencyType.PackageReference, TargetFrameworks: ["net7.0", "net8.0"], IsDirect: true),
|
120
|
+
new("Microsoft.AspNetCore.App", "", DependencyType.PackageReference, TargetFrameworks: ["net7.0", "net8.0"], IsDirect: true),
|
121
|
+
new("Microsoft.NET.Test.Sdk", "", DependencyType.PackageReference, TargetFrameworks: ["net7.0", "net8.0"], IsDirect: true),
|
123
122
|
new("Microsoft.NET.Sdk", null, DependencyType.MSBuildSdk),
|
124
|
-
new("Microsoft.Extensions.PlatformAbstractions", "1.1.0", DependencyType.PackageReference, TargetFrameworks: ["
|
125
|
-
new("System.Collections.Specialized", "4.3.0", DependencyType.PackageReference, TargetFrameworks: ["
|
123
|
+
new("Microsoft.Extensions.PlatformAbstractions", "1.1.0", DependencyType.PackageReference, TargetFrameworks: ["net7.0", "net8.0"], IsDirect: true),
|
124
|
+
new("System.Collections.Specialized", "4.3.0", DependencyType.PackageReference, TargetFrameworks: ["net7.0", "net8.0"], IsDirect: true),
|
126
125
|
],
|
127
126
|
Properties = [
|
128
127
|
new("Description", "Nancy is a lightweight web framework for the .Net platform, inspired by Sinatra. Nancy aim at delivering a low ceremony approach to building light, fast web applications.", "myproj.csproj"),
|
129
128
|
new("ManagePackageVersionsCentrally", "true", "Directory.Packages.props"),
|
130
|
-
new("TargetFrameworks", "
|
129
|
+
new("TargetFrameworks", "net7.0;net8.0", "myproj.csproj"),
|
131
130
|
],
|
132
|
-
TargetFrameworks = ["
|
131
|
+
TargetFrameworks = ["net7.0", "net8.0"],
|
133
132
|
},
|
134
133
|
],
|
135
134
|
DirectoryPackagesProps = new()
|
@@ -143,13 +142,15 @@ public partial class DiscoveryWorkerTests
|
|
143
142
|
new("Microsoft.NET.Sdk", null, DependencyType.MSBuildSdk),
|
144
143
|
],
|
145
144
|
},
|
146
|
-
}
|
145
|
+
}
|
146
|
+
);
|
147
147
|
}
|
148
148
|
|
149
149
|
[Fact]
|
150
150
|
public async Task WithDirectoryBuildPropsAndTargets()
|
151
151
|
{
|
152
152
|
await TestDiscoveryAsync(
|
153
|
+
packages: [],
|
153
154
|
workspacePath: "",
|
154
155
|
files: [
|
155
156
|
("project.csproj", """
|
@@ -157,7 +158,7 @@ public partial class DiscoveryWorkerTests
|
|
157
158
|
|
158
159
|
<PropertyGroup>
|
159
160
|
<OutputType>Exe</OutputType>
|
160
|
-
<TargetFramework>
|
161
|
+
<TargetFramework>net7.0</TargetFramework>
|
161
162
|
<ImplicitUsings>enable</ImplicitUsings>
|
162
163
|
<Nullable>enable</Nullable>
|
163
164
|
</PropertyGroup>
|
@@ -195,16 +196,16 @@ public partial class DiscoveryWorkerTests
|
|
195
196
|
FilePath = "project.csproj",
|
196
197
|
ExpectedDependencyCount = 3,
|
197
198
|
Dependencies = [
|
198
|
-
new("NuGet.Versioning", "6.1.0", DependencyType.PackageReference, TargetFrameworks: ["
|
199
|
-
new("Microsoft.CodeAnalysis.Analyzers", "3.3.0", DependencyType.PackageReference, TargetFrameworks: ["
|
199
|
+
new("NuGet.Versioning", "6.1.0", DependencyType.PackageReference, TargetFrameworks: ["net7.0"], IsDirect: false),
|
200
|
+
new("Microsoft.CodeAnalysis.Analyzers", "3.3.0", DependencyType.PackageReference, TargetFrameworks: ["net7.0"], IsDirect: false),
|
200
201
|
],
|
201
202
|
Properties = [
|
202
203
|
new("ImplicitUsings", "enable", "project.csproj"),
|
203
204
|
new("Nullable", "enable", "project.csproj"),
|
204
205
|
new("OutputType", "Exe", "project.csproj"),
|
205
|
-
new("TargetFramework", "
|
206
|
+
new("TargetFramework", "net7.0", "project.csproj"),
|
206
207
|
],
|
207
|
-
TargetFrameworks = ["
|
208
|
+
TargetFrameworks = ["net7.0"],
|
208
209
|
},
|
209
210
|
new()
|
210
211
|
{
|
@@ -227,7 +228,8 @@ public partial class DiscoveryWorkerTests
|
|
227
228
|
TargetFrameworks = [],
|
228
229
|
},
|
229
230
|
],
|
230
|
-
}
|
231
|
+
}
|
232
|
+
);
|
231
233
|
}
|
232
234
|
|
233
235
|
[Fact]
|
@@ -247,20 +249,24 @@ public partial class DiscoveryWorkerTests
|
|
247
249
|
Environment.SetEnvironmentVariable("NUGET_HTTP_CACHE_PATH", tempNuGetHttpCacheDirectory);
|
248
250
|
|
249
251
|
await TestDiscoveryAsync(
|
252
|
+
packages:
|
253
|
+
[
|
254
|
+
MockNuGetPackage.CentralPackageVersionsPackage,
|
255
|
+
],
|
250
256
|
workspacePath: "",
|
251
257
|
files: [
|
252
258
|
("myproj.csproj", """
|
253
259
|
<Project Sdk="Microsoft.NET.Sdk">
|
254
260
|
<PropertyGroup>
|
255
261
|
<Description>Nancy is a lightweight web framework for the .Net platform, inspired by Sinatra. Nancy aim at delivering a low ceremony approach to building light, fast web applications.</Description>
|
256
|
-
<TargetFrameworks>
|
262
|
+
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
|
257
263
|
</PropertyGroup>
|
258
264
|
|
259
265
|
<ItemGroup>
|
260
266
|
<EmbeddedResource Include="ErrorHandling\Resources\**\*.*;Diagnostics\Resources\**\*.*;Diagnostics\Views\**\*.*" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" />
|
261
267
|
</ItemGroup>
|
262
268
|
|
263
|
-
<ItemGroup Condition=" '$(TargetFramework)' == '
|
269
|
+
<ItemGroup Condition=" '$(TargetFramework)' == 'net7.0' ">
|
264
270
|
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="1.1.1" />
|
265
271
|
<PackageReference Include="Microsoft.AspNetCore.App" />
|
266
272
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="" />
|
@@ -268,7 +274,7 @@ public partial class DiscoveryWorkerTests
|
|
268
274
|
<PackageReference Include="System.Collections.Specialized"><Version>4.3.0</Version></PackageReference>
|
269
275
|
</ItemGroup>
|
270
276
|
|
271
|
-
<ItemGroup Condition=" '$(TargetFramework)' == '
|
277
|
+
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
|
272
278
|
<Reference Include="System.Xml" />
|
273
279
|
</ItemGroup>
|
274
280
|
</Project>
|
@@ -294,25 +300,25 @@ public partial class DiscoveryWorkerTests
|
|
294
300
|
expectedResult: new()
|
295
301
|
{
|
296
302
|
FilePath = "",
|
297
|
-
ExpectedProjectCount =
|
303
|
+
ExpectedProjectCount = 5,
|
298
304
|
Projects = [
|
299
305
|
new()
|
300
306
|
{
|
301
307
|
FilePath = "myproj.csproj",
|
302
|
-
ExpectedDependencyCount =
|
308
|
+
ExpectedDependencyCount = 12,
|
303
309
|
Dependencies = [
|
304
|
-
new("Microsoft.Extensions.DependencyModel", "1.1.1", DependencyType.PackageReference, TargetFrameworks: ["
|
305
|
-
new("Microsoft.AspNetCore.App", "", DependencyType.PackageReference, TargetFrameworks: ["
|
306
|
-
new("Microsoft.NET.Test.Sdk", "", DependencyType.PackageReference, TargetFrameworks: ["
|
310
|
+
new("Microsoft.Extensions.DependencyModel", "1.1.1", DependencyType.PackageReference, TargetFrameworks: ["net7.0", "net8.0"], IsDirect: true),
|
311
|
+
new("Microsoft.AspNetCore.App", "", DependencyType.PackageReference, TargetFrameworks: ["net7.0", "net8.0"], IsDirect: true),
|
312
|
+
new("Microsoft.NET.Test.Sdk", "", DependencyType.PackageReference, TargetFrameworks: ["net7.0", "net8.0"], IsDirect: true),
|
307
313
|
new("Microsoft.NET.Sdk", null, DependencyType.MSBuildSdk),
|
308
|
-
new("Microsoft.Extensions.PlatformAbstractions", "1.1.0", DependencyType.PackageReference, TargetFrameworks: ["
|
309
|
-
new("System.Collections.Specialized", "4.3.0", DependencyType.PackageReference, TargetFrameworks: ["
|
314
|
+
new("Microsoft.Extensions.PlatformAbstractions", "1.1.0", DependencyType.PackageReference, TargetFrameworks: ["net7.0", "net8.0"], IsDirect: true),
|
315
|
+
new("System.Collections.Specialized", "4.3.0", DependencyType.PackageReference, TargetFrameworks: ["net7.0", "net8.0"], IsDirect: true),
|
310
316
|
],
|
311
317
|
Properties = [
|
312
318
|
new("Description", "Nancy is a lightweight web framework for the .Net platform, inspired by Sinatra. Nancy aim at delivering a low ceremony approach to building light, fast web applications.", "myproj.csproj"),
|
313
|
-
new("TargetFrameworks", "
|
319
|
+
new("TargetFrameworks", "net7.0;net8.0", "myproj.csproj"),
|
314
320
|
],
|
315
|
-
TargetFrameworks = ["
|
321
|
+
TargetFrameworks = ["net7.0", "net8.0"],
|
316
322
|
},
|
317
323
|
new()
|
318
324
|
{
|
@@ -327,7 +333,8 @@ public partial class DiscoveryWorkerTests
|
|
327
333
|
],
|
328
334
|
},
|
329
335
|
],
|
330
|
-
}
|
336
|
+
}
|
337
|
+
);
|
331
338
|
}
|
332
339
|
finally
|
333
340
|
{
|
@@ -341,6 +348,7 @@ public partial class DiscoveryWorkerTests
|
|
341
348
|
public async Task ReturnsDependenciesThatCannotBeEvaluated()
|
342
349
|
{
|
343
350
|
await TestDiscoveryAsync(
|
351
|
+
packages: [],
|
344
352
|
workspacePath: "",
|
345
353
|
files: [
|
346
354
|
("myproj.csproj", """
|
@@ -374,7 +382,8 @@ public partial class DiscoveryWorkerTests
|
|
374
382
|
ReferencedProjectPaths = [],
|
375
383
|
}
|
376
384
|
],
|
377
|
-
}
|
385
|
+
}
|
386
|
+
);
|
378
387
|
}
|
379
388
|
|
380
389
|
[Fact]
|
@@ -382,6 +391,7 @@ public partial class DiscoveryWorkerTests
|
|
382
391
|
public async Task NoDependenciesReturnedIfNoTargetFrameworkCanBeResolved()
|
383
392
|
{
|
384
393
|
await TestDiscoveryAsync(
|
394
|
+
packages: [],
|
385
395
|
workspacePath: "",
|
386
396
|
files: [
|
387
397
|
("myproj.csproj", """
|
@@ -399,23 +409,29 @@ public partial class DiscoveryWorkerTests
|
|
399
409
|
{
|
400
410
|
FilePath = "",
|
401
411
|
Projects = []
|
402
|
-
}
|
412
|
+
}
|
413
|
+
);
|
403
414
|
}
|
404
415
|
|
405
416
|
[Fact]
|
406
417
|
public async Task DiscoverReportsTransitivePackageVersionsWithFourPartsForMultipleTargetFrameworks()
|
407
418
|
{
|
408
419
|
await TestDiscoveryAsync(
|
420
|
+
packages:
|
421
|
+
[
|
422
|
+
new("Some.Package", "1.2.3.4", Files: [("lib/net7.0/Some.Package.dll", Array.Empty<byte>()), ("lib/net8.0/Some.Package.dll", Array.Empty<byte>())], DependencyGroups: [(null, [("Transitive.Dependency", "5.6.7.8")])]),
|
423
|
+
new("Transitive.Dependency", "5.6.7.8", Files: [("lib/net7.0/Transitive.Dependency.dll", Array.Empty<byte>()), ("lib/net8.0/Transitive.Dependency.dll", Array.Empty<byte>())]),
|
424
|
+
],
|
409
425
|
workspacePath: "",
|
410
426
|
files:
|
411
427
|
[
|
412
428
|
("myproj.csproj", """
|
413
429
|
<Project Sdk="Microsoft.NET.Sdk">
|
414
430
|
<PropertyGroup>
|
415
|
-
<TargetFrameworks>
|
431
|
+
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
|
416
432
|
</PropertyGroup>
|
417
433
|
<ItemGroup>
|
418
|
-
<PackageReference Include="
|
434
|
+
<PackageReference Include="Some.Package" Version="1.2.3.4" />
|
419
435
|
</ItemGroup>
|
420
436
|
</Project>
|
421
437
|
""")
|
@@ -427,24 +443,150 @@ public partial class DiscoveryWorkerTests
|
|
427
443
|
new()
|
428
444
|
{
|
429
445
|
FilePath = "myproj.csproj",
|
446
|
+
ExpectedDependencyCount = 3,
|
430
447
|
Dependencies = [
|
431
|
-
new("
|
432
|
-
new("
|
433
|
-
new("AWSSDK.Core", "3.7.303.27", DependencyType.Unknown, TargetFrameworks: ["net8.0", "netstandard2.0"], IsTransitive: true),
|
434
|
-
new("Microsoft.Bcl.AsyncInterfaces", "1.1.0", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
|
435
|
-
new("NETStandard.Library", "2.0.3", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
|
436
|
-
new("System.Runtime.CompilerServices.Unsafe", "4.5.2", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
|
437
|
-
new("System.Threading.Tasks.Extensions", "4.5.2", DependencyType.Unknown, TargetFrameworks: ["netstandard2.0"], IsTransitive: true),
|
448
|
+
new("Some.Package", "1.2.3.4", DependencyType.PackageReference, TargetFrameworks: ["net7.0", "net8.0"], IsDirect: true),
|
449
|
+
new("Transitive.Dependency", "5.6.7.8", DependencyType.Unknown, TargetFrameworks: ["net7.0", "net8.0"], IsTransitive: true),
|
438
450
|
],
|
439
451
|
Properties = [
|
440
|
-
new("TargetFrameworks", "
|
452
|
+
new("TargetFrameworks", "net7.0;net8.0", "myproj.csproj"),
|
441
453
|
],
|
442
|
-
TargetFrameworks = ["
|
454
|
+
TargetFrameworks = ["net7.0", "net8.0"],
|
443
455
|
ReferencedProjectPaths = [],
|
444
456
|
}
|
445
457
|
],
|
446
458
|
}
|
447
459
|
);
|
448
460
|
}
|
461
|
+
|
462
|
+
[Fact]
|
463
|
+
public async Task DiscoverReportsPackagesThroughProjectReferenceElements()
|
464
|
+
{
|
465
|
+
await TestDiscoveryAsync(
|
466
|
+
packages: [],
|
467
|
+
workspacePath: "test",
|
468
|
+
files:
|
469
|
+
[
|
470
|
+
("test/unit-tests.csproj", """
|
471
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
472
|
+
<PropertyGroup>
|
473
|
+
<TargetFramework>net8.0</TargetFramework>
|
474
|
+
</PropertyGroup>
|
475
|
+
<ItemGroup>
|
476
|
+
<ProjectReference Include="..\src\helpers.csproj" />
|
477
|
+
</ItemGroup>
|
478
|
+
<ItemGroup>
|
479
|
+
<PackageReference Include="Package.A" Version="1.2.3" />
|
480
|
+
</ItemGroup>
|
481
|
+
</Project>
|
482
|
+
"""),
|
483
|
+
("src/helpers.csproj", """
|
484
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
485
|
+
<PropertyGroup>
|
486
|
+
<TargetFramework>net8.0</TargetFramework>
|
487
|
+
</PropertyGroup>
|
488
|
+
<ItemGroup>
|
489
|
+
<PackageReference Include="Package.B" Version="4.5.6" />
|
490
|
+
</ItemGroup>
|
491
|
+
</Project>
|
492
|
+
""")
|
493
|
+
],
|
494
|
+
expectedResult: new()
|
495
|
+
{
|
496
|
+
FilePath = "test",
|
497
|
+
Projects = [
|
498
|
+
new()
|
499
|
+
{
|
500
|
+
FilePath = "unit-tests.csproj",
|
501
|
+
ExpectedDependencyCount = 2,
|
502
|
+
Dependencies = [
|
503
|
+
new("Package.A", "1.2.3", DependencyType.PackageReference, TargetFrameworks: ["net8.0"], IsDirect: true)
|
504
|
+
],
|
505
|
+
Properties = [
|
506
|
+
new("TargetFramework", "net8.0", @"test/unit-tests.csproj"),
|
507
|
+
],
|
508
|
+
TargetFrameworks = ["net8.0"],
|
509
|
+
ReferencedProjectPaths = [
|
510
|
+
"../src/helpers.csproj"
|
511
|
+
],
|
512
|
+
},
|
513
|
+
new()
|
514
|
+
{
|
515
|
+
FilePath = "../src/helpers.csproj",
|
516
|
+
ExpectedDependencyCount = 2,
|
517
|
+
Dependencies = [
|
518
|
+
new("Package.B", "4.5.6", DependencyType.PackageReference, TargetFrameworks: ["net8.0"], IsDirect: true)
|
519
|
+
],
|
520
|
+
Properties = [
|
521
|
+
new("TargetFramework", "net8.0", @"src/helpers.csproj"),
|
522
|
+
],
|
523
|
+
TargetFrameworks = ["net8.0"],
|
524
|
+
ReferencedProjectPaths = [],
|
525
|
+
}
|
526
|
+
]
|
527
|
+
}
|
528
|
+
);
|
529
|
+
}
|
530
|
+
|
531
|
+
[Fact]
|
532
|
+
public async Task DiscoverReportsPackagesThroughSolutionFilesNotInTheSameDirectoryTreeAsTheProjects()
|
533
|
+
{
|
534
|
+
await TestDiscoveryAsync(
|
535
|
+
packages: [],
|
536
|
+
workspacePath: "solutions",
|
537
|
+
files:
|
538
|
+
[
|
539
|
+
("solutions/sln.sln", """
|
540
|
+
Microsoft Visual Studio Solution File, Format Version 12.00
|
541
|
+
# Visual Studio Version 17
|
542
|
+
VisualStudioVersion = 17.5.33516.290
|
543
|
+
MinimumVisualStudioVersion = 10.0.40219.1
|
544
|
+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "library", "..\projects\library.csproj", "{DA55A30A-048A-4D8A-A3EC-4F2CF4B294B8}"
|
545
|
+
EndProject
|
546
|
+
Global
|
547
|
+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
548
|
+
Debug|Any CPU = Debug|Any CPU
|
549
|
+
Release|Any CPU = Release|Any CPU
|
550
|
+
EndGlobalSection
|
551
|
+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
552
|
+
{DA55A30A-048A-4D8A-A3EC-4F2CF4B294B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
553
|
+
{DA55A30A-048A-4D8A-A3EC-4F2CF4B294B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
554
|
+
{DA55A30A-048A-4D8A-A3EC-4F2CF4B294B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
555
|
+
{DA55A30A-048A-4D8A-A3EC-4F2CF4B294B8}.Release|Any CPU.Build.0 = Release|Any CPU
|
556
|
+
EndGlobalSection
|
557
|
+
EndGlobal
|
558
|
+
"""),
|
559
|
+
("projects/library.csproj", """
|
560
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
561
|
+
<PropertyGroup>
|
562
|
+
<TargetFramework>net8.0</TargetFramework>
|
563
|
+
</PropertyGroup>
|
564
|
+
<ItemGroup>
|
565
|
+
<PackageReference Include="Some.Package" Version="1.2.3" />
|
566
|
+
</ItemGroup>
|
567
|
+
</Project>
|
568
|
+
""")
|
569
|
+
],
|
570
|
+
expectedResult: new()
|
571
|
+
{
|
572
|
+
FilePath = "solutions",
|
573
|
+
Projects = [
|
574
|
+
new()
|
575
|
+
{
|
576
|
+
FilePath = "../projects/library.csproj",
|
577
|
+
ExpectedDependencyCount = 2,
|
578
|
+
Dependencies = [
|
579
|
+
new("Some.Package", "1.2.3", DependencyType.PackageReference, TargetFrameworks: ["net8.0"], IsDirect: true)
|
580
|
+
],
|
581
|
+
Properties = [
|
582
|
+
new("TargetFramework", "net8.0", @"projects/library.csproj"),
|
583
|
+
],
|
584
|
+
TargetFrameworks = ["net8.0"],
|
585
|
+
ReferencedProjectPaths = [],
|
586
|
+
}
|
587
|
+
]
|
588
|
+
}
|
589
|
+
);
|
590
|
+
}
|
449
591
|
}
|
450
592
|
}
|