dotnet / code-analysis

MIT License
63 stars 19 forks source link

Compatible .NETCore versions #14

Open AndrewBarzu opened 2 years ago

AndrewBarzu commented 2 years ago

Tried using the action with a project that runs on .NET 5, but I keep getting

The framework 'Microsoft.NETCore.App', version '3.1.2' was not found.
  - The following frameworks were found:
      5.0.11 at [C:\Users\runneradmin\AppData\Local\Microsoft\dotnet\shared\Microsoft.NETCore.App]

This is the link to the failed workflow: https://github.com/PC-Chair-Fight/project-backend/runs/4132660755?check_suite_focus=true

louisnayegon commented 2 years ago

I have the same issue with .NET 6

ceberttylertech commented 2 years ago

I have the same issue with .NET 6 as well

Run dotnet/code-analysis@main
  with:
    solution: Tyler.ReportWriting.Service.sln
    build-breaking: true
    all-categories: all
  env:
    DOTNET_NOLOGO: true
    DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
    DOTNET_CLI_TELEMETRY_OPTOUT: 1
    GITHUB_TOKEN: ***
    ARTIFACTORY_USERNAME: ***
    ARTIFACTORY_PASSWORD: ***
    DOTNET_ROOT: /home/runner/.dotnet
    GitVersion_Major: 3
    GitVersion_Minor: 1
    GitVersion_Patch: 0
    GitVersion_PreReleaseTag: PullRequest0445.10
    GitVersion_PreReleaseTagWithDash: -PullRequest0445.10
    GitVersion_PreReleaseLabel: PullRequest0445
    GitVersion_PreReleaseLabelWithDash: -PullRequest0445
    GitVersion_PreReleaseNumber: 10
    GitVersion_WeightedPreReleaseNumber: 30010
    GitVersion_FullBuildMetaData: Branch.pull-445-merge.Sha.621d7b747a866c68447ba7217908e569bd221a93
    GitVersion_MajorMinorPatch: 3.1.0
    GitVersion_SemVer: 3.1.0-PullRequest0445.10
    GitVersion_LegacySemVer: 3.1.0-PullRequest0445-10
    GitVersion_LegacySemVerPadded: 3.1.0-PullRequest0445-0010
    GitVersion_AssemblySemVer: 3.1.0.0
    GitVersion_AssemblySemFileVer: 3.1.0.0
    GitVersion_FullSemVer: 3.1.0-PullRequest0445.10
    GitVersion_InformationalVersion: 3.1.0-PullRequest0445.10+Branch.pull-445-merge.Sha.621d7b747a866c68447ba7217908e569bd221a93
    GitVersion_BranchName: pull/445/merge
    GitVersion_EscapedBranchName: pull-445-merge
    GitVersion_Sha: 621d7b747a866c68447ba7217908e569bd221a93
    GitVersion_ShortSha: 621d7b7
    GitVersion_NuGetVersionV2: 3.1.0-pullrequest0445-0010
    GitVersion_NuGetVersion: 3.1.0-pullrequest0445-0010
    GitVersion_NuGetPreReleaseTagV2: pullrequest0445-0010
    GitVersion_NuGetPreReleaseTag: pullrequest0445-0010
    GitVersion_VersionSourceSha: aac715af863a5e404ebd8f260bc63ee7cb5b4d0f
    GitVersion_CommitsSinceVersionSource: 10
    GitVersion_CommitsSinceVersionSourcePadded: 0010
    GitVersion_UncommittedChanges: 0
    GitVersion_CommitDate: 2022-05-04
    GITVERSION_MAJOR: 3
    GITVERSION_MINOR: 1
    GITVERSION_PATCH: 0
    GITVERSION_PRERELEASETAG: PullRequest0445.10
    GITVERSION_PRERELEASETAGWITHDASH: -PullRequest0445.10
    GITVERSION_PRERELEASELABEL: PullRequest0445
    GITVERSION_PRERELEASELABELWITHDASH: -PullRequest0445
    GITVERSION_PRERELEASENUMBER: 10
    GITVERSION_WEIGHTEDPRERELEASENUMBER: 30010
    GITVERSION_BUILDMETADATA: 
    GITVERSION_BUILDMETADATAPADDED: 
    GITVERSION_FULLBUILDMETADATA: Branch.pull-445-merge.Sha.621d7b747a866c68447ba7217908e569bd221a93
    GITVERSION_MAJORMINORPATCH: 3.1.0
    GITVERSION_SEMVER: 3.1.0-PullRequest0445.10
    GITVERSION_LEGACYSEMVER: 3.1.0-PullRequest0445-10
    GITVERSION_LEGACYSEMVERPADDED: 3.1.0-PullRequest0445-0010
    GITVERSION_ASSEMBLYSEMVER: 3.1.0.0
    GITVERSION_ASSEMBLYSEMFILEVER: 3.1.0.0
    GITVERSION_FULLSEMVER: 3.1.0-PullRequest0445.10
    GITVERSION_INFORMATIONALVERSION: 3.1.0-PullRequest0445.10+Branch.pull-445-merge.Sha.621d7b747a866c68447ba7217908e569bd221a93
    GITVERSION_BRANCHNAME: pull/445/merge
    GITVERSION_ESCAPEDBRANCHNAME: pull-445-merge
    GITVERSION_SHA: 621d7b747a866c68447ba7217908e569bd221a93
    GITVERSION_SHORTSHA: 621d7b7
    GITVERSION_NUGETVERSIONV2: 3.1.0-pullrequest0445-0010
    GITVERSION_NUGETVERSION: 3.1.0-pullrequest0445-0010
    GITVERSION_NUGETPRERELEASETAGV2: pullrequest0445-0010
    GITVERSION_NUGETPRERELEASETAG: pullrequest0445-0010
    GITVERSION_VERSIONSOURCESHA: aac715af863a5e404ebd8f260bc63ee7cb5b4d0f
    GITVERSION_COMMITSSINCEVERSIONSOURCE: 10
    GITVERSION_COMMITSSINCEVERSIONSOURCEPADDED: 0010
    GITVERSION_UNCOMMITTEDCHANGES: 0
    GITVERSION_COMMITDATE: 2022-05-04
{"fileVersion":"1.12.0","tools":[{"fileVersion":"1.12.0","tool":{"name":"RoslynAnalyzers","version":"1.12.0"},"arguments":{"CopyLogsOnly":false,"SourcesDirectory":"$(Folders.SourceRepo)","MSBuildVersion":"16.0","CodeAnalysisAssemblyVersion":"3.8.0","SetupCommandlines":"\\\"$(VisualStudioInstallDirectory)\\Common7\\Tools\\VsMSBuildCmd.bat\\\"","BuildArchitecture":"amd64","BuildCommandlines":"msbuild.exe /p:AnalysisLevel=latest /p:AnalysisMode=all Tyler.ReportWriting.Service.sln","NetAnalyzersRootDirectory":"$(Packages.Microsoft.CodeAnalysis.NetAnalyzers)","CSharpCodeStyleAnalyzersRootDirectory":"$(Packages.Microsoft.CodeAnalysis.CSharp.CodeStyle)","FxCopAnalyzersRootDirectory":"","RulesetPath":"","SdlRulesetVersion":"","TreatWarningsAsErrors":true,"LoggerLevel":"Warning","ForceSuccess":true},"outputExtension":"sarif","successfulExitCodes":[0]}]}
------------------------------------------------------------------------------
Installing and running analyzers...
Warnings and errors will be displayed once the analysis completes.
------------------------------------------------------------------------------
Installing Microsoft Security Code Analysis Cli...
/home/runner/.dotnet/dotnet restore /home/runner/work/_actions/dotnet/code-analysis/main/lib/msca-toolkit/msca-toolkit.proj /p:MscaPackageVersion=0.* --packages /home/runner/work/_msca/versions --source https://api.nuget.org/v3/index.json
  Determining projects to restore...
  Restored /home/runner/work/_actions/dotnet/code-analysis/main/lib/msca-toolkit/msca-toolkit.proj (in 2.1 sec).
