snyk / snyk-nuget-plugin

Basic Snyk CLI plugin for .NET support.
Other
5 stars 14 forks source link

fix: [OSM-887] Use `targetAlias` where present instead of raw target name #197

Closed dotkas closed 9 months ago

dotkas commented 9 months ago

Adding a target framework as

<TargetFramework>net7.0-windows</TargetFramework>

Will render the framework name in project.assets.json as

{
  "version": 3,
  "targets": {
    "net7.0-windows7.0": {
      "AsyncFixer/1.6.0": {
        "type": "package"
      },
      "IDisposableAnalyzers/4.0.7": {
        "type": "package"
      },
(...)

And currently we pick up that target name verbatim as pass it along as a valid target framework. That's not the case, apparently, as the correct target framework ought to be net7.0-windows, which the assets file do describe in the frameworks list as a targetAlias:

     "frameworks": {
        "net7.0-windows7.0": {
          "targetAlias": "net7.0-windows",
          "projectReferences": {
(...)

So this PR changes the list of targetFrameworks we work with to use the alias if detected, key name otherwise.

dotkas commented 9 months ago

@Greg-Smulko the more the merrier! 🥳

snyksec commented 9 months ago

:tada: This PR is included in version 2.3.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: