github / github/codeql

CodeQL integration with Visual Studio 2022

Open
#15,196 0 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
CodeQL
Stars
10.1k
Forks
2.1k
Avg merge
2d 15h
Merged PRs (30d)
141

Description

Hello all,

I was trying to run Codeql from Visual studio2022, steps given below.

1-downloaded codeql-bundle-win64 from git >> set Path for Codeql
2-Open My sample C# application
3- Created Batch file with "codeql database create D:\csharp-database1057 --language=csharp --overwrite"
4- set as Prebuild event
5- Created Batch file with "codeql database analyze D:\csharp-database1057 csharp-code-scanning.qls --sarif-category=javascript-typescript --format=sarif-latest --output=C:\Output\xyz.sarif"
6- Build the solution

o/p: exception from step3
2023-12-22 18:29:48] Exception caught at top level: D:\csharp-database1057 is not a recognized CodeQL database.
com.semmle.cli2.database.DatabaseLayout.(DatabaseLayout.java:189)
com.semmle.cli2.database.DatabaseLayout.load(DatabaseLayout.java:136)
com.semmle.cli2.database.DatabaseLayout.loadAndSetupLogging(DatabaseLayout.java:237)
com.semmle.cli2.database.MultiDatabaseOptions.resolveDatabases(MultiDatabaseOptions.java:68)
com.semmle.cli2.database.MultiDatabaseOptions.resolveDatabases(MultiDatabaseOptions.java:60)
com.semmle.cli2.database.FinalizeCommand.executeSubcommand(FinalizeCommand.java:120)
com.semmle.cli2.picocli.SubcommandCommon.lambda$executeSubcommandWithMessages$5(SubcommandCommon.java:803)
com.semmle.cli2.picocli.SubcommandCommon.withCompilationMessages(SubcommandCommon.java:442)
com.semmle.cli2.picocli.SubcommandCommon.executeSubcommandWithMessages(SubcommandCommon.java:801)
com.semmle.cli2.picocli.PlumbingRunner.run(PlumbingRunner.java:119)
com.semmle.cli2.picocli.SubcommandCommon.runPlumbingInProcess(SubcommandCommon.java:199)
com.semmle.cli2.database.CreateCommand.executeSubcommand(CreateCommand.java:199)
com.semmle.cli2.picocli.SubcommandCommon.lambda$executeSubcommandWithMessages$5(SubcommandCommon.java:803)
com.semmle.cli2.picocli.SubcommandCommon.withCompilationMessages(SubcommandCommon.java:442)
com.semmle.cli2.picocli.SubcommandCommon.executeSubcommandWithMessages(SubcommandCommon.java:801)
com.semmle.cli2.picocli.SubcommandCommon.toplevelMain(SubcommandCommon.java:685)
com.semmle.cli2.picocli.SubcommandCommon.call(SubcommandCommon.java:666)
com.semmle.cli2.picocli.SubcommandMaker.runMain(SubcommandMaker.java:237)
com.semmle.cli2.picocli.SubcommandMaker.runMain(SubcommandMaker.java:247)
com.semmle.cli2.CodeQL.main(CodeQL.java:115)

Can someone provide suggestion how I can go about this CodeQL integration with Vs2022? Any suggestions will be greatly appreciated.

It is working fine with individual command execution from Command Prompt for Database Creation /database analyze.

Thanks,
Avdhesh

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.