------------------------------------------------------------------------------
/home/runner/work/_msca/versions/microsoft.security.codeanalysis.cli/0.111.1/tools/guardian init --force
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '3.1.2' (x64) was not found.
  - The following frameworks were found:
      6.0.4 at [/home/runner/.dotnet/shared/Microsoft.NETCore.App]

You can resolve the problem by installing the specified framework and/or SDK.

The specified framework can be found at:
  - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.1.2&arch=x64&rid=ubuntu.20.04-x64
/home/runner/work/_msca/versions/microsoft.security.codeanalysis.cli/0.111.1/tools/guardian run -c /home/runner/work/_actions/dotnet/code-analysis/main/roslynanalyzers.gdnconfig --no-policy --logger-level Warning --export-breaking-results-to-file /home/runner/work/nwps-reportwriting-service/nwps-reportwriting-service/.gdn/analysis_results.sarif
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '3.1.2' (x64) was not found.
  - The following frameworks were found:
      6.0.4 at [/home/runner/.dotnet/shared/Microsoft.NETCore.App]

You can resolve the problem by installing the specified framework and/or SDK.

The specified framework can be found at:
  - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.1.2&arch=x64&rid=ubuntu.20.04-x64
ceberttylertech commented 2 years ago

I was wondering if this action is still recommended/supported by Microsoft, in the Overview of .NET source code analysis Microsoft Documentation Page, it is recommended to set this up under the Run code analysis as a GitHub Action section. However, it doesn't look like this action has been updated to support anything beyond .NET Core 3?

serkanince commented 1 year ago

i have a same problem. project uses .net 6

/home/runner/work/_msca/versions/microsoft.security.codeanalysis.cli/0.111.1/tools/guardian init --force
You must install or update .NET to run this application.

App: /home/runner/work/_msca/versions/microsoft.security.codeanalysis.cli/0.111.1/tools/Microsoft.Guardian.Cli.dll
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '3.1.2' (x64)
.NET location: /usr/share/dotnet/

The following frameworks were found:
  6.0.11 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  7.0.0 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]