Target Frameworks

Table of Contents

Goals

Each addin/module should have maximum compatibility when being used. Toward that end some Framework versions are required and some others are suggested, depending on the Cake.Core version that is being referenced.

Required / Suggested versions

Depending on the package type and the referenced Cake.Core-version different target versions are required and/or suggested. Missing a required target version will raise CCG0007 as an error while missing a suggested target version will raise CCG0007 as a warning.

  • Package type: addin
    • Cake.Core < 1.0.0
      • Required: netstandard2.0
      • Suggested: net461
        • alternative: net46
    • Cake.Core >= 1.0.0
      • Required: netstandard2.0
      • Suggested: net461
        • alternative: net46
      • Suggested: net5.0
    • Cake.Core >= 2.0.0
      • Required: netcoreapp3.1
      • Required: net5.0
      • Required: net6.0
    • Cake.Core >= 3.0.0
      • Required: net6.0
      • Required: net7.0
    • Cake.Core >= 4.0.0
      • Required: net6.0
      • Required: net7.0
      • Required: net8.0
  • Package type: module
    • Cake.Core < 2.0.0
      • Required: netstandard2.0
      • No additional targets are allowed.
    • Cake.Core >= 2.0.0
      • Required: netcoreapp3.1
      • No additional targets are allowed.
    • Cake.Core >= 3.0.0
      • Required: net6.0
      • No additional targets are allowed.
    • Cake.Core >= 4.0.0
      • Required: net6.0
      • No additional targets are allowed.

For package type recipe no framework reference is required or suggested.

These rules are only applied for project types addin and module.

Usage

Using this package automatically enables this guideline.

Settings

Cake Version

It it possible to override the detected Cake version using the CakeContribGuidelinesOverrideTargetFrameworkCakeVersion setting:

(Keep in mind, though, that it is not recommended override the detected version.)

<PropertyGroup>
    <CakeContribGuidelinesOverrideTargetFrameworkCakeVersion>2.0.0</CakeContribGuidelinesOverrideTargetFrameworkCakeVersion>
</PropertyGroup>

Opt-Out

It it possible to opt-out of the check for target framework(s) by using the CakeContribGuidelinesOmitTargetFramework setting and setting it's Include to the target framework that should not be checked.

(Keep in mind, though, that it is not recommended to opt-out of this feature)

<ItemGroup>
    <CakeContribGuidelinesOmitTargetFramework Include="netstandard2.0" />
    <CakeContribGuidelinesOmitTargetFramework Include="net461" />
</ItemGroup>
GitHub Discussion