diff --git a/csharp/ql/integration-tests/all-platforms/standalone_dependency_dir/Assemblies.expected b/csharp/ql/integration-tests/all-platforms/standalone_dependency_dir/Assemblies.expected new file mode 100644 index 00000000000..b98f10a366c --- /dev/null +++ b/csharp/ql/integration-tests/all-platforms/standalone_dependency_dir/Assemblies.expected @@ -0,0 +1 @@ +| dependencies/packages/newtonsoft.json/13.0.1/lib/netstandard2.0/Newtonsoft.Json.dll:0:0:0:0 | Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed | diff --git a/csharp/ql/integration-tests/all-platforms/standalone_dependency_dir/Assemblies.ql b/csharp/ql/integration-tests/all-platforms/standalone_dependency_dir/Assemblies.ql new file mode 100644 index 00000000000..625fc299761 --- /dev/null +++ b/csharp/ql/integration-tests/all-platforms/standalone_dependency_dir/Assemblies.ql @@ -0,0 +1,7 @@ +import csharp + +from Assembly a +where + not a.getCompilation().getOutputAssembly() = a and + a.getName().matches("%Newtonsoft%") +select a diff --git a/csharp/ql/integration-tests/all-platforms/standalone_dependency_dir/proj/Program.cs b/csharp/ql/integration-tests/all-platforms/standalone_dependency_dir/proj/Program.cs new file mode 100644 index 00000000000..39a9e95bb6e --- /dev/null +++ b/csharp/ql/integration-tests/all-platforms/standalone_dependency_dir/proj/Program.cs @@ -0,0 +1,6 @@ +class Program +{ + static void Main(string[] args) + { + } +} \ No newline at end of file diff --git a/csharp/ql/integration-tests/all-platforms/standalone_dependency_dir/proj/global.json b/csharp/ql/integration-tests/all-platforms/standalone_dependency_dir/proj/global.json new file mode 100644 index 00000000000..4c6e2601f69 --- /dev/null +++ b/csharp/ql/integration-tests/all-platforms/standalone_dependency_dir/proj/global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "9.0.304" + } +} diff --git a/csharp/ql/integration-tests/all-platforms/standalone_dependency_dir/proj/standalone.csproj b/csharp/ql/integration-tests/all-platforms/standalone_dependency_dir/proj/standalone.csproj new file mode 100644 index 00000000000..29604e2cbd8 --- /dev/null +++ b/csharp/ql/integration-tests/all-platforms/standalone_dependency_dir/proj/standalone.csproj @@ -0,0 +1,16 @@ + + + + Exe + net9.0 + + + + + + + + + + + diff --git a/csharp/ql/integration-tests/all-platforms/standalone_dependency_dir/test.py b/csharp/ql/integration-tests/all-platforms/standalone_dependency_dir/test.py new file mode 100644 index 00000000000..6aeb36182dd --- /dev/null +++ b/csharp/ql/integration-tests/all-platforms/standalone_dependency_dir/test.py @@ -0,0 +1,8 @@ +import os + +def test(codeql, csharp, cwd): + path = os.path.join(cwd, "dependencies") + os.environ["CODEQL_EXTRACTOR_CSHARP_OPTION_BUILDLESS_DEPENDENCY_DIR"] = path + # The Assemblies.ql query shows that the Newtonsoft assembly is found in the + # dependency directory set above. + codeql.database.create(source_root="proj", build_mode="none")