Skip to content

Commit ec6ee53

Browse files
fix: fix supported dotnet versions on v3 (#254)
1 parent c1a633f commit ec6ee53

File tree

7 files changed

+454
-1
lines changed

7 files changed

+454
-1
lines changed

lib/nuget-parser/index.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ import {
3737

3838
const debug = debugModule('snyk');
3939

40+
const PROJECTSDK = 'Microsoft.NET.Sdk';
41+
4042
const PARSERS = {
4143
'dotnet-core': {
4244
depParser: dotnetCoreParser,
@@ -366,10 +368,24 @@ Will attempt to build dependency graph anyway, but the operation might fail.`);
366368
);
367369
}
368370
}
371+
369372
// If a specific targetFramework has been requested, only query that, otherwise try to do them all
370373
const decidedTargetFrameworks = targetFramework
371374
? [targetFramework]
372375
: targetFrameworks.filter((framework) => {
376+
// Passing a const value as the project sdk. Why? The targetFile it's project.assets.json, which gets generated
377+
// only for the sdk style projects. The assets file won't get generated for projects which rely on packages.config.
378+
// The reason behind deciding to call this method is because maybe in the future we want to not support some specific
379+
// target frameworks.
380+
if (useImprovedDotnetWithoutPublish) {
381+
if (
382+
!depsParser.isSupportedByV3GraphGeneration(framework, PROJECTSDK)
383+
) {
384+
return false;
385+
}
386+
return true;
387+
}
388+
373389
if (!depsParser.isSupportedByV2GraphGeneration(framework)) {
374390
console.warn(
375391
`\x1b[33m⚠ WARNING\x1b[0m: The runtime resolution flag is currently only supported for the following TargetFrameworks: .NET versions 6 and higher, all versions of .NET Core and all versions of .NET Standard. Detected a TargetFramework: \x1b[1m${framework}\x1b[0m, which will be skipped.`,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"@snyk/cli-interface": "^2.14.0",
4141
"@snyk/dep-graph": "^2.8.1",
4242
"debug": "^4.3.4",
43-
"dotnet-deps-parser": "5.8.0",
43+
"dotnet-deps-parser": "6.0.0",
4444
"jszip": "3.10.1",
4545
"lodash": "^4.17.21",
4646
"node-cache": "^5.1.2",
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
{
2+
"depGraph": {
3+
"schemaVersion": "1.3.0",
4+
"pkgManager": {
5+
"name": "nuget"
6+
},
7+
"pkgs": [
8+
{
9+
10+
"info": {
11+
"name": "simple-net48",
12+
"version": "1.0.0"
13+
}
14+
},
15+
{
16+
17+
"info": {
18+
"name": "Microsoft.NETFramework.ReferenceAssemblies",
19+
"version": "1.0.3"
20+
}
21+
},
22+
{
23+
24+
"info": {
25+
"name": "Microsoft.NETFramework.ReferenceAssemblies.net48",
26+
"version": "1.0.3"
27+
}
28+
},
29+
{
30+
31+
"info": {
32+
"name": "NSubstitute",
33+
"version": "4.3.0"
34+
}
35+
},
36+
{
37+
38+
"info": {
39+
"name": "Castle.Core",
40+
"version": "4.4.1"
41+
}
42+
},
43+
{
44+
45+
"info": {
46+
"name": "System.Threading.Tasks.Extensions",
47+
"version": "4.8.0"
48+
}
49+
}
50+
],
51+
"graph": {
52+
"rootNodeId": "root-node",
53+
"nodes": [
54+
{
55+
"nodeId": "root-node",
56+
"pkgId": "[email protected]",
57+
"deps": [
58+
{
59+
"nodeId": "[email protected]"
60+
},
61+
{
62+
"nodeId": "[email protected]"
63+
}
64+
]
65+
},
66+
{
67+
"nodeId": "[email protected]",
68+
"pkgId": "[email protected]",
69+
"deps": [
70+
{
71+
"nodeId": "[email protected]"
72+
}
73+
]
74+
},
75+
{
76+
"nodeId": "[email protected]",
77+
"pkgId": "[email protected]",
78+
"deps": []
79+
},
80+
{
81+
"nodeId": "[email protected]",
82+
"pkgId": "[email protected]",
83+
"deps": [
84+
{
85+
"nodeId": "[email protected]"
86+
},
87+
{
88+
"nodeId": "[email protected]"
89+
}
90+
]
91+
},
92+
{
93+
"nodeId": "[email protected]",
94+
"pkgId": "[email protected]",
95+
"deps": []
96+
},
97+
{
98+
"nodeId": "[email protected]",
99+
"pkgId": "[email protected]",
100+
"deps": []
101+
}
102+
]
103+
}
104+
}
105+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<OutputType>Exe</OutputType>
4+
<TargetFramework>net48</TargetFramework>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<PackageReference Include="NSubstitute" Version="4.3.0" />
9+
</ItemGroup>
10+
</Project>
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
{
2+
"depGraph": {
3+
"schemaVersion": "1.3.0",
4+
"pkgManager": {
5+
"name": "nuget"
6+
},
7+
"pkgs": [
8+
{
9+
10+
"info": {
11+
"name": "target-framework-utf16le",
12+
"version": "1.0.0"
13+
}
14+
},
15+
{
16+
17+
"info": {
18+
"name": "Microsoft.NETFramework.ReferenceAssemblies",
19+
"version": "1.0.3"
20+
}
21+
},
22+
{
23+
24+
"info": {
25+
"name": "Microsoft.NETFramework.ReferenceAssemblies.net462",
26+
"version": "1.0.3"
27+
}
28+
},
29+
{
30+
31+
"info": {
32+
"name": "System.Data.SQLite",
33+
"version": "1.0.108"
34+
}
35+
},
36+
{
37+
38+
"info": {
39+
"name": "System.Data.SQLite.Core",
40+
"version": "1.0.108"
41+
}
42+
},
43+
{
44+
45+
"info": {
46+
"name": "System.Data.SQLite.EF6",
47+
"version": "1.0.108"
48+
}
49+
},
50+
{
51+
52+
"info": {
53+
"name": "EntityFramework",
54+
"version": "6.0.0"
55+
}
56+
},
57+
{
58+
59+
"info": {
60+
"name": "System.Data.SQLite.Linq",
61+
"version": "1.0.108"
62+
}
63+
}
64+
],
65+
"graph": {
66+
"rootNodeId": "root-node",
67+
"nodes": [
68+
{
69+
"nodeId": "root-node",
70+
"pkgId": "[email protected]",
71+
"deps": [
72+
{
73+
"nodeId": "[email protected]"
74+
},
75+
{
76+
"nodeId": "[email protected]"
77+
}
78+
]
79+
},
80+
{
81+
"nodeId": "[email protected]",
82+
"pkgId": "[email protected]",
83+
"deps": [
84+
{
85+
"nodeId": "[email protected]"
86+
}
87+
]
88+
},
89+
{
90+
"nodeId": "[email protected]",
91+
"pkgId": "[email protected]",
92+
"deps": []
93+
},
94+
{
95+
"nodeId": "[email protected]",
96+
"pkgId": "[email protected]",
97+
"deps": [
98+
{
99+
"nodeId": "[email protected]"
100+
},
101+
{
102+
"nodeId": "[email protected]"
103+
},
104+
{
105+
"nodeId": "[email protected]"
106+
}
107+
]
108+
},
109+
{
110+
"nodeId": "[email protected]",
111+
"pkgId": "[email protected]",
112+
"deps": []
113+
},
114+
{
115+
"nodeId": "[email protected]",
116+
"pkgId": "[email protected]",
117+
"deps": [
118+
{
119+
"nodeId": "[email protected]"
120+
}
121+
]
122+
},
123+
{
124+
"nodeId": "[email protected]",
125+
"pkgId": "[email protected]",
126+
"deps": []
127+
},
128+
{
129+
"nodeId": "[email protected]",
130+
"pkgId": "[email protected]",
131+
"deps": []
132+
}
133+
]
134+
}
135+
}
136+
}

0 commit comments

Comments
 (0)