dependabot-nuget 0.287.0 → 0.288.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/.gitignore +1 -0
- data/helpers/lib/NuGetUpdater/Directory.Build.targets +17 -0
- data/helpers/lib/NuGetUpdater/Directory.Packages.props +10 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/DiscoverCommand.cs +7 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/RunCommand.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Discover.cs +72 -51
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/AnalyzeWorker.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/DependencyDiscovery.props +7 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/DependencyDiscovery.targets +10 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs +36 -19
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/PackagesConfigDiscovery.cs +6 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/PackagesConfigDiscoveryResult.cs +2 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/ProjectDiscoveryResult.cs +5 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/SdkProjectDiscovery.cs +386 -12
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/WorkspaceDiscoveryResult.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/ExperimentsManager.cs +11 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/NuGetUpdater.Core.csproj +7 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/Job.cs +23 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs +0 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/TargetFrameworkReporter.targets +13 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/LockFileUpdater.cs +1 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackageReferenceUpdater.cs +2 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/CollectionExtensions.cs +17 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +57 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/PathComparer.cs +31 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/PathHelper.cs +30 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTests.cs +50 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTestBase.cs +74 -38
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.PackagesConfig.cs +50 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Proj.cs +5 -5
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Project.cs +728 -253
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs +322 -78
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/ExpectedDiscoveryResults.cs +2 -6
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/SdkProjectDiscoveryTests.cs +472 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/MockNuGetPackage.cs +46 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/NuGetUpdater.Core.Test.csproj +0 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/RunWorkerTests.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/SerializationTests.cs +33 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TemporaryDirectory.cs +3 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +4 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/PathHelperTests.cs +3 -2
- data/lib/dependabot/nuget/file_parser.rb +7 -1
- data/lib/dependabot/nuget/native_discovery/native_discovery_json_reader.rb +0 -3
- data/lib/dependabot/nuget/native_discovery/native_workspace_discovery.rb +7 -10
- data/lib/dependabot/nuget/native_helpers.rb +13 -4
- metadata +12 -8
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DirectoryPackagesPropsDiscovery.cs +0 -69
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DirectoryPackagesPropsDiscoveryResult.cs +0 -11
- data/lib/dependabot/nuget/native_discovery/native_directory_packages_props_discovery.rb +0 -44
data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Project.cs
CHANGED
@@ -7,33 +7,40 @@ public partial class DiscoveryWorkerTests
|
|
7
7
|
public class Projects : DiscoveryWorkerTestBase
|
8
8
|
{
|
9
9
|
[Fact]
|
10
|
-
public async Task
|
10
|
+
public async Task TargetFrameworksAreHonoredInConditions_DirectDiscovery()
|
11
11
|
{
|
12
12
|
await TestDiscoveryAsync(
|
13
|
-
|
13
|
+
experimentsManager: new ExperimentsManager() { UseDirectDiscovery = true },
|
14
|
+
packages:
|
15
|
+
[
|
16
|
+
MockNuGetPackage.CreateSimplePackage("Package.A", "1.0.0", "net7.0"),
|
17
|
+
MockNuGetPackage.CreateSimplePackage("Package.B", "2.0.0", "net7.0"),
|
18
|
+
],
|
14
19
|
workspacePath: "",
|
15
20
|
files: [
|
16
21
|
("myproj.csproj", """
|
17
22
|
<Project Sdk="Microsoft.NET.Sdk">
|
18
23
|
<PropertyGroup>
|
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>
|
20
24
|
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
|
21
25
|
</PropertyGroup>
|
22
|
-
|
23
|
-
<ItemGroup>
|
24
|
-
<EmbeddedResource Include="ErrorHandling\Resources\**\*.*;Diagnostics\Resources\**\*.*;Diagnostics\Views\**\*.*" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" />
|
25
|
-
</ItemGroup>
|
26
|
-
|
27
26
|
<ItemGroup Condition=" '$(TargetFramework)' == 'net7.0' ">
|
28
|
-
<PackageReference Include="Package.A"
|
27
|
+
<PackageReference Include="Package.A" />
|
29
28
|
<PackageReference Include="Package.B" />
|
30
29
|
</ItemGroup>
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
</Project>
|
31
|
+
"""),
|
32
|
+
("Directory.Build.props", "<Project />"),
|
33
|
+
("Directory.Packages.props", """
|
34
|
+
<Project>
|
35
|
+
<PropertyGroup>
|
36
|
+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
37
|
+
</PropertyGroup>
|
38
|
+
<ItemGroup>
|
39
|
+
<PackageVersion Include="Package.A" Version="1.0.0" />
|
40
|
+
<PackageVersion Include="Package.B" Version="2.0.0" />
|
34
41
|
</ItemGroup>
|
35
42
|
</Project>
|
36
|
-
""")
|
43
|
+
"""),
|
37
44
|
],
|
38
45
|
expectedResult: new()
|
39
46
|
{
|
@@ -42,66 +49,56 @@ public partial class DiscoveryWorkerTests
|
|
42
49
|
new()
|
43
50
|
{
|
44
51
|
FilePath = "myproj.csproj",
|
45
|
-
ExpectedDependencyCount = 3,
|
46
52
|
Dependencies = [
|
47
|
-
new("
|
48
|
-
new("Package.
|
49
|
-
new("Package.B", "", DependencyType.PackageReference, TargetFrameworks: ["net7.0", "net8.0"], IsDirect: true),
|
53
|
+
new("Package.A", "1.0.0", DependencyType.PackageReference, TargetFrameworks: ["net7.0"], IsDirect: true),
|
54
|
+
new("Package.B", "2.0.0", DependencyType.PackageReference, TargetFrameworks: ["net7.0"], IsDirect: true),
|
50
55
|
],
|
51
56
|
Properties = [
|
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"),
|
53
57
|
new("TargetFrameworks", "net7.0;net8.0", "myproj.csproj"),
|
54
58
|
],
|
55
|
-
TargetFrameworks = ["net7.0",
|
56
|
-
|
57
|
-
|
59
|
+
TargetFrameworks = ["net7.0"], // net8.0 has no packages and is not reported
|
60
|
+
},
|
61
|
+
],
|
62
|
+
ImportedFiles = [
|
63
|
+
"Directory.Build.props",
|
64
|
+
"Directory.Packages.props",
|
58
65
|
],
|
59
66
|
}
|
60
67
|
);
|
61
68
|
}
|
62
69
|
|
63
70
|
[Fact]
|
64
|
-
public async Task
|
71
|
+
public async Task TargetFrameworksAreHonoredInConditions_TemporaryProjectDiscovery()
|
65
72
|
{
|
66
73
|
await TestDiscoveryAsync(
|
67
|
-
|
74
|
+
experimentsManager: new ExperimentsManager() { UseDirectDiscovery = false },
|
75
|
+
packages:
|
76
|
+
[
|
77
|
+
MockNuGetPackage.CreateSimplePackage("Package.A", "1.0.0", "net7.0"),
|
78
|
+
MockNuGetPackage.CreateSimplePackage("Package.B", "2.0.0", "net7.0"),
|
79
|
+
],
|
68
80
|
workspacePath: "",
|
69
81
|
files: [
|
70
82
|
("myproj.csproj", """
|
71
83
|
<Project Sdk="Microsoft.NET.Sdk">
|
72
84
|
<PropertyGroup>
|
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>
|
74
85
|
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
|
75
86
|
</PropertyGroup>
|
76
|
-
|
77
|
-
<ItemGroup>
|
78
|
-
<EmbeddedResource Include="ErrorHandling\Resources\**\*.*;Diagnostics\Resources\**\*.*;Diagnostics\Views\**\*.*" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" />
|
79
|
-
</ItemGroup>
|
80
|
-
|
81
87
|
<ItemGroup Condition=" '$(TargetFramework)' == 'net7.0' ">
|
82
|
-
<PackageReference Include="
|
83
|
-
<PackageReference Include="
|
84
|
-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="" />
|
85
|
-
<PackageReference Include="Microsoft.Extensions.PlatformAbstractions" version="1.1.0"></PackageReference>
|
86
|
-
<PackageReference Include="System.Collections.Specialized"><Version>4.3.0</Version></PackageReference>
|
87
|
-
</ItemGroup>
|
88
|
-
|
89
|
-
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
|
90
|
-
<Reference Include="System.Xml" />
|
88
|
+
<PackageReference Include="Package.A" />
|
89
|
+
<PackageReference Include="Package.B" />
|
91
90
|
</ItemGroup>
|
92
91
|
</Project>
|
93
92
|
"""),
|
94
93
|
("Directory.Build.props", "<Project />"),
|
95
94
|
("Directory.Packages.props", """
|
96
|
-
<Project
|
95
|
+
<Project>
|
97
96
|
<PropertyGroup>
|
98
97
|
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
99
98
|
</PropertyGroup>
|
100
99
|
<ItemGroup>
|
101
|
-
<PackageVersion Include="
|
102
|
-
<PackageVersion Include="
|
103
|
-
<PackageVersion Include="System.Google" Version="0.1.0-beta.3" />
|
104
|
-
<PackageVersion Include="System.WebCrawler" Version="1.1.1" />
|
100
|
+
<PackageVersion Include="Package.A" Version="1.0.0" />
|
101
|
+
<PackageVersion Include="Package.B" Version="2.0.0" />
|
105
102
|
</ItemGroup>
|
106
103
|
</Project>
|
107
104
|
"""),
|
@@ -109,83 +106,476 @@ public partial class DiscoveryWorkerTests
|
|
109
106
|
expectedResult: new()
|
110
107
|
{
|
111
108
|
Path = "",
|
112
|
-
ExpectedProjectCount = 2,
|
113
109
|
Projects = [
|
114
110
|
new()
|
115
111
|
{
|
116
112
|
FilePath = "myproj.csproj",
|
117
|
-
ExpectedDependencyCount = 6,
|
118
113
|
Dependencies = [
|
119
|
-
new("
|
120
|
-
new("
|
121
|
-
new("Microsoft.NET.Test.Sdk", "", DependencyType.PackageReference, TargetFrameworks: ["net7.0", "net8.0"], IsDirect: true),
|
122
|
-
new("Microsoft.NET.Sdk", null, DependencyType.MSBuildSdk),
|
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),
|
114
|
+
new("Package.A", "1.0.0", DependencyType.PackageReference, TargetFrameworks: ["net7.0", "net8.0"], IsDirect: true),
|
115
|
+
new("Package.B", "2.0.0", DependencyType.PackageReference, TargetFrameworks: ["net7.0", "net8.0"], IsDirect: true),
|
125
116
|
],
|
126
117
|
Properties = [
|
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"),
|
128
118
|
new("ManagePackageVersionsCentrally", "true", "Directory.Packages.props"),
|
129
119
|
new("TargetFrameworks", "net7.0;net8.0", "myproj.csproj"),
|
130
120
|
],
|
131
121
|
TargetFrameworks = ["net7.0", "net8.0"],
|
132
122
|
},
|
133
123
|
],
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
new("System.Lycos", "3.23.3", DependencyType.PackageVersion, IsDirect: true),
|
139
|
-
new("System.AskJeeves", "2.2.2", DependencyType.PackageVersion, IsDirect: true),
|
140
|
-
new("System.Google", "0.1.0-beta.3", DependencyType.PackageVersion, IsDirect: true),
|
141
|
-
new("System.WebCrawler", "1.1.1", DependencyType.PackageVersion, IsDirect: true),
|
142
|
-
new("Microsoft.NET.Sdk", null, DependencyType.MSBuildSdk),
|
143
|
-
],
|
144
|
-
},
|
124
|
+
ImportedFiles = [
|
125
|
+
"Directory.Build.props",
|
126
|
+
"Directory.Packages.props",
|
127
|
+
],
|
145
128
|
}
|
146
129
|
);
|
147
130
|
}
|
148
131
|
|
149
132
|
[Fact]
|
150
|
-
public async Task
|
133
|
+
public async Task WithDirectoryBuildPropsAndTargets_DirectDiscovery()
|
151
134
|
{
|
152
135
|
await TestDiscoveryAsync(
|
153
|
-
|
136
|
+
experimentsManager: new ExperimentsManager() { UseDirectDiscovery = true },
|
137
|
+
packages:
|
138
|
+
[
|
139
|
+
MockNuGetPackage.CreateSimplePackage("Package.A", "1.2.3", "net8.0"),
|
140
|
+
MockNuGetPackage.CreateSimplePackage("Package.B", "4.5.6", "net8.0"),
|
141
|
+
],
|
154
142
|
workspacePath: "",
|
155
143
|
files: [
|
156
144
|
("project.csproj", """
|
157
145
|
<Project Sdk="Microsoft.NET.Sdk">
|
158
|
-
|
159
146
|
<PropertyGroup>
|
160
147
|
<OutputType>Exe</OutputType>
|
161
|
-
<TargetFramework>
|
148
|
+
<TargetFramework>net8.0</TargetFramework>
|
162
149
|
<ImplicitUsings>enable</ImplicitUsings>
|
163
150
|
<Nullable>enable</Nullable>
|
164
151
|
</PropertyGroup>
|
165
|
-
|
166
152
|
</Project>
|
167
153
|
"""),
|
168
154
|
("Directory.Build.props", """
|
169
155
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
170
|
-
|
171
156
|
<ItemGroup>
|
172
|
-
<PackageReference Include="
|
157
|
+
<PackageReference Include="Package.A" Version="1.2.3" />
|
173
158
|
</ItemGroup>
|
174
|
-
|
175
159
|
</Project>
|
176
160
|
"""),
|
177
161
|
("Directory.Build.targets", """
|
178
162
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
163
|
+
<ItemGroup>
|
164
|
+
<PackageReference Include="Package.B" Version="4.5.6">
|
165
|
+
<PrivateAssets>all</PrivateAssets>
|
166
|
+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
167
|
+
</PackageReference>
|
168
|
+
</ItemGroup>
|
169
|
+
</Project>
|
170
|
+
"""),
|
171
|
+
],
|
172
|
+
expectedResult: new()
|
173
|
+
{
|
174
|
+
Path = "",
|
175
|
+
Projects = [
|
176
|
+
new()
|
177
|
+
{
|
178
|
+
FilePath = "project.csproj",
|
179
|
+
Dependencies = [
|
180
|
+
new("Package.A", "1.2.3", DependencyType.PackageReference, TargetFrameworks: ["net8.0"], IsDirect: true),
|
181
|
+
new("Package.B", "4.5.6", DependencyType.PackageReference, TargetFrameworks: ["net8.0"], IsDirect: true),
|
182
|
+
],
|
183
|
+
Properties = [
|
184
|
+
new("ImplicitUsings", "enable", "project.csproj"),
|
185
|
+
new("Nullable", "enable", "project.csproj"),
|
186
|
+
new("OutputType", "Exe", "project.csproj"),
|
187
|
+
new("TargetFramework", "net8.0", "project.csproj"),
|
188
|
+
],
|
189
|
+
TargetFrameworks = ["net8.0"],
|
190
|
+
}
|
191
|
+
],
|
192
|
+
ImportedFiles = [
|
193
|
+
"Directory.Build.props",
|
194
|
+
"Directory.Build.targets"
|
195
|
+
],
|
196
|
+
}
|
197
|
+
);
|
198
|
+
}
|
179
199
|
|
200
|
+
[Fact]
|
201
|
+
public async Task WithDirectoryBuildPropsAndTargets_TemporaryProjectDiscovery()
|
202
|
+
{
|
203
|
+
await TestDiscoveryAsync(
|
204
|
+
experimentsManager: new ExperimentsManager() { UseDirectDiscovery = false },
|
205
|
+
packages:
|
206
|
+
[
|
207
|
+
MockNuGetPackage.CreateSimplePackage("Package.A", "1.2.3", "net8.0"),
|
208
|
+
MockNuGetPackage.CreateSimplePackage("Package.B", "4.5.6", "net8.0"),
|
209
|
+
],
|
210
|
+
workspacePath: "",
|
211
|
+
files: [
|
212
|
+
("project.csproj", """
|
213
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
214
|
+
<PropertyGroup>
|
215
|
+
<OutputType>Exe</OutputType>
|
216
|
+
<TargetFramework>net8.0</TargetFramework>
|
217
|
+
<ImplicitUsings>enable</ImplicitUsings>
|
218
|
+
<Nullable>enable</Nullable>
|
219
|
+
</PropertyGroup>
|
220
|
+
</Project>
|
221
|
+
"""),
|
222
|
+
("Directory.Build.props", """
|
223
|
+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
180
224
|
<ItemGroup>
|
181
|
-
<PackageReference Include="
|
225
|
+
<PackageReference Include="Package.A" Version="1.2.3" />
|
226
|
+
</ItemGroup>
|
227
|
+
</Project>
|
228
|
+
"""),
|
229
|
+
("Directory.Build.targets", """
|
230
|
+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
231
|
+
<ItemGroup>
|
232
|
+
<PackageReference Include="Package.B" Version="4.5.6">
|
182
233
|
<PrivateAssets>all</PrivateAssets>
|
183
234
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
184
235
|
</PackageReference>
|
185
236
|
</ItemGroup>
|
186
|
-
|
187
237
|
</Project>
|
188
|
-
"""),
|
238
|
+
"""),
|
239
|
+
],
|
240
|
+
expectedResult: new()
|
241
|
+
{
|
242
|
+
Path = "",
|
243
|
+
Projects = [
|
244
|
+
new()
|
245
|
+
{
|
246
|
+
FilePath = "project.csproj",
|
247
|
+
Dependencies = [
|
248
|
+
new("Package.A", "1.2.3", DependencyType.PackageReference, TargetFrameworks: ["net8.0"]),
|
249
|
+
new("Package.B", "4.5.6", DependencyType.PackageReference, TargetFrameworks: ["net8.0"]),
|
250
|
+
],
|
251
|
+
Properties = [
|
252
|
+
new("ImplicitUsings", "enable", "project.csproj"),
|
253
|
+
new("Nullable", "enable", "project.csproj"),
|
254
|
+
new("OutputType", "Exe", "project.csproj"),
|
255
|
+
new("TargetFramework", "net8.0", "project.csproj"),
|
256
|
+
],
|
257
|
+
TargetFrameworks = ["net8.0"],
|
258
|
+
}
|
259
|
+
],
|
260
|
+
ImportedFiles = [
|
261
|
+
"Directory.Build.props",
|
262
|
+
"Directory.Build.targets"
|
263
|
+
],
|
264
|
+
}
|
265
|
+
);
|
266
|
+
}
|
267
|
+
|
268
|
+
[Fact]
|
269
|
+
public async Task WithGlobalPackageReference_DirectDiscovery()
|
270
|
+
{
|
271
|
+
await TestDiscoveryAsync(
|
272
|
+
experimentsManager: new ExperimentsManager() { UseDirectDiscovery = true },
|
273
|
+
packages:
|
274
|
+
[
|
275
|
+
MockNuGetPackage.CreateSimplePackage("Global.Package", "1.2.3", "net8.0"),
|
276
|
+
],
|
277
|
+
workspacePath: "",
|
278
|
+
files:
|
279
|
+
[
|
280
|
+
("project.csproj", """
|
281
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
282
|
+
<PropertyGroup>
|
283
|
+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
284
|
+
<TargetFramework>net8.0</TargetFramework>
|
285
|
+
</PropertyGroup>
|
286
|
+
</Project>
|
287
|
+
"""),
|
288
|
+
("Directory.Packages.props", """
|
289
|
+
<Project>
|
290
|
+
<ItemGroup>
|
291
|
+
<GlobalPackageReference Include="Global.Package" Version="1.2.3" />
|
292
|
+
</ItemGroup>
|
293
|
+
</Project>
|
294
|
+
"""),
|
295
|
+
],
|
296
|
+
expectedResult: new()
|
297
|
+
{
|
298
|
+
Path = "",
|
299
|
+
Projects = [
|
300
|
+
new()
|
301
|
+
{
|
302
|
+
FilePath = "project.csproj",
|
303
|
+
Dependencies = [
|
304
|
+
new("Global.Package", "1.2.3", DependencyType.PackageReference, TargetFrameworks: ["net8.0"], IsDirect: true),
|
305
|
+
],
|
306
|
+
Properties = [
|
307
|
+
new("ManagePackageVersionsCentrally", "true", "project.csproj"),
|
308
|
+
new("TargetFramework", "net8.0", "project.csproj"),
|
309
|
+
],
|
310
|
+
TargetFrameworks = ["net8.0"],
|
311
|
+
},
|
312
|
+
],
|
313
|
+
ImportedFiles = [
|
314
|
+
"Directory.Packages.props",
|
315
|
+
]
|
316
|
+
}
|
317
|
+
);
|
318
|
+
}
|
319
|
+
|
320
|
+
[Fact]
|
321
|
+
public async Task WithGlobalPackageReference_TemporaryProjectDiscovery()
|
322
|
+
{
|
323
|
+
await TestDiscoveryAsync(
|
324
|
+
experimentsManager: new ExperimentsManager() { UseDirectDiscovery = false },
|
325
|
+
packages:
|
326
|
+
[
|
327
|
+
MockNuGetPackage.CreateSimplePackage("Global.Package", "1.2.3", "net8.0"),
|
328
|
+
],
|
329
|
+
workspacePath: "",
|
330
|
+
files:
|
331
|
+
[
|
332
|
+
("project.csproj", """
|
333
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
334
|
+
<PropertyGroup>
|
335
|
+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
336
|
+
<TargetFramework>net8.0</TargetFramework>
|
337
|
+
</PropertyGroup>
|
338
|
+
</Project>
|
339
|
+
"""),
|
340
|
+
("Directory.Packages.props", """
|
341
|
+
<Project>
|
342
|
+
<ItemGroup>
|
343
|
+
<GlobalPackageReference Include="Global.Package" Version="1.2.3" />
|
344
|
+
</ItemGroup>
|
345
|
+
</Project>
|
346
|
+
"""),
|
347
|
+
],
|
348
|
+
expectedResult: new()
|
349
|
+
{
|
350
|
+
Path = "",
|
351
|
+
Projects = [
|
352
|
+
new()
|
353
|
+
{
|
354
|
+
FilePath = "project.csproj",
|
355
|
+
Dependencies = [
|
356
|
+
new("Global.Package", "1.2.3", DependencyType.GlobalPackageReference, TargetFrameworks: ["net8.0"]),
|
357
|
+
],
|
358
|
+
Properties = [
|
359
|
+
new("ManagePackageVersionsCentrally", "true", "project.csproj"),
|
360
|
+
new("TargetFramework", "net8.0", "project.csproj"),
|
361
|
+
],
|
362
|
+
TargetFrameworks = ["net8.0"],
|
363
|
+
},
|
364
|
+
],
|
365
|
+
ImportedFiles = [
|
366
|
+
"Directory.Packages.props",
|
367
|
+
]
|
368
|
+
}
|
369
|
+
);
|
370
|
+
}
|
371
|
+
|
372
|
+
[Fact]
|
373
|
+
public async Task WithPackagesProps_DirectDiscovery()
|
374
|
+
{
|
375
|
+
await TestDiscoveryAsync(
|
376
|
+
experimentsManager: new ExperimentsManager() { UseDirectDiscovery = true },
|
377
|
+
packages:
|
378
|
+
[
|
379
|
+
MockNuGetPackage.CentralPackageVersionsPackage,
|
380
|
+
MockNuGetPackage.CreateSimplePackage("Package.A", "1.2.3", "net7.0"),
|
381
|
+
MockNuGetPackage.CreateSimplePackage("Package.B", "4.5.6", "net7.0"),
|
382
|
+
MockNuGetPackage.CreateSimplePackage("Global.Package", "7.8.9", "net7.0"),
|
383
|
+
],
|
384
|
+
workspacePath: "",
|
385
|
+
files: [
|
386
|
+
("myproj.csproj", """
|
387
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
388
|
+
<PropertyGroup>
|
389
|
+
<TargetFramework>net7.0</TargetFramework>
|
390
|
+
</PropertyGroup>
|
391
|
+
<ItemGroup>
|
392
|
+
<PackageReference Include="Package.A" Version="1.2.3" />
|
393
|
+
<PackageReference Include="Package.B" />
|
394
|
+
</ItemGroup>
|
395
|
+
</Project>
|
396
|
+
"""),
|
397
|
+
("Packages.props", """
|
398
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
399
|
+
<ItemGroup>
|
400
|
+
<GlobalPackageReference Include="Global.Package" Version="7.8.9" />
|
401
|
+
<PackageReference Update="@(GlobalPackageReference)" PrivateAssets="Build" />
|
402
|
+
<PackageReference Update="Package.B" Version="4.5.6" />
|
403
|
+
</ItemGroup>
|
404
|
+
</Project>
|
405
|
+
"""),
|
406
|
+
("Directory.Build.targets", """
|
407
|
+
<Project>
|
408
|
+
<!-- this forces `Packages.props` to be imported -->
|
409
|
+
<Sdk Name="Microsoft.Build.CentralPackageVersions" Version="2.1.3" />
|
410
|
+
</Project>
|
411
|
+
"""),
|
412
|
+
],
|
413
|
+
expectedResult: new()
|
414
|
+
{
|
415
|
+
Path = "",
|
416
|
+
Projects = [
|
417
|
+
new()
|
418
|
+
{
|
419
|
+
FilePath = "myproj.csproj",
|
420
|
+
Dependencies = [
|
421
|
+
new("Package.A", "1.2.3", DependencyType.PackageReference, TargetFrameworks: ["net7.0"], IsDirect: true),
|
422
|
+
new("Package.B", "4.5.6", DependencyType.PackageReference, TargetFrameworks: ["net7.0"], IsDirect: true),
|
423
|
+
new("Global.Package", "7.8.9", DependencyType.PackageReference, TargetFrameworks: ["net7.0"], IsDirect: true),
|
424
|
+
],
|
425
|
+
Properties = [
|
426
|
+
new("TargetFramework", "net7.0", "myproj.csproj"),
|
427
|
+
],
|
428
|
+
TargetFrameworks = ["net7.0"],
|
429
|
+
},
|
430
|
+
],
|
431
|
+
ImportedFiles = [
|
432
|
+
"Directory.Build.targets",
|
433
|
+
"NUGET_PACKAGES/microsoft.build.centralpackageversions/2.1.3/Sdk/Sdk.props", // this is an artifact of the package cache existing next to the csproj
|
434
|
+
"NUGET_PACKAGES/microsoft.build.centralpackageversions/2.1.3/Sdk/Sdk.targets", // this is an artifact of the package cache existing next to the csproj
|
435
|
+
"Packages.props",
|
436
|
+
]
|
437
|
+
}
|
438
|
+
);
|
439
|
+
}
|
440
|
+
|
441
|
+
[Fact]
|
442
|
+
public async Task WithPackagesProps_TemporaryProjectDiscovery()
|
443
|
+
{
|
444
|
+
await TestDiscoveryAsync(
|
445
|
+
experimentsManager: new ExperimentsManager() { UseDirectDiscovery = false },
|
446
|
+
packages:
|
447
|
+
[
|
448
|
+
MockNuGetPackage.CentralPackageVersionsPackage,
|
449
|
+
MockNuGetPackage.CreateSimplePackage("Package.A", "1.2.3", "net7.0"),
|
450
|
+
MockNuGetPackage.CreateSimplePackage("Package.B", "4.5.6", "net7.0"),
|
451
|
+
MockNuGetPackage.CreateSimplePackage("Global.Package", "7.8.9", "net7.0"),
|
452
|
+
],
|
453
|
+
workspacePath: "",
|
454
|
+
files: [
|
455
|
+
("myproj.csproj", """
|
456
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
457
|
+
<PropertyGroup>
|
458
|
+
<TargetFramework>net7.0</TargetFramework>
|
459
|
+
</PropertyGroup>
|
460
|
+
<ItemGroup>
|
461
|
+
<PackageReference Include="Package.A" Version="1.2.3" />
|
462
|
+
<PackageReference Include="Package.B" />
|
463
|
+
</ItemGroup>
|
464
|
+
</Project>
|
465
|
+
"""),
|
466
|
+
("Packages.props", """
|
467
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
468
|
+
<ItemGroup>
|
469
|
+
<GlobalPackageReference Include="Global.Package" Version="7.8.9" />
|
470
|
+
<PackageReference Update="@(GlobalPackageReference)" PrivateAssets="Build" />
|
471
|
+
<PackageReference Update="Package.B" Version="4.5.6" />
|
472
|
+
</ItemGroup>
|
473
|
+
</Project>
|
474
|
+
"""),
|
475
|
+
("Directory.Build.targets", """
|
476
|
+
<Project>
|
477
|
+
<!-- this forces `Packages.props` to be imported -->
|
478
|
+
<Sdk Name="Microsoft.Build.CentralPackageVersions" Version="2.1.3" />
|
479
|
+
</Project>
|
480
|
+
"""),
|
481
|
+
],
|
482
|
+
expectedResult: new()
|
483
|
+
{
|
484
|
+
Path = "",
|
485
|
+
Projects = [
|
486
|
+
new()
|
487
|
+
{
|
488
|
+
FilePath = "myproj.csproj",
|
489
|
+
ExpectedDependencyCount = 4,
|
490
|
+
Dependencies = [
|
491
|
+
new("Package.A", "1.2.3", DependencyType.PackageReference, TargetFrameworks: ["net7.0"], IsDirect: true),
|
492
|
+
new("Package.B", "4.5.6", DependencyType.PackageReference, TargetFrameworks: ["net7.0"], IsDirect: true),
|
493
|
+
new("Global.Package", "7.8.9", DependencyType.GlobalPackageReference, TargetFrameworks: ["net7.0"]),
|
494
|
+
],
|
495
|
+
Properties = [
|
496
|
+
new("TargetFramework", "net7.0", "myproj.csproj"),
|
497
|
+
],
|
498
|
+
TargetFrameworks = ["net7.0"],
|
499
|
+
},
|
500
|
+
],
|
501
|
+
ImportedFiles = [
|
502
|
+
"Directory.Build.targets",
|
503
|
+
"NUGET_PACKAGES/microsoft.build.centralpackageversions/2.1.3/Sdk/Sdk.props", // this is an artifact of the package cache existing next to the csproj
|
504
|
+
"NUGET_PACKAGES/microsoft.build.centralpackageversions/2.1.3/Sdk/Sdk.targets", // this is an artifact of the package cache existing next to the csproj
|
505
|
+
"Packages.props",
|
506
|
+
]
|
507
|
+
}
|
508
|
+
);
|
509
|
+
}
|
510
|
+
|
511
|
+
[Fact]
|
512
|
+
public async Task ReturnsDependenciesThatCannotBeEvaluated_DirectDiscovery()
|
513
|
+
{
|
514
|
+
await TestDiscoveryAsync(
|
515
|
+
experimentsManager: new ExperimentsManager() { UseDirectDiscovery = true },
|
516
|
+
packages:
|
517
|
+
[
|
518
|
+
MockNuGetPackage.CreateSimplePackage("Package.A", "1.2.3", "net8.0"),
|
519
|
+
MockNuGetPackage.CreateSimplePackage("Package.B", "4.5.6", "net8.0"),
|
520
|
+
],
|
521
|
+
workspacePath: "",
|
522
|
+
files: [
|
523
|
+
("myproj.csproj", """
|
524
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
525
|
+
<PropertyGroup>
|
526
|
+
<TargetFramework>net8.0</TargetFramework>
|
527
|
+
</PropertyGroup>
|
528
|
+
<ItemGroup>
|
529
|
+
<PackageReference Include="Package.A" Version="1.2.3" />
|
530
|
+
<PackageReference Include="Package.B" Version="$(ThisPropertyCannotBeResolved)" />
|
531
|
+
</ItemGroup>
|
532
|
+
</Project>
|
533
|
+
""")
|
534
|
+
],
|
535
|
+
expectedResult: new()
|
536
|
+
{
|
537
|
+
Path = "",
|
538
|
+
Projects = [
|
539
|
+
new()
|
540
|
+
{
|
541
|
+
FilePath = "myproj.csproj",
|
542
|
+
Dependencies = [
|
543
|
+
new("Package.A", "1.2.3", DependencyType.PackageReference, TargetFrameworks: ["net8.0"], IsDirect: true),
|
544
|
+
new("Package.B", "4.5.6", DependencyType.PackageReference, TargetFrameworks: ["net8.0"], IsDirect: true),
|
545
|
+
],
|
546
|
+
Properties = [
|
547
|
+
new("TargetFramework", "net8.0", "myproj.csproj"),
|
548
|
+
],
|
549
|
+
TargetFrameworks = ["net8.0"],
|
550
|
+
}
|
551
|
+
],
|
552
|
+
}
|
553
|
+
);
|
554
|
+
}
|
555
|
+
|
556
|
+
[Fact]
|
557
|
+
public async Task ReturnsDependenciesThatCannotBeEvaluated_TemporaryProjectDiscovery()
|
558
|
+
{
|
559
|
+
await TestDiscoveryAsync(
|
560
|
+
experimentsManager: new ExperimentsManager() { UseDirectDiscovery = false },
|
561
|
+
packages:
|
562
|
+
[
|
563
|
+
MockNuGetPackage.CreateSimplePackage("Package.A", "1.2.3", "net8.0"),
|
564
|
+
MockNuGetPackage.CreateSimplePackage("Package.B", "4.5.6", "net8.0"),
|
565
|
+
],
|
566
|
+
workspacePath: "",
|
567
|
+
files: [
|
568
|
+
("myproj.csproj", """
|
569
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
570
|
+
<PropertyGroup>
|
571
|
+
<TargetFramework>net8.0</TargetFramework>
|
572
|
+
</PropertyGroup>
|
573
|
+
<ItemGroup>
|
574
|
+
<PackageReference Include="Package.A" Version="1.2.3" />
|
575
|
+
<PackageReference Include="Package.B" Version="$(ThisPropertyCannotBeResolved)" />
|
576
|
+
</ItemGroup>
|
577
|
+
</Project>
|
578
|
+
""")
|
189
579
|
],
|
190
580
|
expectedResult: new()
|
191
581
|
{
|
@@ -193,174 +583,48 @@ public partial class DiscoveryWorkerTests
|
|
193
583
|
Projects = [
|
194
584
|
new()
|
195
585
|
{
|
196
|
-
FilePath = "
|
197
|
-
ExpectedDependencyCount =
|
586
|
+
FilePath = "myproj.csproj",
|
587
|
+
ExpectedDependencyCount = 2,
|
198
588
|
Dependencies = [
|
199
|
-
new("
|
200
|
-
new("Microsoft.CodeAnalysis.Analyzers", "3.3.0", DependencyType.PackageReference, TargetFrameworks: ["net7.0"], IsDirect: false),
|
589
|
+
new("Package.A", "1.2.3", DependencyType.PackageReference, TargetFrameworks: ["net8.0"], IsDirect: true),
|
201
590
|
],
|
202
591
|
Properties = [
|
203
|
-
new("
|
204
|
-
new("Nullable", "enable", "project.csproj"),
|
205
|
-
new("OutputType", "Exe", "project.csproj"),
|
206
|
-
new("TargetFramework", "net7.0", "project.csproj"),
|
207
|
-
],
|
208
|
-
TargetFrameworks = ["net7.0"],
|
209
|
-
},
|
210
|
-
new()
|
211
|
-
{
|
212
|
-
FilePath = "Directory.Build.props",
|
213
|
-
ExpectedDependencyCount = 1,
|
214
|
-
Dependencies = [
|
215
|
-
new("NuGet.Versioning", "6.1.0", DependencyType.PackageReference, IsDirect: true),
|
216
|
-
],
|
217
|
-
Properties = [],
|
218
|
-
TargetFrameworks = [],
|
219
|
-
},
|
220
|
-
new()
|
221
|
-
{
|
222
|
-
FilePath = "Directory.Build.targets",
|
223
|
-
ExpectedDependencyCount = 1,
|
224
|
-
Dependencies = [
|
225
|
-
new("Microsoft.CodeAnalysis.Analyzers", "3.3.0", DependencyType.PackageReference, IsDirect: true),
|
592
|
+
new("TargetFramework", "net8.0", "myproj.csproj"),
|
226
593
|
],
|
227
|
-
|
228
|
-
|
229
|
-
},
|
594
|
+
TargetFrameworks = ["net8.0"],
|
595
|
+
}
|
230
596
|
],
|
231
597
|
}
|
232
598
|
);
|
233
599
|
}
|
234
600
|
|
235
601
|
[Fact]
|
236
|
-
public async Task
|
237
|
-
{
|
238
|
-
var nugetPackagesDirectory = Environment.GetEnvironmentVariable("NUGET_PACKAGES");
|
239
|
-
var nugetHttpCacheDirectory = Environment.GetEnvironmentVariable("NUGET_HTTP_CACHE_PATH");
|
240
|
-
|
241
|
-
try
|
242
|
-
{
|
243
|
-
using var temp = new TemporaryDirectory();
|
244
|
-
|
245
|
-
// It is important to have empty NuGet caches for this test, so override them with temp directories.
|
246
|
-
var tempNuGetPackagesDirectory = Path.Combine(temp.DirectoryPath, ".nuget", "packages");
|
247
|
-
Environment.SetEnvironmentVariable("NUGET_PACKAGES", tempNuGetPackagesDirectory);
|
248
|
-
var tempNuGetHttpCacheDirectory = Path.Combine(temp.DirectoryPath, ".nuget", "v3-cache");
|
249
|
-
Environment.SetEnvironmentVariable("NUGET_HTTP_CACHE_PATH", tempNuGetHttpCacheDirectory);
|
250
|
-
|
251
|
-
await TestDiscoveryAsync(
|
252
|
-
packages:
|
253
|
-
[
|
254
|
-
MockNuGetPackage.CentralPackageVersionsPackage,
|
255
|
-
],
|
256
|
-
workspacePath: "",
|
257
|
-
files: [
|
258
|
-
("myproj.csproj", """
|
259
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
260
|
-
<PropertyGroup>
|
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>
|
262
|
-
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
|
263
|
-
</PropertyGroup>
|
264
|
-
|
265
|
-
<ItemGroup>
|
266
|
-
<EmbeddedResource Include="ErrorHandling\Resources\**\*.*;Diagnostics\Resources\**\*.*;Diagnostics\Views\**\*.*" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" />
|
267
|
-
</ItemGroup>
|
268
|
-
|
269
|
-
<ItemGroup Condition=" '$(TargetFramework)' == 'net7.0' ">
|
270
|
-
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="1.1.1" />
|
271
|
-
<PackageReference Include="Microsoft.AspNetCore.App" />
|
272
|
-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="" />
|
273
|
-
<PackageReference Include="Microsoft.Extensions.PlatformAbstractions" version="1.1.0"></PackageReference>
|
274
|
-
<PackageReference Include="System.Collections.Specialized"><Version>4.3.0</Version></PackageReference>
|
275
|
-
</ItemGroup>
|
276
|
-
|
277
|
-
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
|
278
|
-
<Reference Include="System.Xml" />
|
279
|
-
</ItemGroup>
|
280
|
-
</Project>
|
281
|
-
"""),
|
282
|
-
("Packages.props", """
|
283
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
284
|
-
<ItemGroup>
|
285
|
-
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-19367-01" />
|
286
|
-
<PackageReference Update="@(GlobalPackageReference)" PrivateAssets="Build" />
|
287
|
-
<PackageReference Update="System.Lycos" Version="3.23.3" />
|
288
|
-
<PackageReference Update="System.AskJeeves" Version="2.2.2" />
|
289
|
-
<PackageReference Update="System.Google" Version="0.1.0-beta.3" />
|
290
|
-
<PackageReference Update="System.WebCrawler" Version="1.1.1" />
|
291
|
-
</ItemGroup>
|
292
|
-
</Project>
|
293
|
-
"""),
|
294
|
-
("Directory.Build.targets", """
|
295
|
-
<Project>
|
296
|
-
<Sdk Name="Microsoft.Build.CentralPackageVersions" Version="2.1.3" />
|
297
|
-
</Project>
|
298
|
-
"""),
|
299
|
-
],
|
300
|
-
expectedResult: new()
|
301
|
-
{
|
302
|
-
Path = "",
|
303
|
-
ExpectedProjectCount = 5,
|
304
|
-
Projects = [
|
305
|
-
new()
|
306
|
-
{
|
307
|
-
FilePath = "myproj.csproj",
|
308
|
-
ExpectedDependencyCount = 12,
|
309
|
-
Dependencies = [
|
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),
|
313
|
-
new("Microsoft.NET.Sdk", null, DependencyType.MSBuildSdk),
|
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),
|
316
|
-
],
|
317
|
-
Properties = [
|
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"),
|
319
|
-
new("TargetFrameworks", "net7.0;net8.0", "myproj.csproj"),
|
320
|
-
],
|
321
|
-
TargetFrameworks = ["net7.0", "net8.0"],
|
322
|
-
},
|
323
|
-
new()
|
324
|
-
{
|
325
|
-
FilePath = "Packages.props",
|
326
|
-
Dependencies = [
|
327
|
-
new("Microsoft.SourceLink.GitHub", "1.0.0-beta2-19367-01", DependencyType.GlobalPackageReference, IsDirect: true),
|
328
|
-
new("System.Lycos", "3.23.3", DependencyType.PackageReference, IsDirect: true, IsUpdate: true),
|
329
|
-
new("System.AskJeeves", "2.2.2", DependencyType.PackageReference, IsDirect: true, IsUpdate: true),
|
330
|
-
new("System.Google", "0.1.0-beta.3", DependencyType.PackageReference, IsDirect: true, IsUpdate: true),
|
331
|
-
new("System.WebCrawler", "1.1.1", DependencyType.PackageReference, IsDirect: true, IsUpdate: true),
|
332
|
-
new("Microsoft.NET.Sdk", null, DependencyType.MSBuildSdk),
|
333
|
-
],
|
334
|
-
},
|
335
|
-
],
|
336
|
-
}
|
337
|
-
);
|
338
|
-
}
|
339
|
-
finally
|
340
|
-
{
|
341
|
-
// Restore the NuGet caches.
|
342
|
-
Environment.SetEnvironmentVariable("NUGET_PACKAGES", nugetPackagesDirectory);
|
343
|
-
Environment.SetEnvironmentVariable("NUGET_HTTP_CACHE_PATH", nugetHttpCacheDirectory);
|
344
|
-
}
|
345
|
-
}
|
346
|
-
|
347
|
-
[Fact]
|
348
|
-
public async Task ReturnsDependenciesThatCannotBeEvaluated()
|
602
|
+
public async Task TargetFrameworkCanBeResolvedFromImplicitlyImportedFile_DirectDiscovery()
|
349
603
|
{
|
350
604
|
await TestDiscoveryAsync(
|
351
|
-
|
605
|
+
experimentsManager: new ExperimentsManager() { UseDirectDiscovery = true },
|
606
|
+
packages:
|
607
|
+
[
|
608
|
+
MockNuGetPackage.CreateSimplePackage("Package.A", "1.2.3", "net8.0"),
|
609
|
+
],
|
352
610
|
workspacePath: "",
|
353
611
|
files: [
|
354
612
|
("myproj.csproj", """
|
355
613
|
<Project Sdk="Microsoft.NET.Sdk">
|
356
614
|
<PropertyGroup>
|
357
|
-
<TargetFramework
|
615
|
+
<TargetFramework>$(SomeTfm)</TargetFramework>
|
358
616
|
</PropertyGroup>
|
359
617
|
<ItemGroup>
|
360
618
|
<PackageReference Include="Package.A" Version="1.2.3" />
|
361
|
-
<PackageReference Include="Package.B" Version="$(ThisPropertyCannotBeResolved)" />
|
362
619
|
</ItemGroup>
|
363
620
|
</Project>
|
621
|
+
"""),
|
622
|
+
("Directory.Build.props", """
|
623
|
+
<Project>
|
624
|
+
<PropertyGroup>
|
625
|
+
<SomeTfm>net8.0</SomeTfm>
|
626
|
+
</PropertyGroup>
|
627
|
+
</Project>
|
364
628
|
""")
|
365
629
|
],
|
366
630
|
expectedResult: new()
|
@@ -371,26 +635,28 @@ public partial class DiscoveryWorkerTests
|
|
371
635
|
{
|
372
636
|
FilePath = "myproj.csproj",
|
373
637
|
Dependencies = [
|
374
|
-
new("Microsoft.NET.Sdk", null, DependencyType.MSBuildSdk),
|
375
638
|
new("Package.A", "1.2.3", DependencyType.PackageReference, TargetFrameworks: ["net8.0"], IsDirect: true),
|
376
|
-
new("Package.B", "$(ThisPropertyCannotBeResolved)", DependencyType.PackageReference, TargetFrameworks: ["net8.0"], IsDirect: true),
|
377
639
|
],
|
378
640
|
Properties = [
|
379
641
|
new("TargetFramework", "net8.0", "myproj.csproj"),
|
380
642
|
],
|
381
643
|
TargetFrameworks = ["net8.0"],
|
382
|
-
ReferencedProjectPaths = [],
|
383
644
|
}
|
384
645
|
],
|
646
|
+
ImportedFiles = ["Directory.Build.props"],
|
385
647
|
}
|
386
648
|
);
|
387
649
|
}
|
388
650
|
|
389
651
|
[Fact]
|
390
|
-
public async Task
|
652
|
+
public async Task TargetFrameworkCanBeResolvedFromImplicitlyImportedFile_TemporaryProjectDiscovery()
|
391
653
|
{
|
392
654
|
await TestDiscoveryAsync(
|
393
|
-
|
655
|
+
experimentsManager: new ExperimentsManager() { UseDirectDiscovery = false },
|
656
|
+
packages:
|
657
|
+
[
|
658
|
+
MockNuGetPackage.CreateSimplePackage("Package.A", "1.2.3", "net8.0"),
|
659
|
+
],
|
394
660
|
workspacePath: "",
|
395
661
|
files: [
|
396
662
|
("myproj.csproj", """
|
@@ -415,15 +681,9 @@ public partial class DiscoveryWorkerTests
|
|
415
681
|
{
|
416
682
|
Path = "",
|
417
683
|
Projects = [
|
418
|
-
new()
|
419
|
-
{
|
420
|
-
FilePath = "Directory.Build.props",
|
421
|
-
Dependencies = [],
|
422
|
-
},
|
423
684
|
new()
|
424
685
|
{
|
425
686
|
FilePath = "myproj.csproj",
|
426
|
-
ExpectedDependencyCount = 2,
|
427
687
|
Dependencies = [
|
428
688
|
new("Package.A", "1.2.3", DependencyType.PackageReference, TargetFrameworks: ["net8.0"], IsDirect: true),
|
429
689
|
],
|
@@ -432,18 +692,21 @@ public partial class DiscoveryWorkerTests
|
|
432
692
|
new("TargetFramework", "$(SomeTfm)", "myproj.csproj"),
|
433
693
|
],
|
434
694
|
TargetFrameworks = ["net8.0"],
|
435
|
-
ReferencedProjectPaths = [],
|
436
695
|
}
|
437
|
-
]
|
696
|
+
],
|
697
|
+
ImportedFiles = ["Directory.Build.props"],
|
438
698
|
}
|
439
699
|
);
|
440
700
|
}
|
441
701
|
|
442
|
-
[
|
702
|
+
[Theory]
|
703
|
+
[InlineData(true)]
|
704
|
+
[InlineData(false)]
|
443
705
|
|
444
|
-
public async Task NoDependenciesReturnedIfNoTargetFrameworkCanBeResolved()
|
706
|
+
public async Task NoDependenciesReturnedIfNoTargetFrameworkCanBeResolved(bool useDirectDiscovery)
|
445
707
|
{
|
446
708
|
await TestDiscoveryAsync(
|
709
|
+
experimentsManager: new ExperimentsManager() { UseDirectDiscovery = useDirectDiscovery },
|
447
710
|
packages: [],
|
448
711
|
workspacePath: "",
|
449
712
|
files: [
|
@@ -467,10 +730,14 @@ public partial class DiscoveryWorkerTests
|
|
467
730
|
}
|
468
731
|
|
469
732
|
[Fact]
|
470
|
-
public async Task
|
733
|
+
public async Task WildcardVersionNumberIsResolved()
|
471
734
|
{
|
472
735
|
await TestDiscoveryAsync(
|
473
|
-
|
736
|
+
experimentsManager: new ExperimentsManager() { UseDirectDiscovery = true },
|
737
|
+
packages:
|
738
|
+
[
|
739
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "1.2.3", "net8.0"),
|
740
|
+
],
|
474
741
|
workspacePath: "",
|
475
742
|
files: [
|
476
743
|
("myproj.csproj", """
|
@@ -491,15 +758,13 @@ public partial class DiscoveryWorkerTests
|
|
491
758
|
new()
|
492
759
|
{
|
493
760
|
FilePath = "myproj.csproj",
|
494
|
-
ExpectedDependencyCount = 2,
|
495
761
|
Dependencies = [
|
496
|
-
new("Some.Package", "1
|
762
|
+
new("Some.Package", "1.2.3", DependencyType.PackageReference, TargetFrameworks: ["net8.0"], IsDirect: true),
|
497
763
|
],
|
498
764
|
Properties = [
|
499
765
|
new("TargetFramework", "net8.0", "myproj.csproj"),
|
500
766
|
],
|
501
767
|
TargetFrameworks = ["net8.0"],
|
502
|
-
ReferencedProjectPaths = [],
|
503
768
|
}
|
504
769
|
]
|
505
770
|
}
|
@@ -507,9 +772,57 @@ public partial class DiscoveryWorkerTests
|
|
507
772
|
}
|
508
773
|
|
509
774
|
[Fact]
|
510
|
-
public async Task
|
775
|
+
public async Task DiscoverReportsTransitivePackageVersionsWithFourPartsForMultipleTargetFrameworks_DirectDiscovery()
|
776
|
+
{
|
777
|
+
await TestDiscoveryAsync(
|
778
|
+
experimentsManager: new ExperimentsManager() { UseDirectDiscovery = true },
|
779
|
+
packages:
|
780
|
+
[
|
781
|
+
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")])]),
|
782
|
+
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>())]),
|
783
|
+
],
|
784
|
+
workspacePath: "",
|
785
|
+
files:
|
786
|
+
[
|
787
|
+
("myproj.csproj", """
|
788
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
789
|
+
<PropertyGroup>
|
790
|
+
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
|
791
|
+
</PropertyGroup>
|
792
|
+
<ItemGroup>
|
793
|
+
<PackageReference Include="Some.Package" Version="1.2.3.4" />
|
794
|
+
</ItemGroup>
|
795
|
+
</Project>
|
796
|
+
""")
|
797
|
+
],
|
798
|
+
expectedResult: new()
|
799
|
+
{
|
800
|
+
Path = "",
|
801
|
+
Projects = [
|
802
|
+
new()
|
803
|
+
{
|
804
|
+
FilePath = "myproj.csproj",
|
805
|
+
Dependencies = [
|
806
|
+
new("Some.Package", "1.2.3.4", DependencyType.PackageReference, TargetFrameworks: ["net7.0"], IsDirect: true),
|
807
|
+
new("Some.Package", "1.2.3.4", DependencyType.PackageReference, TargetFrameworks: ["net8.0"], IsDirect: true),
|
808
|
+
new("Transitive.Dependency", "5.6.7.8", DependencyType.Unknown, TargetFrameworks: ["net7.0"], IsTransitive: true),
|
809
|
+
new("Transitive.Dependency", "5.6.7.8", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true),
|
810
|
+
],
|
811
|
+
Properties = [
|
812
|
+
new("TargetFrameworks", "net7.0;net8.0", "myproj.csproj"),
|
813
|
+
],
|
814
|
+
TargetFrameworks = ["net7.0", "net8.0"],
|
815
|
+
}
|
816
|
+
],
|
817
|
+
}
|
818
|
+
);
|
819
|
+
}
|
820
|
+
|
821
|
+
[Fact]
|
822
|
+
public async Task DiscoverReportsTransitivePackageVersionsWithFourPartsForMultipleTargetFrameworks_TemporaryProjectDiscovery()
|
511
823
|
{
|
512
824
|
await TestDiscoveryAsync(
|
825
|
+
experimentsManager: new ExperimentsManager() { UseDirectDiscovery = false },
|
513
826
|
packages:
|
514
827
|
[
|
515
828
|
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")])]),
|
@@ -536,7 +849,6 @@ public partial class DiscoveryWorkerTests
|
|
536
849
|
new()
|
537
850
|
{
|
538
851
|
FilePath = "myproj.csproj",
|
539
|
-
ExpectedDependencyCount = 3,
|
540
852
|
Dependencies = [
|
541
853
|
new("Some.Package", "1.2.3.4", DependencyType.PackageReference, TargetFrameworks: ["net7.0", "net8.0"], IsDirect: true),
|
542
854
|
new("Transitive.Dependency", "5.6.7.8", DependencyType.Unknown, TargetFrameworks: ["net7.0", "net8.0"], IsTransitive: true),
|
@@ -545,7 +857,6 @@ public partial class DiscoveryWorkerTests
|
|
545
857
|
new("TargetFrameworks", "net7.0;net8.0", "myproj.csproj"),
|
546
858
|
],
|
547
859
|
TargetFrameworks = ["net7.0", "net8.0"],
|
548
|
-
ReferencedProjectPaths = [],
|
549
860
|
}
|
550
861
|
],
|
551
862
|
}
|
@@ -553,10 +864,15 @@ public partial class DiscoveryWorkerTests
|
|
553
864
|
}
|
554
865
|
|
555
866
|
[Fact]
|
556
|
-
public async Task
|
867
|
+
public async Task DiscoverReportsPackagesThroughProjectReferenceElements_DirectDiscovery()
|
557
868
|
{
|
558
869
|
await TestDiscoveryAsync(
|
559
|
-
|
870
|
+
experimentsManager: new ExperimentsManager() { UseDirectDiscovery = true },
|
871
|
+
packages:
|
872
|
+
[
|
873
|
+
MockNuGetPackage.CreateSimplePackage("Package.A", "1.2.3", "net8.0"),
|
874
|
+
MockNuGetPackage.CreateSimplePackage("Package.B", "4.5.6", "net8.0"),
|
875
|
+
],
|
560
876
|
workspacePath: "test",
|
561
877
|
files:
|
562
878
|
[
|
@@ -591,22 +907,92 @@ public partial class DiscoveryWorkerTests
|
|
591
907
|
new()
|
592
908
|
{
|
593
909
|
FilePath = "unit-tests.csproj",
|
594
|
-
ExpectedDependencyCount = 2,
|
595
910
|
Dependencies = [
|
596
|
-
new("Package.A", "1.2.3", DependencyType.PackageReference, TargetFrameworks: ["net8.0"], IsDirect: true)
|
911
|
+
new("Package.A", "1.2.3", DependencyType.PackageReference, TargetFrameworks: ["net8.0"], IsDirect: true),
|
912
|
+
new("Package.B", "4.5.6", DependencyType.Unknown, TargetFrameworks: ["net8.0"], IsTransitive: true)
|
913
|
+
],
|
914
|
+
ReferencedProjectPaths = [
|
915
|
+
"../src/helpers.csproj",
|
597
916
|
],
|
598
917
|
Properties = [
|
599
918
|
new("TargetFramework", "net8.0", @"test/unit-tests.csproj"),
|
600
919
|
],
|
601
920
|
TargetFrameworks = ["net8.0"],
|
921
|
+
},
|
922
|
+
new()
|
923
|
+
{
|
924
|
+
FilePath = "../src/helpers.csproj",
|
925
|
+
Dependencies = [
|
926
|
+
new("Package.B", "4.5.6", DependencyType.PackageReference, TargetFrameworks: ["net8.0"], IsDirect: true)
|
927
|
+
],
|
928
|
+
Properties = [
|
929
|
+
new("TargetFramework", "net8.0", @"src/helpers.csproj"),
|
930
|
+
],
|
931
|
+
TargetFrameworks = ["net8.0"],
|
932
|
+
}
|
933
|
+
]
|
934
|
+
}
|
935
|
+
);
|
936
|
+
}
|
937
|
+
|
938
|
+
[Fact]
|
939
|
+
public async Task DiscoverReportsPackagesThroughProjectReferenceElements_TemporaryProjectDiscovery()
|
940
|
+
{
|
941
|
+
await TestDiscoveryAsync(
|
942
|
+
experimentsManager: new ExperimentsManager() { UseDirectDiscovery = false },
|
943
|
+
packages:
|
944
|
+
[
|
945
|
+
MockNuGetPackage.CreateSimplePackage("Package.A", "1.2.3", "net8.0"),
|
946
|
+
MockNuGetPackage.CreateSimplePackage("Package.B", "4.5.6", "net8.0"),
|
947
|
+
],
|
948
|
+
workspacePath: "test",
|
949
|
+
files:
|
950
|
+
[
|
951
|
+
("test/unit-tests.csproj", """
|
952
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
953
|
+
<PropertyGroup>
|
954
|
+
<TargetFramework>net8.0</TargetFramework>
|
955
|
+
</PropertyGroup>
|
956
|
+
<ItemGroup>
|
957
|
+
<ProjectReference Include="..\src\helpers.csproj" />
|
958
|
+
</ItemGroup>
|
959
|
+
<ItemGroup>
|
960
|
+
<PackageReference Include="Package.A" Version="1.2.3" />
|
961
|
+
</ItemGroup>
|
962
|
+
</Project>
|
963
|
+
"""),
|
964
|
+
("src/helpers.csproj", """
|
965
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
966
|
+
<PropertyGroup>
|
967
|
+
<TargetFramework>net8.0</TargetFramework>
|
968
|
+
</PropertyGroup>
|
969
|
+
<ItemGroup>
|
970
|
+
<PackageReference Include="Package.B" Version="4.5.6" />
|
971
|
+
</ItemGroup>
|
972
|
+
</Project>
|
973
|
+
""")
|
974
|
+
],
|
975
|
+
expectedResult: new()
|
976
|
+
{
|
977
|
+
Path = "test",
|
978
|
+
Projects = [
|
979
|
+
new()
|
980
|
+
{
|
981
|
+
FilePath = "unit-tests.csproj",
|
982
|
+
Dependencies = [
|
983
|
+
new("Package.A", "1.2.3", DependencyType.PackageReference, TargetFrameworks: ["net8.0"], IsDirect: true)
|
984
|
+
],
|
602
985
|
ReferencedProjectPaths = [
|
603
|
-
"../src/helpers.csproj"
|
986
|
+
"../src/helpers.csproj",
|
604
987
|
],
|
988
|
+
Properties = [
|
989
|
+
new("TargetFramework", "net8.0", @"test/unit-tests.csproj"),
|
990
|
+
],
|
991
|
+
TargetFrameworks = ["net8.0"],
|
605
992
|
},
|
606
993
|
new()
|
607
994
|
{
|
608
995
|
FilePath = "../src/helpers.csproj",
|
609
|
-
ExpectedDependencyCount = 2,
|
610
996
|
Dependencies = [
|
611
997
|
new("Package.B", "4.5.6", DependencyType.PackageReference, TargetFrameworks: ["net8.0"], IsDirect: true)
|
612
998
|
],
|
@@ -614,7 +1000,6 @@ public partial class DiscoveryWorkerTests
|
|
614
1000
|
new("TargetFramework", "net8.0", @"src/helpers.csproj"),
|
615
1001
|
],
|
616
1002
|
TargetFrameworks = ["net8.0"],
|
617
|
-
ReferencedProjectPaths = [],
|
618
1003
|
}
|
619
1004
|
]
|
620
1005
|
}
|
@@ -625,7 +1010,10 @@ public partial class DiscoveryWorkerTests
|
|
625
1010
|
public async Task DiscoverReportsPackagesThroughSolutionFilesNotInTheSameDirectoryTreeAsTheProjects()
|
626
1011
|
{
|
627
1012
|
await TestDiscoveryAsync(
|
628
|
-
packages:
|
1013
|
+
packages:
|
1014
|
+
[
|
1015
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "1.2.3", "net8.0"),
|
1016
|
+
],
|
629
1017
|
workspacePath: "solutions",
|
630
1018
|
files:
|
631
1019
|
[
|
@@ -667,7 +1055,6 @@ public partial class DiscoveryWorkerTests
|
|
667
1055
|
new()
|
668
1056
|
{
|
669
1057
|
FilePath = "../projects/library.csproj",
|
670
|
-
ExpectedDependencyCount = 2,
|
671
1058
|
Dependencies = [
|
672
1059
|
new("Some.Package", "1.2.3", DependencyType.PackageReference, TargetFrameworks: ["net8.0"], IsDirect: true)
|
673
1060
|
],
|
@@ -675,7 +1062,95 @@ public partial class DiscoveryWorkerTests
|
|
675
1062
|
new("TargetFramework", "net8.0", @"projects/library.csproj"),
|
676
1063
|
],
|
677
1064
|
TargetFrameworks = ["net8.0"],
|
678
|
-
|
1065
|
+
}
|
1066
|
+
]
|
1067
|
+
}
|
1068
|
+
);
|
1069
|
+
}
|
1070
|
+
|
1071
|
+
[Fact]
|
1072
|
+
public async Task DiscoveryWithTargetPlaformVersion_DirectDiscovery()
|
1073
|
+
{
|
1074
|
+
await TestDiscoveryAsync(
|
1075
|
+
experimentsManager: new ExperimentsManager() { UseDirectDiscovery = true },
|
1076
|
+
packages:
|
1077
|
+
[
|
1078
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "1.2.3", "net8.0"),
|
1079
|
+
],
|
1080
|
+
workspacePath: "src",
|
1081
|
+
files:
|
1082
|
+
[
|
1083
|
+
("src/project.csproj", """
|
1084
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
1085
|
+
<PropertyGroup>
|
1086
|
+
<TargetFrameworks>net8.0-ios;net8.0-android;net8.0-macos;net8.0-maccatalyst</TargetFrameworks>
|
1087
|
+
</PropertyGroup>
|
1088
|
+
<ItemGroup>
|
1089
|
+
<PackageReference Include="Some.Package" Version="1.2.3" />
|
1090
|
+
</ItemGroup>
|
1091
|
+
</Project>
|
1092
|
+
"""),
|
1093
|
+
],
|
1094
|
+
expectedResult: new()
|
1095
|
+
{
|
1096
|
+
Path = "src",
|
1097
|
+
Projects = [
|
1098
|
+
new()
|
1099
|
+
{
|
1100
|
+
FilePath = "project.csproj",
|
1101
|
+
Dependencies = [
|
1102
|
+
new("Some.Package", "1.2.3", DependencyType.PackageReference, TargetFrameworks: ["net8.0-android"], IsDirect: true),
|
1103
|
+
new("Some.Package", "1.2.3", DependencyType.PackageReference, TargetFrameworks: ["net8.0-ios"], IsDirect: true),
|
1104
|
+
new("Some.Package", "1.2.3", DependencyType.PackageReference, TargetFrameworks: ["net8.0-maccatalyst"], IsDirect: true),
|
1105
|
+
new("Some.Package", "1.2.3", DependencyType.PackageReference, TargetFrameworks: ["net8.0-macos"], IsDirect: true),
|
1106
|
+
],
|
1107
|
+
Properties = [
|
1108
|
+
new("TargetFrameworks", "net8.0-ios;net8.0-android;net8.0-macos;net8.0-maccatalyst", @"src/project.csproj"),
|
1109
|
+
],
|
1110
|
+
TargetFrameworks = ["net8.0-android", "net8.0-ios", "net8.0-maccatalyst", "net8.0-macos"],
|
1111
|
+
}
|
1112
|
+
]
|
1113
|
+
}
|
1114
|
+
);
|
1115
|
+
}
|
1116
|
+
|
1117
|
+
[Fact]
|
1118
|
+
public async Task DiscoveryWithTargetPlaformVersion_TemporaryProjectDiscovery()
|
1119
|
+
{
|
1120
|
+
await TestDiscoveryAsync(
|
1121
|
+
experimentsManager: new ExperimentsManager() { UseDirectDiscovery = false },
|
1122
|
+
packages:
|
1123
|
+
[
|
1124
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "1.2.3", "net8.0"),
|
1125
|
+
],
|
1126
|
+
workspacePath: "src",
|
1127
|
+
files:
|
1128
|
+
[
|
1129
|
+
("src/project.csproj", """
|
1130
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
1131
|
+
<PropertyGroup>
|
1132
|
+
<TargetFrameworks>net8.0-ios;net8.0-android;net8.0-macos;net8.0-maccatalyst</TargetFrameworks>
|
1133
|
+
</PropertyGroup>
|
1134
|
+
<ItemGroup>
|
1135
|
+
<PackageReference Include="Some.Package" Version="1.2.3" />
|
1136
|
+
</ItemGroup>
|
1137
|
+
</Project>
|
1138
|
+
"""),
|
1139
|
+
],
|
1140
|
+
expectedResult: new()
|
1141
|
+
{
|
1142
|
+
Path = "src",
|
1143
|
+
Projects = [
|
1144
|
+
new()
|
1145
|
+
{
|
1146
|
+
FilePath = "project.csproj",
|
1147
|
+
Dependencies = [
|
1148
|
+
new("Some.Package", "1.2.3", DependencyType.PackageReference, TargetFrameworks: ["net8.0-android", "net8.0-ios", "net8.0-maccatalyst", "net8.0-macos"], IsDirect: true)
|
1149
|
+
],
|
1150
|
+
Properties = [
|
1151
|
+
new("TargetFrameworks", "net8.0-ios;net8.0-android;net8.0-macos;net8.0-maccatalyst", @"src/project.csproj"),
|
1152
|
+
],
|
1153
|
+
TargetFrameworks = ["net8.0-android", "net8.0-ios", "net8.0-maccatalyst", "net8.0-macos"],
|
679
1154
|
}
|
680
1155
|
]
|
681
1156
|
}
|