Problem:
When the TargetFramework is updated on a .NET repository, sometimes Snyk does not pick up the change and the Target Framework remains on the old value.
Steps to reproduce:
- Import an existing (working) .NET project to Snyk
- Any new changes made will pass PR checks as expected
- Change the .NET targetFramework for your project in code
- Make a PR with the above change
- The PR checks fail
Why?
Each .NET project is linked 1:1 to the targetFramework it was imported with. If a manifest file (e.g. csproj) mentions 2 or 3 targetFrameworks it will be imported to Snyk as 2 or 3 separate projects.
This means that if a project's targetFramework is changed (added or removed) Snyk will not understand this very well.
Projects linked to removed targetFrameworks will remain in the portal, but will be unable to re-test (recurring or manual)
New targetFramework projects will only show if the repo/file is reimported.
Discussion and Resolution
This is a known limitation of Snyk's .NET implementation. The current fix is to delete the project, merge the targetFramework change, and then re-import the project so that Snyk can see the new targetFramework and work accordingly.
Alternatively, importing the repo again will find the new target framework and create a new project. The previous project, referencing the prior target framework, will be retained in snyk and can be deleted or deactivated as relevant to your business needs.
For more details about .NET, see the Snyk for .NET documentation.
Important Considerations when Deleting or Deactivating a project
Deleting a project will remove it permanently from the Snyk UI. Project history and ignores will be removed. Any individually applied settings such as Collections, Tags, or Project Attributes are applied on the project level and will need to be copied over as appropriate.
Projects can be deleted individually via the Projects page, Project Settings page, Bulk Actions page, or via API.
If a Target is deleted, all projects within the target are deleted, so these considerations apply then too.
Ignores
Ignores applied to a project via the UI or API are specific to that project. Deletion of a project will remove the ignores.
Alternative methods to retaining ignores across projects are utilising a .snyk file in the repo in the same location as the manifest, or utilising policies.
History
Project History is not retained when a project is deleted.
In order to maintain Project History, deactivate the project instead.
Deactivated projects are not automatically retested, and do not appear in reports
Collections, Tags, Project Attributes
Collections, Tags, and Project Attributes are applied to projects on an individual basis, either through the UI or via API. If a project is deleted, these mappings are lost, and will need to be applied as appropriate to any new projects.