Settings

Table of Contents

General

ProjectType

A project can be one of different types: addin, module, recipe or other. Some rules have different behavior for different project types. The project type is automatically detected but can be overridden.

The rules on how project type detection is done are as follows (first matching rule applies):

  • Projects not referencing Cake.Core or Cake.Common are always of type other
  • Project names (AssemblyName, PackageId) starting with Cake. and ending in .Module will be treated as module
  • Project names (AssemblyName, PackageId) starting with Cake. and ending in .Recipe will be treated as recipe
  • Project names (AssemblyName, PackageId) starting with Cake. will be treated as addin
  • All other projects are of type other

To override auto-detection use the following:

<PropertyGroup>
    <CakeContribGuidelinesProjectType>module</CakeContribGuidelinesProjectType>
</PropertyGroup>

Though you can technically set CakeContribGuidelinesProjectType to anything you want, setting it to different values than addin, module or recipe might yield unexpected results.

Cake version

Some guidelines (Currently only Target Frameworks) have different characteristics, depending on the Cake version that was used. The Cake version will be auto detected from the referenced

Icons

IconOmitImport

The cake-contrib icon will be automatically included in the project, unless CakeContribGuidelinesIconOmitImport is set to True.

To to use a "custom" import the following could be used:

<PropertyGroup>
    <CakeContribGuidelinesIconOmitImport>True</CakeContribGuidelinesIconOmitImport>
    <PackageIcon>logo.png</PackageIcon>
</PropertyGroup>
<ItemGroup>
    <None Include="icons/logo.png" Pack="True" PackagePath="" />
</ItemGroup>

Opt-Out

OmitRecommendedCakeVersion

It it possible to opt-out of the check for recommended Cake version using the CakeContribGuidelinesOmitRecommendedCakeVersion setting and setting it's Include to the reference that should not be checked.

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

<ItemGroup>
    <CakeContribGuidelinesOmitRecommendedCakeVersion Include="Cake.Common" />
    <CakeContribGuidelinesOmitRecommendedCakeVersion Include="Cake.Core" />
</ItemGroup>

OmitRecommendedConfigFile

It is possible to opt-out of the check for configuration-files by using the CakeContribGuidelinesOmitRecommendedConfigFile setting and setting it's Include to the file name that should not be checked:

<ItemGroup>
    <CakeContribGuidelinesOmitRecommendedConfigFile Include="stylecop.json" />
    <CakeContribGuidelinesOmitRecommendedConfigFile Include=".editorconfig" />
</ItemGroup>

OmitRecommendedReference

It it possible to opt-out of the check for recommended references by using the CakeContribGuidelinesOmitRecommendedReference setting and setting it's Include to the reference that should not be checked.

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

<ItemGroup>
    <CakeContribGuidelinesOmitRecommendedReference Include="StyleCop.Analyzers" />
</ItemGroup>

OmitRecommendedTag

It it possible to opt-out of the check for recommended tags by using the CakeContribGuidelinesOmitRecommendedTag setting and setting it's Include to the tag that should not be checked.

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

<ItemGroup>
    <CakeContribGuidelinesOmitRecommendedTag Include="script" />
    <CakeContribGuidelinesOmitRecommendedTag Include="build" />
</ItemGroup>

OmitPrivateCheck

It it possible to opt-out of the check for PrivateAssets using the CakeContribGuidelinesCakeReferenceOmitPrivateCheck setting:

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

<PropertyGroup>
    <CakeContribGuidelinesCakeReferenceOmitPrivateCheck>1</CakeContribGuidelinesCakeReferenceOmitPrivateCheck>
</PropertyGroup>

OmitTargetFramework

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>

Override

OverrideTargetFrameworkCakeVersion

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>
GitHub Discussion