Skip to content

Instantly share code, notes, and snippets.

@ByteDev
Last active February 15, 2022 08:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ByteDev/49987ea867db13f20a888885c29b6b34 to your computer and use it in GitHub Desktop.
Save ByteDev/49987ea867db13f20a888885c29b6b34 to your computer and use it in GitHub Desktop.
Example Directory.Build.props for StyleCop
<Project>
  
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
    <CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)ByteDev.Custom.ruleset</CodeAnalysisRuleSet>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)ByteDev.Custom.ruleset</CodeAnalysisRuleSet>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='FullDebug|AnyCPU'">
    <CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)ByteDev.Custom.ruleset</CodeAnalysisRuleSet>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
  </PropertyGroup>
  
  <ItemGroup>
    <PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
        <PrivateAssets>all</PrivateAssets>
        <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
    </PackageReference>
  </ItemGroup>
  
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment