codeql-action
codeql-action copied to clipboard
CodeQL does not seem to support .NET 6.x (pre-release)
Code is not detected when built with .NET 6.x (pre-release).
Correct, we do not officially support pre-releases for C#.
.NET 6 is now officially released.
Similar to https://github.com/github/codeql-action/issues/244#issuecomment-725121467
Add a global.json file to your project with
{
"sdk": {
"version": "6.0.100",
"rollForward": "latestMajor"
}
}
Tested and working on my .NET 6 project over at https://github.com/Reelix/Reecon
Similar to #244 (comment)
Add a
global.jsonfile to your project with{ "sdk": { "version": "6.0.100", "rollForward": "latestMajor" } }Tested and working on my .NET 6 project over at https://github.com/Reelix/Reecon
Thanks for the workaround. Works for my project, as well.
I added a "Set up .NET" step with .NET version 6 before Autobuild and it also works.
I added a "Set up .NET" step with .NET version 6 before Autobuild and it also works.
For people who may stumble upon this and not really know what this means, you can add the following to your .yml file as one of the steps in the job. I added this just before the "Initialize CodeQL" step.
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0'
include-prerelease: True
I added a "Set up .NET" step with .NET version 6 before Autobuild and it also works.
For people who may stumble upon this and not really know what this means, you can add the following to your .yml file as one of the
stepsin the job. I added this just before the "Initialize CodeQL" step.- name: Setup .NET uses: actions/setup-dotnet@v1 with: dotnet-version: '6.0' include-prerelease: True
You don't need to include prerelease if you don't need .NET 6 Preview builds.
To add some information to people coming to this thread, I suppose the official support matrix is at https://codeql.github.com/docs/codeql-overview/supported-languages-and-frameworks/ and it does not include .NET 6 yet.
I checked at https://github.com/lumoin/Verifiable/runs/4308854222?check_suite_focus=true#step:12:92 and got
Error: No code found during the build.
which started after updating to .NET 6 and C# 10. I have not tried add global.json but I take from this thread it would work.
There is setup actions/setup-dotnet@v1 for .NET 6 at https://github.com/lumoin/Verifiable/blob/main/.github/workflows/main.yml#L105.
To add some information to people coming to this thread, I suppose the official support matrix is at https://codeql.github.com/docs/codeql-overview/supported-languages-and-frameworks/ and it does not include .NET 6 yet.
I checked at https://github.com/lumoin/Verifiable/runs/4308854222?check_suite_focus=true#step:12:92 and got
Error: No code found during the build.
which started after updating to .NET 6 and C# 10. I have not tried add
global.jsonbut I take from this thread it would work.There is setup
actions/setup-dotnet@v1for .NET 6 at https://github.com/lumoin/Verifiable/blob/main/.github/workflows/main.yml#L105.
This might not work if you don't use autobuild.
This might not work if you don't use autobuild.
Ah, thanks! This could be a useful piece of information. I have not thought about using autobuild, not even adding global.json but just waiting for the .NET 6 support to appear.
This might not work if you don't use autobuild.
Ah, thanks! This could be a useful piece of information. I have not thought about using autobuild, not even adding
global.jsonbut just waiting for the .NET 6 support to appear.
You could see an example here: https://raw.githubusercontent.com/RanTodd-Team/RanTodd/master/.github/workflows/codeql-analysis.yml
Is there any update on this @hvitved? .NET 6 has been out for 2 months now, and since it's an LTS release, support is especially important.
Is there any update on this @hvitved? .NET 6 has been out for 2 months now, and since it's an LTS release, support is especially important.
@samuel-lucas6 Updating global.json and the yml file as described in the comments above has fixed the issue for me for all of my .NET 6.0 projects. Check out https://github.com/pmachapman/GoTo.Bible/commit/94907205e86184a92f350e1d596908b8dc65de7e to see this in action.
@samuel-lucas6 Updating global.json and the yml file as described in the comments above has fixed the issue for me for all of my .NET 6.0 projects. Check out pmachapman/GoTo.Bible@9490720 to see this in action.
Thank you for the tip, but I've already had to implement the fix for one of my projects; I'm just trying to bring attention to this issue again since the last message was back in November and .NET 6 should be supported without any tweaks by now.
We updated the C# extractor back in December to use the latest version of Microsoft.CodeAnalysis.CSharp (Roslyn), which means that we will be able to partially support C# 10 code bases (full support is scheduled for implementation this quarter). This means that projects built with C# 10 / .NET 6 should work at least partially.
The workarounds in this thread seem to be about the Actions workers not having .NET 6 installed by default, which appears to still be needed, at least when using ubuntu-latest.
I have added a request for ubuntu-latest to include .NET 6 here: https://github.com/actions/virtual-environments/issues/4851.
I have added a request for
ubuntu-latestto include .NET 6 here: actions/virtual-environments#4851.
Many thanks @hvitved!
I was trying to update my .NET Core project to 6.0. Seems still need workarounds now It's worked for me but still wonder if need workarounds now? or already have an official solution?
I added a "Set up .NET" step with .NET version 6 before Autobuild and it also works.
For people who may stumble upon this and not really know what this means, you can add the following to your .yml file as one of the
stepsin the job. I added this just before the "Initialize CodeQL" step.- name: Setup .NET uses: actions/setup-dotnet@v1 with: dotnet-version: '6.0' include-prerelease: True